jeudi 26 mars 2015

ListView to New Activity then Populate EditText's with SQLite data from Hashmap

I currently have a ListView populated by SQLite and I have implemented an OnItemClickListener to list items. I want to know how to retrieve values from a Hashmap specific to the item the user clicks in the ListView, then open a new activity and populate the retrieved data into EditTexts. Any help would be appreciated!


EDIT


This is what i'm guessing:



public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// TODO Auto-generated method stub
ArrayList<HashMap<String, String>> scanList = this.controller.getAllRecs();
Intent intent = new Intent (parent.getContext(), Record.class);
intent.putExtra("key", scanList);
}


Then in my next activity in the onCreate have the following:



String value = getIntent().getExtras().getString("key");
ET1.setText(value);

Aucun commentaire:

Enregistrer un commentaire