{"action":"closed","issue":{"url":"https://api.github.com/repos/nhaarman/ListViewAnimations/issues/323","labels_url":"https://api.github.com/repos/nhaarman/ListViewAnimations/issues/323/labels{/name}","comments_url":"https://api.github.com/repos/nhaarman/ListViewAnimations/issues/323/comments","events_url":"https://api.github.com/repos/nhaarman/ListViewAnimations/issues/323/events","html_url":"https://github.com/nhaarman/ListViewAnimations/issues/323","id":54533920,"number":323,"title":"Using custom adapter dynamic listview giving me a null pointer exception","user":{"login":"dubrechi","id":7959638,"avatar_url":"https://avatars.githubusercontent.com/u/7959638?v=3","gravatar_id":"","url":"https://api.github.com/users/dubrechi","html_url":"https://github.com/dubrechi","followers_url":"https://api.github.com/users/dubrechi/followers","following_url":"https://api.github.com/users/dubrechi/following{/other_user}","gists_url":"https://api.github.com/users/dubrechi/gists{/gist_id}","starred_url":"https://api.github.com/users/dubrechi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dubrechi/subscriptions","organizations_url":"https://api.github.com/users/dubrechi/orgs","repos_url":"https://api.github.com/users/dubrechi/repos","events_url":"https://api.github.com/users/dubrechi/events{/privacy}","received_events_url":"https://api.github.com/users/dubrechi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-16T02:45:51Z","updated_at":"2015-03-17T21:28:56Z","closed_at":"2015-03-17T21:28:56Z","body":"Hi nhaarman\r\n\r\nFirst of all, thank you for this wonderful library! im a noob in programming and im trying to figure out what's wrong with my implementation, im trying to use the dyamiclistview but when everytime i try to drag and move the component, my application stop, \r\n\r\ni hope you can help me, thanks in advance.\r\n\r\nhere is my code: \r\n\r\n\r\npackage com.example.dynamiclistviewusingbaseadapter;\r\n\r\nimport com.nhaarman.listviewanimations.appearance.simple.AlphaInAnimationAdapter;\r\nimport com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;\r\nimport com.nhaarman.listviewanimations.itemmanipulation.dragdrop.TouchViewDraggableManager;\r\nimport com.nhaarman.listviewanimations.util.Swappable;\r\n\r\nimport android.support.annotation.NonNull;\r\nimport android.support.v7.app.ActionBarActivity;\r\nimport android.os.Bundle;\r\nimport android.view.LayoutInflater;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.AdapterView;\r\nimport android.widget.AdapterView.OnItemLongClickListener;\r\nimport android.widget.BaseAdapter;\r\nimport android.widget.ImageView;\r\nimport android.widget.ListView;\r\nimport android.widget.TextView;\r\n\r\n\r\npublic class MainActivity extends ActionBarActivity {\r\n\r\n\t   DynamicListView l1;\r\n\t    String[] t1={\"video1\",\"video2\"};\r\n\t    String[] d1={\"lesson1\",\"lesson2\"};\r\n\t    int[] i1 ={R.drawable.ic_launcher,R.drawable.ic_launcher};\r\n\r\n\r\n\t    @Override\r\n\t    protected void onCreate(Bundle savedInstanceState) {\r\n\t        super.onCreate(savedInstanceState);\r\n\t        setContentView(R.layout.activity_main);\r\n\t        l1=(DynamicListView)findViewById(R.id.dynamiclistview);\r\n\t        \r\n\t        AlphaInAnimationAdapter animatorAdapter = new AlphaInAnimationAdapter(new dataListAdapter(t1,d1,i1));\r\n\t        animatorAdapter.setAbsListView(l1);\r\n\t        l1.setAdapter(animatorAdapter);\r\n\t        l1.enableDragAndDrop();\r\n\t        l1.setDraggableManager(new TouchViewDraggableManager(R.layout.custom));\r\n\t        l1.setOnItemLongClickListener(new OnItemLongClickListener() {\r\n\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic boolean onItemLongClick(AdapterView<?> parent,\r\n\t\t\t\t\t\tView view, int position, long id) {\r\n\t\t            if (l1 != null) {\r\n\t\t            \tl1.startDragging(position - l1.getHeaderViewsCount());\r\n\t\t            }\r\n\t\t            return true;\r\n//\t\t\t\t\tl1.startDragging(position);\r\n//\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t        \r\n\t    }\r\n\r\n\t    class dataListAdapter extends BaseAdapter implements Swappable {\r\n\t        String[] Title, Detail;\r\n\t        int[] imge;\r\n\r\n\t        dataListAdapter() {\r\n\t            Title = null;\r\n\t            Detail = null;\r\n\t            imge=null;\r\n\t        }\r\n\r\n\t        public dataListAdapter(String[] text, String[] text1,int[] text3) {\r\n\t            Title = text;\r\n\t            Detail = text1;\r\n\t            imge = text3;\r\n\r\n\t        }\r\n\r\n\t        public int getCount() {\r\n\t            return Title.length;\r\n\t        }\r\n\r\n\t        public Object getItem(int arg0) {\r\n\t            return null;\r\n\t        }\r\n\t        \r\n\t        @Override\r\n\t        public boolean hasStableIds() {\r\n\t        \treturn true;\r\n\t        }\r\n\r\n\t        public long getItemId(int position) {\r\n\t            return position;\r\n\t        }\r\n\r\n\t        public View getView(int position, View convertView, ViewGroup parent) {\r\n\r\n\t            LayoutInflater inflater = getLayoutInflater();\r\n\t            View row;\r\n\t            row = inflater.inflate(R.layout.custom, parent, false);\r\n\t            TextView title, detail;\r\n\t            ImageView i1;\r\n\t            title = (TextView) row.findViewById(R.id.title);\r\n\t            detail = (TextView) row.findViewById(R.id.detail);\r\n\t            i1=(ImageView)row.findViewById(R.id.img);\r\n\t            title.setText(Title[position]);\r\n\t            detail.setText(Detail[position]);\r\n\t            i1.setImageResource(imge[position]);\r\n\r\n\t            return (row);\r\n\t        }\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void swapItems(int arg0, int arg1) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\t\r\n\t\t\t}\r\n\t    }\r\n}\r\n"}}