android - Getting list of installed app's, easy. But how to launch one of them? -


My first application will be just one kind of launcher, which I would like to improve. This launcher will launch a custom home that the user has installed.

It's like "home switcher", but I want to do it myself.

So my first goal is to get a list of all the "home" applications: it's really easy and the code is:

  int main.iment = new intent (Intent.ACTION_MAIN , Blank); Pm = getBaseContext (). GetPackageManager (); MainIntent.addCategory (Intent.CATEGORY_HOME); List & lt; ResolveInfo & gt; List = pm.queryIntentActivities (key component, 0);  

Now I would like to do this in a listview. My first problem is to get the mark: I have failed, but this is not my main problem (if you can help me I will be happy)

I have been able to create a list view with all the names of the established home:

for (...) {map = new hashMap & Lt; String, string & gt; (); Map.put ("titre", info.activityInfo.applicationInfo.loadLabel (pm) .toString ()); Map.put ("pck", info.activityInfo.packageName); ListItem.add (map);} SimpleAd Apter homeAdapter = new SimpleAdapter (this.getBaseContext), listItem, R.layout.row, new string [] {"img", "titray"}, new int [] {rd .img, RID titre}); MyListView.setAdapter (homeAdapter);

And now when I click on a home, I would like to launch the home, so what I did is:

  ListItemClique (Listaview L), see V, int position, long ID) {super.nilistatemclique (L, V, status, ID); Hashmap & lt; String, string & gt; Map = (hashmap> string, string> myListView.getItemAtPosition (status); MyIntent = new intent (); MyIntent.setPackage (map.get ("PCK")); StartActivity (myIntent); Thus, there is a box that appears and asks me: 

Full use of this: LauncherPro - or Sense - or ADW Warner Gallery < / P>

I'm close to what I want to do, but, I think I'm losing something, am I?

Applying a launcher-style activity.


Comments