-1

How do I pass an exactly looking RelativeLayout from one activity to another. The result shoul look something like this: Example

To explain:

I have a GridView which is populated from database using SimpleCursorAdapter and a partial layout. Partial layout looks something like this:

<RelativeLayout>    
    <TextView/>
    <TextView/>
    <Button/>
    <Button/>    
</RelativeLayout>

When user clicks on a details button of an item, I woud like to pass that item's RelativeLayout to the DetailsActivity.

As I understand it cloning is not posible and inflating is not an option.

I coud pass every id, tag and text value and recreate a layout but I'm hopinbg there's an easier way.

T. J.
  • 3
  • 2
  • add that layout to top of 2nd activity .you don't need to pass anything.after all it's the details activity so it will have those values. – Adithya Jul 06 '17 at 13:40

1 Answers1

0

You can't pass a layout.

What you can do is

  • use the same layout resource (defined in xml) in both the places.
  • pass the data to be used in layout from one screen to other.
Yash
  • 5,225
  • 4
  • 32
  • 65