Saturday, 7 September 2013

Trying to access my parcelable object sent from one activity to another

Trying to access my parcelable object sent from one activity to another

This is my onitemclick which I use for when I want to start the new
activity (Called DynamicEvents), and at this point I want to send my
object of type Clubs that comes from db.get(map.get(position));
I now want to be able to access the object that I have sent across in my
DynamicEvents Class
This is my onItemClick method from my ListSample Class
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long
arg3) {
Clubs mymeeting = db.get(map.get(position));
Intent i = new Intent();
Bundle b = new Bundle();
b.putParcelable("my meeting", mymeeting);
i.putExtras(b);
i.setClass(ListSample.this, DynamicEvents.class);
startActivity(i);
}
});
and at the moment I have no code in my DynamicEvents class, I have tried a
few things, however most seem a bit too long winded and use .getIntent
which eclipse wants me to write my own method for?
For my DynamicEvents class what should I be implmenting? Any sample code
of being able to access the object or any help would be appreciated.
Thanks
Thought I would add this, this is an example of the code I have tried. and
as i said it uses .getIntent
Bundle b = this.getIntent().getExtras();
if(b!=null)
meeting = b.getParcelable("my meeting");

No comments:

Post a Comment