-1
インストールされているアプリケーションを警告グリッド表示でビルドしています。私は いくつかのお気に入りのアプリを選択していて、その後に別のグリッドビューを追加している場合 新しいGridviewアプリからアプリを選択すると、そのインテント値(getLaunchIntentForPackage)がnullです。getLaunchIntentForPackageがアプリの場合はnull
quick_links_alert.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { List<String> mArrayProducts = clad.getCheckedItems(); final QuickLinksGridViewAdaptor selected_apps = new QuickLinksGridViewAdaptor(HomeActivity.this, mArrayProducts); gv_shortcut.setAdapter(selected_apps); Toast.makeText(getApplicationContext(),"Selected Items-->:"+mArrayProducts,Toast.LENGTH_LONG).show(); PackageManager pm = HomeActivity.this.getPackageManager(); Intent quick_intent = new Intent(Intent.ACTION_MAIN, null); final List<ResolveInfo> list = pm.queryIntentActivities(quick_intent, PackageManager.PERMISSION_GRANTED); gv_shortcut.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final String packageName = list.get(position).activityInfo.packageName; Intent PackageManagerIntent = getPackageManager().getLaunchIntentForPackage(packageName); if (PackageManagerIntent != null) { startActivity(PackageManagerIntent); } else { Toast.makeText(getApplicationContext(),"NULL",Toast.LENGTH_LONG).show(); } } }); } In my grid view 8 applications are available.If I click any application its PackageManagerIntent is getting null and 1 and 3 position application its always open google search engine and player application is opening.
私が選択したアプリ名がperfect.Iは、選択したアプリが開かれていない理解することができませんでしなっている取得しています –