passing object through intent android code example

Example 1: pass list to intent in android java

Intent intent = new Intent(getApplicationContext(),YourActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable("data", sharedBookingObject);
intent.putExtras(bundle);
startActivity(intent);

Example 2: android pass object to activity

Intent intent = new Intent(fromClass.this,toClass.class).putExtra("myCustomerObj",customerObj);

Example 3: android pass object to activity

Customer customerObjInToClass = getIntent().getExtras().getParcelable("myCustomerObj");

Tags:

Java Example