Android 意向应用程序选择器不应启动应用程序,应返回应用程序信息
我是android开发新手。我想得到一个应用程序的意图,它已经被用户通过选择器选择。下面是我的代码Android 意向应用程序选择器不应启动应用程序,应返回应用程序信息,android,android-intent,Android,Android Intent,我是android开发新手。我想得到一个应用程序的意图,它已经被用户通过选择器选择。下面是我的代码 Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); Intent chooser = Intent.createChooser(mainIntent, "title
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
Intent chooser = Intent.createChooser(mainIntent, "title");
startActivity(chooser); //I don't want to start the intent ... just to know which one user chose
问题是,每次用户选择一个应用程序时,它都会启动。但我只想要所选应用程序的意图/信息。我将稍后启动该应用程序
希望你明白我的意思
提前感谢您必须自己构建一个选择器,方法是使用
PackageManager.queryIntentActivities()
检索相关目标,然后从中构建自己的对话框