Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I do editable listview item?
    primarykey
    data
    text
    <p>I have todolist application which includes task,priority,date,status and ı can add new item to list.When click the item another activity run.Here is the problem,ı cant get item's values for new activity and when i click edit button, program add new item without deleting old one. </p> <p>here setOnItemClickListener</p> <pre><code>todoListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent editIntent = new Intent(MainActivity.this, EditItem.class); startActivityForResult(editIntent, EDIT_NOTE); } }); </code></pre> <p>and OnActivityResult</p> <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case ADD_NOTE: String extraName = AddItem.code; ArrayList&lt;String&gt; list = data .getStringArrayListExtra(extraName); todoItems.addAll(list); todoArrayAdapter.notifyDataSetChanged(); break; case EDIT_NOTE: String extraName2 = EditItem.code; ArrayList&lt;String&gt; list2 = data .getStringArrayListExtra(extraName2); todoItems.addAll(list2); todoArrayAdapter.notifyDataSetChanged(); break; default: break; } } super.onActivityResult(requestCode, resultCode, data); } </code></pre> <p>and EditItem.java</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.edit_item); editText1 = (EditText) findViewById(R.id.editText1); spinner = (Spinner) findViewById(R.id.prioritySpinner); datePicker = (DatePicker) findViewById(R.id.datePicker); toggleButton = (ToggleButton) findViewById(R.id.statusbutton); editButton = (Button) findViewById(R.id.editButton); cancelButton = (Button) findViewById(R.id.cancelButton); editButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { itemList = new ArrayList&lt;String&gt;(); item = editText1.getText().toString(); priorityLevel = spinner.getSelectedItem().toString(); status = toggleButton.getText().toString(); int day = datePicker.getDayOfMonth(); int month = datePicker.getMonth() + 1; int year = datePicker.getYear(); date = day + "/" + month + "/" + year; itemList.add(new Entry(item, priorityLevel, date, status) .toString()); Intent okIntent = new Intent(); okIntent.putExtra(code, itemList); setResult(Activity.RESULT_OK, okIntent); finish(); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload