I want to use the ActivityManager to get a list of current APPs and return the newest process` name to the system clipboard.Just like this
 protected void onStart() {
        super.onStart();
        Amanager=(ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
        ActivityManager.RunningAppProcessInfo App=null;
        List<ActivityManager.RunningAppProcessInfo> RunningTasks;
        try {
            RunningTasks = Amanager.getRunningAppProcesses();
            App = RunningTasks.get(0);
        }catch (final Exception e){Log.d(TAG, "List ERROR");}
        if(App!=null) {
            String result =App.processName;
            contentText.setText(result);;
            Clipboard.setText(result);
        }else {
            Log.d(TAG, "COMPONENT ERROR");
        }
    }
But when running at the Simulator, some errors occured:
java.lang.RuntimeException: Unable to start activity ComponentInfo{//the absolute address}:
 
     
     
    