Skip to content Skip to sidebar Skip to footer

Get Name Of The App The User Chose From App List (android)

making an android app, i have this intent setup to let the user choose from a list of all apps and it works ok. Intent mainIntent = new Intent(Intent.ACTION_MAIN, null)

Solution 1:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(requestCode == 0 && resultCode == Activity.RESULT_OK && data != null) {
        ComponentName componentName = data.getComponent();
        final String packageName = componentName.getPackageName();
        final String activityName = componentName.getClassName();
    }
}

or you can just startActivity(data); so you can launch which app that user choosed.


Post a Comment for "Get Name Of The App The User Chose From App List (android)"