java - Android Custom Array Adapter to read CSV files -
I am a newbie for Android application development. I am currently working on a project that relates to the import of CSV files, which includes only one column and several lines, on my Android project. I served all CSV data where I can read on your project and I did not use any string Arejh only used csvadapter array adapters now list view using the CSV adapter and array adapter to CSV files, I have a concern where an item was clicked in the list, I wanted to toast the item. I tried to exclude all possible combinations but it shows me only a toast string @ somerandomvalue, request someone to help me on this Thanks in advance.
The following is my csvadapter class. The .csv files remain in the property.
Public class CSVAdapter extends ArrayAdapter & LT; Clock & gt; {Reference ctx; Public CSVAdapter (Reference Reference, Int TextVRSOSIDID) {Super (Reference, Text Visualization IDID); This.ctx = reference; LoadArrayFromFile (); } @ Override public view getView (last integer, see see convertview view, last ViewGroup parent) {TextView mView = (TextView) ConvertView; If (null == mView) {mView = new textview (parent.getContext ()); MView.setTextSize (28); } MView.setText (getItem (pos) .getTime ()); Return mView; }
And it is to read the .csv array in my class GUI
public class mrvtoparanur activity extends {CSVAdapter mAdapter; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.mrvtoparanur); Final list view mList = (list view) FindById (R.id.mrvtoparanurlist); MAdapter = new CSV adapter (this, -1); MList.setAdapter (mAdapter); mList.setOnItemClickListener (New OnItemClickListener () {@Override public void onItemClick (AdapterView & LT ;? & gt; arg0, see ARG1, ARG2 integer, long arg3) {Toast.makeText (getApplicationContext (), "your selected item number" + ARG2, toast .LENGTH_SHORT) .show ();}}); }
Make a request to help the toast in the second class Java file. In the Msg, the arg2 item id returns "Item number you selected." In the same way, I want to display or to itemize the item name instead of the item id. Pls help me someone
This is the clock.java file ... please see below.
public class clock {Private string t; Public string matching-time () {return t; } Public Zero Settime (String T) {this.t = t; Use the data from the adapter:
(Then I do not know the structure of the clock
object)
Comments
Post a Comment