如何检查音乐播放器是否安装?
问题描述:
我能够获取已安装或正在运行的应用程序列表。现在我想在列表中检测是否有任何音乐播放器应用程序存在或不存在?如何检查音乐播放器是否安装?
public void getRunningProcess() {
List<RunningAppProcessInfo> list2 = am.getRunningAppProcesses();
listdp = new ArrayList<DetailProcess>();
for (RunningAppProcessInfo ti : list2) {
if (ti.processName.equals("system") || ti.processName.equals("com.android.phone")) {
continue;
}
DetailProcess dp = new DetailProcess(this, ti);
dp.fetchApplicationInfo(packageinfo);
dp.fetchPackageInfo();
dp.fetchPsRow(pinfo);
if (dp.isGoodProcess()) {
listdp.add(dp);
}
}
Collections.sort(listdp);
adapter = new ProcessListAdapter(this, listdp);
}
答
这应该做的伎俩.....
void someFunction(){
Intent intent = new Intent();
intent.setType("audio/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent,1);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
response="";
String filerealpath=null;
if (resultCode == RESULT_OK) {
System.out.println("mp3 player exists");
}
}
请出示你有什么样的代码为止。 – 2011-06-17 12:19:47
以上是我正在提取正在运行的进程的代码.......在我需要检测安装的音乐播放器列表......请指导我,如果有任何其他方式.... .Thanks .. – 2011-06-17 12:31:17