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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:34:14+00:00 2026-06-15T16:34:14+00:00

Possible Duplicate: How to pass image data from one activity to another activity? pass

  • 0

Possible Duplicate:
How to pass image data from one activity to another activity?
pass a bitmap image from one activity to another

I tried to get a bitmap from view like below

     View s = ml.getRootView();
                s.setDrawingCacheEnabled(true);

            Bitmap  b = s.getDrawingCache();


                System.out.println(b.isRecycled());


                Log.e("ok","ok");
                Intent i=new Intent(CameraActivity.this,Update.class);
                 i.putExtra("data",b);
                 startActivity(i);
//                 s.setDrawingCacheEnabled(false);
                 s.setVisibility(View.GONE);
                 finish();

I tried to transfer the bitmap from this Activity to another,but it is showing me black screen and app gets crashed.
       s.setVisibility(View.GONE); If I dont give this statement it is showing me this modified Activity and then it is showing Black screen.

I think it is taking much time to transfer this bitmap.

How can I solve this issue?

please help

Thanks

Logcat after getting Black screen

12-06 11:23:34.654: E/AndroidRuntime(16900): FATAL EXCEPTION: main
12-06 11:23:34.654: E/AndroidRuntime(16900): java.lang.NullPointerException
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2595)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.app.ActivityThread.access$1800(ActivityThread.java:124)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.os.Looper.loop(Looper.java:123)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at android.app.ActivityThread.main(ActivityThread.java:3806)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at java.lang.reflect.Method.invokeNative(Native Method)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at java.lang.reflect.Method.invoke(Method.java:507)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-06 11:23:34.654: E/AndroidRuntime(16900):    at dalvik.system.NativeStart.main(Native Method)
12-06 11:23:36.490: W/InputManagerService(1318): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40a84730
  • 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-15T16:34:15+00:00Added an answer on June 15, 2026 at 4:34 pm

    You are passing Bitmap into Intent and get bitmap in next activity from bundle, but the problem is if your Bitmap/Image size is big at that time the image is not load in next activity.

    Use below 2 Solutions to solve this issue.

    1) First Convert Image into Byte Array and then pass into Intent and in next activity get byte array from Bundle and Convert into Image(Bitmap) and set into ImageView.

    Convert Bitmap to Byte Array:-

    Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
    byte[] byteArray = stream.toByteArray();
    

    Pass byte array into intent:-

    Intent intent = new Intent(this, NextActivity.class);
    intent.putExtra("picture", byteArray);
    startActivity(intent);
    

    Get Byte Array from Bundle and Convert into Bitmap Image:-

    Bundle extras = getIntent().getExtras();
    byte[] byteArray = extras.getByteArray("picture");
    
    Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
    ImageView image = (ImageView) findViewById(R.id.imageView1);
    
    image.setImageBitmap(bmp);
    

    2) First Save image into SDCard and in next activity set this image into ImageView.

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

Sidebar

Related Questions

Possible Duplicate: pass data from Action To Another Action I have a view in
Possible Duplicate: How to pass object from one activity to another in Android I
Possible Duplicate: How to pass object from one activity to another in Android I
Possible Duplicate: How to pass a value from one Activity to another in Android?
Possible Duplicate: How to pass object from one activity to another in Android While
Possible Duplicate: How to pass object from one activity to another in Android I
Possible Duplicate: How to Pass String to another forms from one form in c#
Possible Duplicate: How to pass a variable / data from javascript to php and
Possible Duplicate: codeigniter : pass data to a view included in a view How
Possible Duplicate: How to pass data to detail view after being selected in a

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.