Get a list of current running APP in Anrdroid : I want 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}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.EditText.setText(java.lang.CharSequence)' on a null object reference
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.j

