title: Got threadid=1: thread exiting with uncaught exception (group=0x41088930) on listview
body: <p>i'm making an app that shows running apps icon on listview.
  there are no syntax problem (i think) but when i launch app and try to run activity,
  the app force closes and i got <code>threadid=1: thread exiting with uncaught exception (group=0x41088930)</code>and more error how can i fix this error? should i use Asynctask to load image to list view? or any solutions?</p>
  
  <pre><code>(Logcat)
  
  02-18 14:17:46.700: W/dalvikvm(18370): threadid=1: thread exiting with uncaught exception (group=0x41088930)
  02-18 14:17:46.700: E/AndroidRuntime(18370): FATAL EXCEPTION: main
  02-18 14:17:46.700: E/AndroidRuntime(18370): java.lang.RuntimeException: Unable to start activity ComponentInfo{kr.hybdms.sidepanel/kr.hybdms.sidepanel.LeftSidePanel}: java.lang.NullPointerException
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread.access$600(ActivityThread.java:153)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.os.Handler.dispatchMessage(Handler.java:99)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.os.Looper.loop(Looper.java:137)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread.main(ActivityThread.java:5204)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at java.lang.reflect.Method.invokeNative(Native Method)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at java.lang.reflect.Method.invoke(Method.java:511)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at dalvik.system.NativeStart.main(Native Method)
  02-18 14:17:46.700: E/AndroidRuntime(18370): Caused by: java.lang.NullPointerException
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:330)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.widget.ListView.setAdapter(ListView.java:462)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at kr.hybdms.sidepanel.LeftSidePanel.onCreate(LeftSidePanel.java:59)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.Activity.performCreate(Activity.java:5108)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2263)
  02-18 14:17:46.700: E/AndroidRuntime(18370):    ... 11 more
  </code></pre>
  
  <hr>
  
  <pre><code>(LeftSidePanel.java)
  
  package kr.hybdms.sidepanel;
  
  
  import java.util.ArrayList;
  import java.util.List;
  
  
  import kr.hybdms.sidepanel.PanelArrayAdapter;
  import kr.hybdms.sidepanel.R;
  
  import kr.hybdms.sidepanel.util.SystemUiHider;
  
  
  import android.app.Activity;
  import android.app.ActivityManager;
  import android.content.pm.PackageManager;
  import android.content.pm.PackageManager.NameNotFoundException;
  
  import android.os.Bundle;
  import android.view.Gravity;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ListView;
  import android.widget.Toast;
  
  /**
   * An example full-screen activity that shows and hides the system UI (i.e.
   * status bar and navigation/system bar) with user interaction.
   * 
   * @see SystemUiHider
   */
  public class LeftSidePanel extends Activity implements
  OnItemClickListener {
  ListView listView;
  List&lt;PanelItemDetail&gt; rowItems;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_left_side_panel);
  
  ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
  List&lt;ActivityManager.RunningTaskInfo&gt; tasks = am.getRunningTasks(10);
  ArrayList&lt;PanelItemDetail&gt; iconarray = new ArrayList&lt;PanelItemDetail&gt;();
  PackageManager pacMgr = getPackageManager();
    for (ActivityManager.RunningTaskInfo runningTask: tasks)
    {
      try {
          iconarray.add(new PanelItemDetail(pacMgr.getApplicationIcon(runningTask.topActivity.getPackageName())));
      } catch (NameNotFoundException e) {
        e.printStackTrace();
      }
    }
  
  listView = (ListView) findViewById(R.id.panelcontents);
  PanelArrayAdapter adapter = new PanelArrayAdapter(this,
          R.layout.panelrow, rowItems);
  listView.setAdapter(adapter);
  listView.setOnItemClickListener(this);
  }
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
      long id) {
  Toast toast = Toast.makeText(getApplicationContext(),
      "Item " + (position + 1) + ": " + rowItems.get(position),
      Toast.LENGTH_SHORT);
  toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);
  toast.show();
  }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>(PanelArrayAdapter.java)
  
  package kr.hybdms.sidepanel;
  
  import java.util.List;
  
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  
  public class PanelArrayAdapter extends ArrayAdapter&lt;PanelItemDetail&gt; {
      Context context;
      public PanelArrayAdapter(Context context, int resourceId,
              List&lt;PanelItemDetail&gt; items) {
          super(context, resourceId, items);
          this.context = context;
      }
      /*private view holder class*/
      private class ViewHolder {
          ImageView imageView;
      }
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder holder = null;
          PanelItemDetail rowItem = getItem(position);
          LayoutInflater mInflater = (LayoutInflater) context
                  .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
          if (convertView == null) {
              convertView = mInflater.inflate(R.layout.panelrow, null);
              holder = new ViewHolder();
              holder.imageView = (ImageView) convertView.findViewById(R.id.appicon);
              convertView.setTag(holder);
          } else
              holder = (ViewHolder) convertView.getTag();
          holder.imageView.setImageDrawable(rowItem.getImageId());
          return convertView;
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>(PanelItemDetail.java)
  
  package kr.hybdms.sidepanel;
  
  import android.graphics.drawable.Drawable;
  
  public class PanelItemDetail {
      private Drawable imageId;
      public PanelItemDetail(Drawable images) {
          this.imageId = images;
      }
      public Drawable getImageId() {
          return imageId;
      }
      public void setImageId(Drawable imageId) {
          this.imageId = imageId;
      }
  }
  </code></pre>