I have the following xml activity structure of my application. Now I would like to remove the child RelativeLayout programmatically with id layer1Front. How do I do this in code. I do not want to hide it, I need to remove it due to memory problems in my application. Also, after deleting it somehow my application will be easier and faster than the current one?
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/layer1Front" > </RelativeLayout> <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> <FrameLayout android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/parallaxLayers" android:visibility="gone"> </FrameLayout> </HorizontalScrollView> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/frontView"> </RelativeLayout> </RelativeLayout>
source share