1

I want make JPG image of my one cardview and want share it on select overflow menu. My XML file is like below, How can I make screenshot of one view called @quoteCard and share it ? and I want just one view of my layout not want full screen screenshot. Thanks

<LinearLayout
        android:id="@+id/cardBackground"
        android:padding="8dp"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_marginTop="32dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/authorImage"
            android:layout_width="128dp"
            android:layout_height="128dp"
            app:civ_border_width="2dp"
            app:civ_border_color="#99333333"/>


        <TextView
            android:layout_weight="1"
            android:gravity="center"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:id="@+id/textDetailQuote"
            android:text="The price of success is hard"
            android:textSize="20sp"
            android:textStyle="bold"
            android:lineSpacingExtra="5dp"              
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />


        <TextView
            android:layout_marginBottom="16dp"
            android:layout_marginRight="8dp"
            android:id="@+id/textAuthorSign"
            android:layout_gravity="right"
            android:text="- ABJ Abdul Kalam"
            android:textStyle="italic"
            android:textSize="16sp"
            android:typeface="serif"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />



    </LinearLayout>
Rajubhai Rathod
  • 501
  • 2
  • 5
  • 14

1 Answers1

0

you can try this for take particular layout screen shot

   LinearLayout mLinearLayout= (LinearLayout) findViewById(R.id.linearlayout);
            mLinearLayout.setDrawingCacheEnabled(true);
            Bitmap mBitmap = Bitmap.createBitmap(mainLayout.getDrawingCache());
            mLinearLayout.setDrawingCacheEnabled(false);

Using above you can convert layout to bitmap.

Sachin
  • 1,307
  • 13
  • 23