Skip to main content

Posts

Showing posts from August, 2012

Simple and sort Listview example (Android)

private View getChapterLayout() { ListView listView = new ListView(this); listView.setAdapter(new BaseAdapter() { public int getCount() { return chapterdata.size(); } public Object getItem(int position) { return chapterdata.get(position); } public long getItemId(int addressList) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.button_chapter, null); TextView textview = (TextView) convertView .findViewById(R.id.button); textview.setText(chapterdata.get(position).getName()); return convertView; } }); return listView; } // chapterdata is an arrayList // Add Event to each Row  listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClic...