Domanda

the question is straight...

I want to develop a simple launcher application. then for which Intentaction I have to listen to open All available apps(show as Grid as default launcher) when user press on Applicationsbutton.

È stato utile?

Soluzione

You can write your own listview. It takes me about 30 min.

first get all installed apps with List<ApplicationInfo> apps=getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

then show tem on list or grid with your custom adapter

For example you can show app name and icon

holder.tv.setText(getPackageManager().getApplicationLabel(apps.get(arg0)));
holder.imgv.setImageDrawable(getPackageManager().getApplicationIcon(apps.get(arg0)));

and add onItemClick action to run application with

String PackageName=apps.get(arg0).packageName;
Intent intent=getPackageManager().getLaunchIntentForPackage(PackageName);
startActivity(this, intent);

Altri suggerimenti

You need to implement the applications button by your self. Some thing that will start like this:

List<ApplicationInfo> packages = pm
            .getInstalledApplications(PackageManager.GET_META_DATA);

Because you are the one who will lunch the applications you should know when they start ;)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top