android - Start spesific app preventing Intent chooser -


i have declared custom action intent , built ui based on applications can handle intent. know application button click should start, how prevent chooser showing possible applications.

final intent intent = new intent(); intent.setaction(custom_action);  packagemanager packagemanager = getpackagemanager(); final list<resolveinfo> activities = packagemanager         .queryintentactivities(intent, 0);  (int = 0; < activities.size(); i++) {     final resolveinfo info = activities.get(i);      button b = new button(this);     b.settext(info.loadlabel(packagemanager));      b.setonclicklistener(new onclicklistener() {          @override         public void onclick(view v) {             // line solution             intent.setpackage(info.activityinfo.packagename);              startactivityforresult(intent, request_code);         }     });      mlayout.addview(b); } 

thanks.

have @ intent.setpackage(string), allows make intent start provided package name, bypassing chooser. if package want use not natively present on android, still advise check presence @ first, , alert user otherwise.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -