I'm having trouble figuring out how to pass information through an Activity switch.
I currently have an Activity where I can add a client to the database, and I have an Activity to view all clients in a ListView.
What I want is that when the user clicks on a client in the ListView for it to go back to the addclient Activity, with all the fields filled in from the database.
here is the Activity where the user views the clients
public class ViewClientActivity extends Activity
{
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.viewclient_activity);
DBHandler handler = new DBHandler(this, null, null, 1);
SQLiteDatabase db = handler.getWritableDatabase();
final Cursor ClientCursor = db.rawQuery("SELECT * FROM clients", null);
ListView allClients = (ListView) findViewById(R.id.allClients);
final ClientCursorAdapter clientAdapter = new ClientCursorAdapter(this, ClientCursor);
allClients.setAdapter(clientAdapter);
allClients.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Intent AddClientActivity = new Intent(getApplicationContext(), AddClientActivity.class);
startActivity(AddClientActivity);
}
});
}
}