Sunday 15 January 2012

java - how to write code for onitemClickListener for customized listview using BaseAdapter? -


This code is fine for custom list view using BaseAdapter in Android:

  Public Class Customlist Adapter Bidder {Private array list & lt; Task Class & gt; _listData; Reference _c; Public Castlist Adapter (Reference Reference, Arrayist & Jobs; Task Class & gt; List Data) {_listData = listData; _c = context; } @ Override Public Inaccount () {Return _listData.size (); } @OverWide Public Object Found Itam (Int Position) {Return _ListadataGate (Status); } @ Override Public Long ITMID (Status of Intake) {Return Status; } View public viewView (int position, seeviewview, ViewGroup parents) {View V = Convertview; If (v == empty) {layout influent layout = emulator = (layout influent) _ seaget system service (reference. LAOUT_INFLATER_SERVICE); V = layoutInflator.inflate (R.layout.listview_row, tap); } Text view title text = (text view) v.findViewById (R.id.holdTitleText); Text view catech = (text view) v.findViewById (R.id.holdCatText); TextView descText = (TextView) v.findViewById (R.id.holdDescText); TextView dataText = (text view) v.findViewById (R.id.holdDateText); // check box checkbox foriItim = (checkbox) v.findViewById (RID.) Task Class taskclassInstance = _listData.get (status); TitleText.setText (taskClassInstance.getTitle ()); CatText.setText (taskClassInstance.getTaskCategory ()); DescText.setText (taskClassInstance.getDescription ()); DateText.setText (taskClassInstance.getTaskDate ()); Return vi; }}   

and in the meeting I see the meeting binding list view with custom adapters:

  listViewInstance.setAdapter (new customlist adder (getApplicationContext (), taskClasslistInstance) ;   

Where "Task Classelstein" is my array, to properly coordinate the data of DB's work. Now I have to write a function for listidum so that when the user clicks on any list, then < Strong> rowid databases from that strongest of recordlist records. After receiving the rowwalk, I can delete the records from the list view and DB and edit the information

< P> OK, we do not know about your task class , but I hope you want something like this:
  listViewInstance .setOnItemClickListener (New OnItemClickListener () {@Override public void onItemClick (adapterview & lt ;? & gt; parent, view view, integer, long ID) {TaskClass taskClass = taskclasslistInstance.get (pos ); Log.d (Tag, "clicked on:" + Task Class) // dot stop for task class}});    

No comments:

Post a Comment