Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:44:27+00:00 2026-05-26T05:44:27+00:00

I am currently working on an app which will take screenshot and then email

  • 0

I am currently working on an app which will take screenshot and then email them as an attachment. I want a screenshot of the following “LinearLayout”…

However, something very weird is happening when this function is called. Instead of taking a screenshot of the whole layout, just about 1/10th of the screenshot is taken (like just the half of the first column). Can anyone please suggest what is wrong with the code here?

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tableview"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:weightSum="1" 
    android:orientation="vertical" >

 <TableLayout android:padding="5dp" 
        android:layout_width="match_parent" 
        android:id="@+id/TransactionLog"    
        android:layout_height="wrap_content">

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Date" 
                      android:layout_width="0dip" 
                      android:id="@+id/dateLabel" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Details" 
                      android:layout_width="0dip" 
                      android:id="@+id/detailsLabel" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Debit" 
                      android:layout_width="0dip" 
                      android:id="@+id/debitLabel" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Credit" 
                      android:layout_width="0dip" 
                      android:id="@+id/creditLabel" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Balance" 
                      android:layout_width="0dip" 
                      android:id="@+id/balanceLabel" /> 
        </TableRow>

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="5 October 2011" 
                      android:layout_width="0dip" 
                      android:id="@+id/date1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="CoCoa Shop" 
                      android:layout_width="0dip" 
                      android:id="@+id/details1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="123.53" 
                      android:layout_width="0dip" 
                      android:id="@+id/debit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="0.00" 
                      android:layout_width="0dip" 
                      android:id="@+id/credit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="6729.32" 
                      android:layout_width="0dip" 
                      android:id="@+id/balance1" /> 
        </TableRow>

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="4 October 2011" 
                      android:layout_width="0dip" 
                      android:id="@+id/date1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Best Sell" 
                      android:layout_width="0dip" 
                      android:id="@+id/details1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="900.53" 
                      android:layout_width="0dip" 
                      android:id="@+id/debit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="0.00" 
                      android:layout_width="0dip" 
                      android:id="@+id/credit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="6729.32" 
                      android:layout_width="0dip" 
                      android:id="@+id/balance1" /> 
        </TableRow>

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="4 October 2011" 
                      android:layout_width="0dip" 
                      android:id="@+id/date1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="Deposit" 
                      android:layout_width="0dip" 
                      android:id="@+id/details1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="0.00" 
                      android:layout_width="0dip" 
                      android:id="@+id/debit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="9500.00" 
                      android:layout_width="0dip" 
                      android:id="@+id/credit1" /> 
            <TextView android:layout_margin="4dip" 
                      android:layout_weight="1" 
                      android:padding="10dip" 
                      android:layout_height="wrap_content" 
                      android:text="6729.32" 
                      android:layout_width="0dip" 
                      android:id="@+id/balance1" /> 
        </TableRow>

</TableLayout>

 </LinearLayout>

And here is the JAVA function which is supposed to take the screenshot and save it to a file called “log” in the SD Card.

        private void getScreen()
        {
            View content = findViewById(R.id.tableview);
            content.setDrawingCacheEnabled(true);

            content.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
                    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));

            content.layout(0, 0, content.getMeasuredWidth(), content.getMeasuredHeight()); 

            content.buildDrawingCache(true);

            Bitmap bitmap = Bitmap.createBitmap(content.getDrawingCache());
            content.setDrawingCacheEnabled(false); // clear drawing cache

            File file = new File( Environment.getExternalStorageDirectory() + "/log.png");

            try 
            {
                file.createNewFile();
                FileOutputStream ostream = new FileOutputStream(file);
                bitmap.compress(CompressFormat.PNG, 100, ostream);
                ostream.close();

            } 
            catch (Exception e) 
            {
                e.printStackTrace();
            }

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:44:28+00:00Added an answer on May 26, 2026 at 5:44 am

    remove these line an try again,

    content.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); 
    content.layout(0, 0, content.getMeasuredWidth(), content.getMeasuredHeight()); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a app for a podcast (katg.com) which will let you
I am currently working on an app in which I want to store a
I am currently working on an iPhone app which uses CoreData to save some
I'm currently working on a reasonably simple MVC app which allows the user to
An app I'm currently working on uses Entity Framework 4 which connects to a
I'm currently working on an app for a customer of mine and it will
I am working on an app which I want to register in the Share
Currently I'm writing an app for OSX which will eventually need to be ported
In an app on which I'm currently working, I just replaced db4o with RavenDB.
Currently working on a pretty basic hosted PHP app which I'm in the process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.