I have two activities and a database. I want to send the data from the first activity to the data base and then move to the next activity. I know this is wrong but it is the best I could find online, any other ways of doing it?
OnItemClickListener viewNeeds = new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
//create variable for database input
feelingForDb = ((AdapterView<ListAdapter>) feelingsList).getSelectedItem().toString();
Intent gotoNeeds=
new Intent(FeelingsMain.this, Needs.class);
startActivity(gotoNeeds);
}
feelingForDbfrom DB? If yes, then you can simply pass this string as part ofgotoNeedsintent. UsegotoNeeds.putExtra("some_identifier_name", feelingForDb);and in theNeedsclass you will need to retrieve it usinggetIntent().getStringExtra("some_identifier_name");