{"id":6105,"date":"2014-04-13T02:23:56","date_gmt":"2014-04-13T02:23:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/got-threadid1-thread-exiting-with-uncaught-exception-group0x41088930-on-listview-collection-of-common-programming-errors\/"},"modified":"2014-04-13T02:23:56","modified_gmt":"2014-04-13T02:23:56","slug":"got-threadid1-thread-exiting-with-uncaught-exception-group0x41088930-on-listview-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/got-threadid1-thread-exiting-with-uncaught-exception-group0x41088930-on-listview-collection-of-common-programming-errors\/","title":{"rendered":"Got threadid=1: thread exiting with uncaught exception (group=0x41088930) on listview-Collection of common programming errors"},"content":{"rendered":"<p>i&#8217;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>\n<pre><code>(Logcat)\n\n02-18 14:17:46.700: W\/dalvikvm(18370): threadid=1: thread exiting with uncaught exception (group=0x41088930)\n02-18 14:17:46.700: E\/AndroidRuntime(18370): FATAL EXCEPTION: main\n02-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\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread.access$600(ActivityThread.java:153)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.os.Handler.dispatchMessage(Handler.java:99)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.os.Looper.loop(Looper.java:137)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread.main(ActivityThread.java:5204)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at java.lang.reflect.Method.invokeNative(Native Method)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at java.lang.reflect.Method.invoke(Method.java:511)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at dalvik.system.NativeStart.main(Native Method)\n02-18 14:17:46.700: E\/AndroidRuntime(18370): Caused by: java.lang.NullPointerException\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.widget.ArrayAdapter.getCount(ArrayAdapter.java:330)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.widget.ListView.setAdapter(ListView.java:462)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at kr.hybdms.sidepanel.LeftSidePanel.onCreate(LeftSidePanel.java:59)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.Activity.performCreate(Activity.java:5108)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2263)\n02-18 14:17:46.700: E\/AndroidRuntime(18370):    ... 11 more\n<\/code><\/pre>\n<pre><code>(LeftSidePanel.java)\n\npackage kr.hybdms.sidepanel;\n\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n\nimport kr.hybdms.sidepanel.PanelArrayAdapter;\nimport kr.hybdms.sidepanel.R;\n\nimport kr.hybdms.sidepanel.util.SystemUiHider;\n\n\nimport android.app.Activity;\nimport android.app.ActivityManager;\nimport android.content.pm.PackageManager;\nimport android.content.pm.PackageManager.NameNotFoundException;\n\nimport android.os.Bundle;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.AdapterView.OnItemClickListener;\nimport android.widget.ListView;\nimport android.widget.Toast;\n\n\/**\n * An example full-screen activity that shows and hides the system UI (i.e.\n * status bar and navigation\/system bar) with user interaction.\n * \n * @see SystemUiHider\n *\/\npublic class LeftSidePanel extends Activity implements\nOnItemClickListener {\nListView listView;\nList rowItems;\n\/** Called when the activity is first created. *\/\n@Override\npublic void onCreate(Bundle savedInstanceState) {\nsuper.onCreate(savedInstanceState);\nsetContentView(R.layout.activity_left_side_panel);\n\nActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);\nList tasks = am.getRunningTasks(10);\nArrayList iconarray = new ArrayList();\nPackageManager pacMgr = getPackageManager();\n  for (ActivityManager.RunningTaskInfo runningTask: tasks)\n  {\n    try {\n        iconarray.add(new PanelItemDetail(pacMgr.getApplicationIcon(runningTask.topActivity.getPackageName())));\n    } catch (NameNotFoundException e) {\n      e.printStackTrace();\n    }\n  }\n\nlistView = (ListView) findViewById(R.id.panelcontents);\nPanelArrayAdapter adapter = new PanelArrayAdapter(this,\n        R.layout.panelrow, rowItems);\nlistView.setAdapter(adapter);\nlistView.setOnItemClickListener(this);\n}\n\n@Override\npublic void onItemClick(AdapterView parent, View view, int position,\n    long id) {\nToast toast = Toast.makeText(getApplicationContext(),\n    \"Item \" + (position + 1) + \": \" + rowItems.get(position),\n    Toast.LENGTH_SHORT);\ntoast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);\ntoast.show();\n}\n}\n<\/code><\/pre>\n<pre><code>(PanelArrayAdapter.java)\n\npackage kr.hybdms.sidepanel;\n\nimport java.util.List;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ArrayAdapter;\nimport android.widget.ImageView;\n\npublic class PanelArrayAdapter extends ArrayAdapter {\n    Context context;\n    public PanelArrayAdapter(Context context, int resourceId,\n            List items) {\n        super(context, resourceId, items);\n        this.context = context;\n    }\n    \/*private view holder class*\/\n    private class ViewHolder {\n        ImageView imageView;\n    }\n    public View getView(int position, View convertView, ViewGroup parent) {\n        ViewHolder holder = null;\n        PanelItemDetail rowItem = getItem(position);\n        LayoutInflater mInflater = (LayoutInflater) context\n                .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);\n        if (convertView == null) {\n            convertView = mInflater.inflate(R.layout.panelrow, null);\n            holder = new ViewHolder();\n            holder.imageView = (ImageView) convertView.findViewById(R.id.appicon);\n            convertView.setTag(holder);\n        } else\n            holder = (ViewHolder) convertView.getTag();\n        holder.imageView.setImageDrawable(rowItem.getImageId());\n        return convertView;\n    }\n}\n<\/code><\/pre>\n<pre><code>(PanelItemDetail.java)\n\npackage kr.hybdms.sidepanel;\n\nimport android.graphics.drawable.Drawable;\n\npublic class PanelItemDetail {\n    private Drawable imageId;\n    public PanelItemDetail(Drawable images) {\n        this.imageId = images;\n    }\n    public Drawable getImageId() {\n        return imageId;\n    }\n    public void setImageId(Drawable imageId) {\n        this.imageId = imageId;\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>i&#8217;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 threadid=1: thread exiting with uncaught exception (group=0x41088930)and more error how can i fix this error? should i use Asynctask to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6105","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6105"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6105\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}