Android: How to start an Activity from an alert dialog

前端 未结 2 580
醉话见心
醉话见心 2020-12-17 05:04

I need to start an activity when the user chooses an item in an alert dialog. How do I get the context to pass to the intent constructor in the following code...

<         


        
2条回答
  •  情书的邮戳
    2020-12-17 05:32

    Intent i = new Intent("some.thing.activity"); 
    startActivity(i);
    

    //in the brackets you can add the activity path, ie: the package name //eg: za.ac.cut.Activity

提交回复
热议问题