0

Is there a way to pass a RelativeLayout through intent to the next Activity? I am having this error:

android.widget.RelativeLayout cannot be cast to java.io.Serializable

by using this:

getIntent().putExtra("Layout", (Serializable) layout);

Thanks.

Linh
  • 57,942
  • 23
  • 262
  • 279
Handsum
  • 15
  • 1
  • 7
  • 3
    why do you want to pass `RelativeLayout ` via Intent? – Linh Oct 18 '16 at 03:14
  • I have a relativeLayout in another activity with sufaceViews inside it. When I click on the relativeLayout, I want to duplicate the relativeLayout to the next Activity – Handsum Oct 18 '16 at 03:42

2 Answers2

1

I just found out that there are other ways to pass data between activities here: What's the best way to share data between activities?

..and I used a singleton class to solve my problem.

Community
  • 1
  • 1
Handsum
  • 15
  • 1
  • 7
0

Your activity 's Relative layout bind itself, you cannot using it in other activity. Using Dynamic layout instead, click -> go to other activity -> generate your layout programmatically. Here is some search result.

PLe
  • 137
  • 4