-2

I am able to fetch the installed or running app list . Now I want to detect in the list is there any music player app present or not?

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);
    }
Reno
  • 33,594
  • 11
  • 89
  • 102
Vineet Shukla
  • 23,865
  • 10
  • 55
  • 63

1 Answers1

1

this should do the trick.....

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");
    }
    }
Nitin
  • 1,451
  • 13
  • 17
  • thanks for help.......and I need to list out music players from the device and show it to users in the list.....how to do that...... – Vineet Shukla Jun 17 '11 at 12:35