android - Modifying element of a listView how to get access to it -
I have found that in order to modify the row in a list, I need to know as adapter.getItem (status ) But I do not know how to work around this, should I post any code, please tell me here is my EditListItemDialog file:
package com.example.classorganizer ; Import java.util.ArrayList; Import java.util.list; Import com.example.classorganizer.Monday.DiaryAdapter; Import android.app.Dialog; Import android.content.Context; Importroid.os.Bundle; Import android.view.View; Import android.widget.TextView; Class EditList itemImdimOog Expands the dialog View.OnClickListener {see private editText; Personal Diary Adapter Adapter; // Public Adultistime Dialogue (reference reference, list & lt; string & gt; piece_mandie) {// first constructor // super (reference); // this.fragment_monday = fragment_monday; //} @ Override Protected Zero to Create (Intstance saved from bundle) {Super. Secret (Saved Instantstate); SetContentView (R.layout.edit_text_dialog); // See your XML with EditText and the 'OK' and 'Cancel' button here btnOk = findViewById (R.id.button_ok); EditText = findViewById (RID.edit_text); BtnOk.setOnClickListener (this); } Private listing & lt; String & gt; fragment_monday; Public EditListItemDialog (Reference Reference, Diary Adapter Adapter) {Super (Reference); This.fragment_monday = New ArrayList & lt; String & gt; (); This.adapter = adapter; } @ Override Public Wide Onclick OnClick (see V) {fragment_monday.add ((TextView) v) .getText (). ToString ()); // Here are your updated (or not updated) text adapter. NotifyDataSetChanged (); Rejected (); }}
You must apply an OnItemClickListener that will tell you whether the item was clicked For example:
public void onItemClick (adapterview See official Android for more information.
Comments
Post a Comment