I have a FrameLayout consisting of several kinds of images and one EditText. I save this layout as an image in memory (external). The first time I set images in images, everything is going well, i.e. the exact image is saved (the same as the display on the screen), but when after saving the first time, if I change any thing (text, image), it is displayed correctly on the screen, but the image is saved displays the previous image (first image )
Layout XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <FrameLayout android:id="@+id/imageWithoutFrame" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_centerInParent="true" > <ImageView android:id="@+id/withoutFrame_background" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/background" /> <ImageView android:id="@+id/withoutFrame_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:adjustViewBounds="true" android:layout_gravity="center" /> <EditText android:id="@+id/withoutFrame_editableText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:layout_marginBottom="30dip" android:hint="Write here" android:maxLength="60" /> </FrameLayout> </RelativeLayout>
Code that modifies it in a bitmap:
Bitmap bm = null; FrameLayout savedImage = null; savedImage = (FrameLayout)findViewById(R.id.imageWithoutFrame); savedImage.setDrawingCacheEnabled(true); savedImage.buildDrawingCache(); bm = savedImage.getDrawingCache();
I used this bm to save.
Thanks for the help.
source share