---
title: "How to Pass object to another activity in android?"  
description: "How to Pass object to another activity in android?"  
author: "Allen Scott"  
published: 2014-11-19  
updated: 2014-11-19  
canonical: https://www.mindstick.com/forum/12637/how-to-pass-object-to-another-activity-in-android  
category: "android"  
tags: ["java", "oops"]  
reading_time: 1 minute  

---

# How to Pass object to another activity in android?

I have found this way to do this

```
Student student = new Student (18,"Zar E Ahmer");Intent i = new Intent(this, B.class);i.putExtra("studentObject", student);startActivity(i);
```

The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that if the object changed in the first [activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore) No change [took place](https://answers.mindstick.com/qa/36919/which-is-the-unheard-indian-battle-that-took-place-in-history) in the another activity. I thought how to make it like a constructor that no [copy](https://www.mindstick.com/forum/161993/explain-the-numpy-array-copy-vs-view-with-example) of the object is pass but the object it self.

## Replies

### Reply by Anonymous User

One option could be letting your custom class implement Serializable interface and then you can pass object instances in intent extra using putExtra(Serializable..) variant of the Intent#putExtra() method.

**PSEUDO code:**

```
//to pass :  intent.putExtra("MyClass", obj);  // to retrieve object in second ActivitygetIntent().getSerializableExtra("MyClass");
```


---

Original Source: https://www.mindstick.com/forum/12637/how-to-pass-object-to-another-activity-in-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
