dimanche 15 mars 2015

Android, How do i Update the selected item in my listview from my database?


Heres my code so far but the application crash when i press the update button can anyone help me im just new to android.


I want to update a selected item in my list i have already created the update activity that will allow me to load the values on my database but i cant figure out how to load the value of selected item in list.


{



ArrayAdapter<String> ard=new ArrayAdapter<String> (this,android.R.layout.simple_list_item_single_choice,list);
lv.setAdapter(ard);
lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

btnupdate.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

SparseBooleanArray sba = lv.getCheckedItemPositions();
Intent intent = new Intent(HomeworkInfo.this, UpdateHomework.class);
startActivity(intent);
finish();

}



});


}


Aucun commentaire:

Enregistrer un commentaire