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 8362393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:55:46+00:00 2026-06-09T11:55:46+00:00

I tried to post an image on Facebook wall from my android application.For this

  • 0

I tried to post an image on Facebook wall from my android application.For this I created a bitmap from layout.Here is my code

                    System.gc();
            Bitmap bitmap = Bitmap.createBitmap(
                    view.getMeasuredWidth(),
                    view.getMeasuredHeight(),
                    Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(bitmap);
            Drawable bgDrawable = newLinearLayout.getBackground();
            if (bgDrawable != null)
                bgDrawable.draw(canvas);
            else
                canvas.drawColor(Color.WHITE);
            view.draw(canvas);
            Matrix matrix = new Matrix();
            // resize the bit map
            matrix.postScale(1.0f, 1.0f);

            // recreate the new Bitmap
            Bitmap resizedBitmap = null;
            resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0,
                    bitmap.getWidth(), bitmap.getHeight(), matrix, true);
            //Canvas resizedCanvas = new Canvas(resizedBitmap);

            if (bitmap != null) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                resizedBitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
                Bundle parameters = new Bundle();
                byte[] data = baos.toByteArray();
                parameters.putByteArray("picture", data);
                DataKeeper.getInstance().setBundleToPost(parameters);

            }
            bitmap.recycle();

It shows OutOfMemory exception.I know that this is due to imagesize exceeds its available size.How can i resize image without lossing its quality? I tried to correct this using BitmapFactory.Options. But does not work.How can solve this exception?

Regards
Asha

  • 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-06-09T11:55:47+00:00Added an answer on June 9, 2026 at 11:55 am

    use this :

    BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize = 8;
    Bitmap preview_bitmap=BitmapFactory.decodeStream(is,null,options);
    

    for more detail see this link

    link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried with this code to post on the wall (Twitter) of a user
I've tried to move WCF to NetDataContractSerializer using the code in this post: http://lunaverse.wordpress.com/2007/05/09/remoting-using-wcf-and-nhibernate
I want to receive multi file post from image uploader.( i use this )
I saw this post Linq int to string , and tried it var personalInfoQuery
Hey, I've tried researching how to POST data from java, and nothing seems to
I am trying to post an image to an album on facebook and place
I want to upload a foto from my android app to a facebook fan
I am using the following PHP code to post to my page wall. it
I've become very frustrated attempting to post a google chart image to the facebook
I'm trying to download a PNG image from a Flash application using a Java

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.