getActivity() where it is defined?

前端 未结 11 1963
温柔的废话
温柔的废话 2020-12-13 10:19

I\'m very new to android and I\'m following this example.

The code says we need to do these steps to get an dialog box:

AlertDialog.Builder builder =         


        
11条回答
  •  不思量自难忘°
    2020-12-13 10:34

    getActivity when you use then no need to put new... such as

    PendingIntent pi=new PendingIntent.getActivity(this,0,intent,0); //is wrong
    

    user it as :

    PendingIntent pi=PendingIntent.getActivity(this,0,intent,0); //is Right code
    

    here we remove new that provide new allocation but here it provide its allocation via getActivity in with in Activity(this).

提交回复
热议问题