Hi All,
I have the code to get the list of packages installed in phone. I have
represented the list in the form of Array List, below is the code
snippet. But upon clicking in the package name I want to start that
application, but how do I get the respective class name and package
name to run?
Is there any other method which I can try to start an application?
ArrayList<String> PackageNames = null;
List<PackageInfo> lis =
pm.getInstalledPackages(GET_MINIMAL);
Pkgs = (ListView) findViewById(R.id.package_list);
for (PackageInfo pi : lis)
packages.put(pi.packageName, pi);
PackageNames = new ArrayList<String>(packages.keySet());
Collections.sort(PackageNames);
PackageNames.add(0, "All");
Pkgs.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
PackageNames));
Pkgs.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View v,
int pos,
long rowId) {
Intent i = new Intent();
i.setComponent(new ComponentName(class
name,packagename));
startActivity(i);
}
});
I have tried intent to start the activity, but don't know the class
name and package name to pass in the ComponentName() to start
activity.
Thanks In Advance,
Perumal
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.