android prompt user's input using a dialog

前端 未结 2 871
醉酒成梦
醉酒成梦 2020-12-08 16:58

I would like to prompt the user to give me input in my android application using a dialog. this is what I have found:

AlertDialog.Builder alert = new AlertDi         


        
2条回答
  •  猫巷女王i
    2020-12-08 17:47

    When I ran your code in a new project, it worked fine. So probably "this" that you are using

    • is not an activity
    • is not the activity in view i.e. there might be a parent activity. If it is the child of some activity, use getParent() instead of "this".
    • is null

    Hope this helps.

提交回复
热议问题