Make a screenshot code support multiple screen sizes
<p>I have a class where i take the screenshot of the layout and store it as a JPEG file....the problem i am having is the image size varies with the screen resolution.... for eg. if i use medium resolution phones the image size is around 50-60kb but for high resolution it goes upto 1.5mbs....so is there any way i can keep the image size constant independent of screen size or resolution???</p>

<pre><code>public class abc extends Activity {
    View content;
    String fileName, fname;
    static File file;
    static String RECE;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.rece);
        ImageView iv = (ImageView) findViewById(R.id.Ivsignature);
        iv.setImageBitmap(Signature.sign);
        Initialize();

        content = findViewById(R.id.Rlrece);
        ViewTreeObserver vto = content.getViewTreeObserver();
        vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @SuppressWarnings("deprecation")
            public void onGlobalLayout() {
                content.getViewTreeObserver()
                        .removeGlobalOnLayoutListener(this);
                getScreen();
            }
        });

    }

    private void getScreen() {
        View view = content;
        View v = view.getRootView();
        v.setDrawingCacheEnabled(true);
        Bitmap b = v.getDrawingCache();

        String myPath = Environment.getExternalStorageDirectory() + "/Rece";
        File myDir = new File(myPath);
        try {
            myDir.mkdirs();
        } catch (Exception e) {
        }

        fname = fileName + ".jpg";
        file = new File(myDir, fname);
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(file);
            b.compress(CompressFormat.JPEG, 100, fos);
            // Toast.makeText(getApplicationContext(), fname + "  saved",
            // Toast.LENGTH_LONG).show();
            Intent my = new Intent(getApplicationContext(),
                    DialogActivity.class);
            my.putExtra("Rsystrace", DialogActivity.Systrace);
            startActivityForResult(my, 1);
        } catch (Throwable ex) {
            Toast.makeText(getApplicationContext(),
                    "error: " + ex.getMessage(), Toast.LENGTH_LONG).show();

        }
    }
</code></pre>
