android - listfragment on click into custom list in another fragment -
when click on listfragment particular data data has shown in custom listview in second fragment.means clicked item has add in second fragment. list view not appearing..
public class myplayerfrag extends fragment { context context; customdetailadapter adapter; listview list; layoutinflater minflater; arraylist<string> title =new arraylist<string>(); arraylist<string> description =new arraylist<string>(); @override public void onattach(activity activity) { // todo auto-generated method stub super.onattach(activity); } public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view v = inflater.inflate(r.layout.detail, container,false); list = (listview)v.findviewbyid(r.id.listview); return v; } public void detaildata(context applicationcontext,arraylist<string> data1,arraylist<string> data2){ this.title =data1; this.description=data2; customdetailadapter adapter =new customdetailadapter(context, title, description); list.setadapter(adapter); here getting output in log system.out.println(" title::"+ title); as[keyboard1,keyboard2] } } public class customdetailadapter extends baseadapter { context context ; arraylist<string> items= null; arraylist<string> items1= null; public customdetailadapter(context context,arraylist<string> items, arraylist<string> items1) { this.context =context; // todo auto-generated constructor stub this.items = items; this.items1 = items1; } /*private view holder class*/ private class viewholder { textview txttitle; textview txtdesc; } public view getview(final int position, view convertview, viewgroup parent) { // todo auto-generated method stub viewholder holder = null; system.out.println("am in getview"); minflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); if (convertview == null) { convertview = minflater.inflate(r.layout.player, null); holder = new viewholder(); holder.txttitle = (textview) convertview.findviewbyid(r.id.title); holder.txtdesc = (textview) convertview.findviewbyid(r.id.desc); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } holder.txttitle.settext(items1.get(position)); holder.txtdesc.settext(items.get(position)); return convertview; } @override public object getitem(int position) { return items; } @override public int getcount() { // todo auto-generated method stub return 0; } @override public long getitemid(int arg0) { // todo auto-generated method stub return 0; } }
Comments
Post a Comment