{"id":1520,"date":"2022-08-30T15:17:13","date_gmt":"2022-08-30T15:17:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/26\/crash-upon-screen-being-unlocked-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:13","modified_gmt":"2022-08-30T15:17:13","slug":"crash-upon-screen-being-unlocked-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/crash-upon-screen-being-unlocked-collection-of-common-programming-errors\/","title":{"rendered":"Crash upon screen being unlocked-Collection of common programming errors"},"content":{"rendered":"<p>My app runs fine besides when the user stops using their phone long enough for the screen to lock, when they unlock it the app crashes and im a bit clueless as to why. Here is the error:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/jC5yX.png\" \/><\/p>\n<p>here is the lazy adapter:<\/p>\n<pre><code>    package com.buhz.helpers;\n\nimport java.util.ArrayList;     \nimport java.util.HashMap;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.util.Log;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.View.OnClickListener;\nimport android.view.ViewGroup;\nimport android.widget.BaseAdapter;\nimport android.widget.ImageView;\nimport android.widget.TextView;\n\n\nimport com.buhz.login.R;\nimport com.buhz.login.TabHostFragmentActivity;\nimport com.loopj.android.image.SmartImageView;\n\n\n\npublic class LazyAdapter extends BaseAdapter {\n\n    private Activity activity;\n    private ArrayList data;\n    private static LayoutInflater inflater=null;\n    public ImageLoader imageLoader; \n\n    public LazyAdapter(Activity a, ArrayList d) {\n        activity = a;\n        data=d;\n        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n        imageLoader=new ImageLoader(activity.getApplicationContext());\n    }\n\n    public int getCount() {\n        return data.size();\n    }\n\n    public Object getItem(int position) {\n        return position;\n    }\n\n    public long getItemId(int position) {\n        return position;\n    }\n\n    public View getView(int position, View convertView, ViewGroup parent) {\n        View vi=convertView;\n        if(convertView==null)\n            vi = inflater.inflate(R.layout.list_row, null);\n\n        TextView name = (TextView)vi.findViewById(R.id.name); \/\/ title\n        TextView message = (TextView)vi.findViewById(R.id.message); \/\/ artist name\n        TextView created = (TextView)vi.findViewById(R.id.created); \/\/ duration\n        SmartImageView thumb_image = (SmartImageView) vi.findViewById(R.id.list_image);\n\n\n\n        HashMap update = new HashMap();\n        update = data.get(position); \n\n        \/\/ Setting all values in listview\n        name.setText(update.get(\"name\"));\n        message.setText(update.get(\"message\"));\n        created.setText(update.get(\"created\"));\n        thumb_image.setImageUrl(update.get(\"thumb_img\"));\n        name.setOnClickListener(new myOnClickListener(position));\n        thumb_image.setOnClickListener(new myOnClickListener(position));\n        return vi;\n    }\n\n    public class myOnClickListener implements OnClickListener{\n        private int position;\n        private String clicked_uid;\n        public myOnClickListener(int position){\n            this.position=position;\n        }\n        @Override\n        public void onClick(View v) {\n            \/\/ TODO Auto-generated method stub\n\n\n            HashMap update = new HashMap();\n            update = data.get(position); \n            Log.i(\"Update Position:\", update.toString());\n            clicked_uid=update.get(\"uid\");\n            Log.d(\"Clicked UID:\", clicked_uid+\"\");\n            Intent i = new Intent(activity.getApplicationContext() , TabHostFragmentActivity.class);\n            i.putExtra(\"profile_uid\", clicked_uid);\n            activity.startActivity(i);\n            activity.finish();\n\n        }\n\n    }\n}\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-26 18:03:25. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>My app runs fine besides when the user stops using their phone long enough for the screen to lock, when they unlock it the app crashes and im a bit clueless as to why. Here is the error: here is the lazy adapter: package com.buhz.helpers; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.content.Context; import android.content.Intent; [&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-1520","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1520","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=1520"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1520\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}