Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
96 views
in Technique[技术] by (71.8m points)

java - How to get the icon of other applications (Android)

What I'm doing is getting a list of all the current running processes on the phone. Which I have done by,

private List<RunningAppProcessInfo> process;
private ActivityManager activityMan;
...
activityMan = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
process = activityMan.getRunningAppProcesses();

this works fine. When I call the processName field like

process.get(i).processName;

I get a name like com.android.mail for example.

what I'm trying to do is use this to get access to that application so I can display its icon to the user, but I cant find anything that lets me do this. Is there something that can help me?

I'm testing this app on my hero so the api level is 3 (android 1.5).

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ok, I figured out how to do it. In case your curious this is what I did.

private PackageManager pk;
pk = getPackageManager();
....
pk.getApplicationIcon(process.get(i).processName)

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...