android - Launch activity with intent -


i've listapp activity list installed application, i'm trying here when user selects app list should intent/info selected app , when user click button1, should open app(with of intent retrieved earlier) selected earlier.

listapp activity:

 @override public void onclick(view arg0) {     // todo auto-generated method stub      switch (arg0.getid()){      case r.id.button1:          //startactivity(app.intent);         //should start app of info received selecting app  list         break;     }       @override public void onitemclick(adapterview<?> parent, view v, int position, long id) {  //applicationinfo app = (applicationinfo) parent.getitematposition(position);     //startactivity(app.intent);          //instead of launching app, info selected app & use it(start app) when clicking button1 } 

applicationinfo

class applicationinfo {  charsequence title; intent intent; drawable icon; boolean filtered;    final void setactivity(componentname classname, int launchflags) {     intent = new intent(intent.action_main);     intent.addcategory(intent.category_launcher);     intent.setcomponent(classname);     intent.setflags(launchflags);     } } 

thanks :)

get activity info index in list if know package name of app.

list<resolveinfo> rinfo =  getpackagemanager().queryintentactivities(new intent(intent.action_main),match_default_only);  for(resolveinfo resolveinfo:rinfo){     if(resolveinfo.activityinfo.packagename.equals("package")){ 

set component resolve info.

        componentname chosenname = new componentname(         resolveinfo.activityinfo.packagename,         resolveinfo.activityinfo.name);         break;      }  }  final intent intent = new intent(intent.action_main, null); intent.addcategory(intent.category_launcher); intent.setcomponent(chosenname); startactivity(intent); 

set component above.

public componentname (string pkg, string cls)

added in api level 1 create new component identifier.

parameters pkg name of package component exists in. can not null. cls name of class inside of pkg implements component. can not null.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -