I have xml file and that create view and i pass that screen shot in next activity.and also there are image with main layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:id="@+id/mainLayout"
android:layout_height="match_parent">
<ImageView android:layout_height="wrap_content" android:id="@+id/imageSelected"
android:src="@drawable/icon" android:layout_width="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="79dp"></ImageView>
<RelativeLayout android:layout_width="fill_parent"
android:id="@+id/relativelayoutfinal" android:layout_height="fill_parent">
</RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayoutbutton"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/bottombutton" />
</RelativeLayout>
<Button android:layout_width="wrap_content" android:background="@drawable/b_brightness_contrast"
android:id="@+id/btnbrightcont" android:layout_height="wrap_content"
android:layout_marginBottom="40dip" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_marginRight="103dp"></Button>
<Button android:background="@drawable/b_adjust_and_scale"
android:layout_width="wrap_content" android:id="@+id/btnadjustscale"
android:layout_above="@+id/btnbrightcont" android:layout_alignLeft="@+id/btnbrightcont"
android:layout_height="wrap_content"></Button>
<SeekBar android:layout_height="wrap_content" android:progress="50"
android:layout_marginTop="50dip" android:layout_marginRight="30dip"
android:layout_width="160dip" android:id="@+id/sbbrightness"
android:visibility="gone" android:layout_alignParentTop="true"
android:layout_alignParentRight="true"></SeekBar>
<SeekBar android:layout_height="wrap_content" android:progress="50"
android:visibility="gone" android:layout_width="160dip" android:id="@+id/sbcontrast"
android:layout_below="@+id/sbbrightness" android:layout_alignLeft="@+id/sbbrightness"></SeekBar>
</RelativeLayout>
and just send image as drawable or bitmap to next activity...Its Possible??
As far as I understand, that you want screen shot of your relativelayout xml :
For this you can use:
View v = yourrelativelayout.getRootView();
v.setDrawingCacheEnabled(true);
Bitmap bitmap = v.getDrawingCache();
BitmapDrawable drawable=new BitmapDrawable(bitmap);
You can use this BitmapDrawable as Drawable and can pass to the next activity.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With