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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:04:56+00:00 2026-06-10T15:04:56+00:00

I want to show my downloaded image in my Imageview. I’m getting error Type

  • 0

I want to show my downloaded image in my Imageview. I’m getting error ” Type mismatch: cannot convert from ImageView to Bitmap ” . Its saying I cannot show Bitmap images in imageview. Can anyone show me a way to accomplish it?

public class SingleImageViewActivity  extends SherlockActivity {

        // XML node keys
    static final String KEY_TITLE = "title";
    static final String KEY_ARTIST = "artist";  
    static final String KEY_BIG_URL = "big_url";
    private ProgressDialog pDialog;
    String title;
    String artist;
    String big_image_url;
    ImageView view;
    URL url;
    Bitmap bmImg = null;
    ShareActionProvider mShareActionProvider;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.single_view_item);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);


            new loadSingleView().execute();


        }

    public class loadSingleView extends AsyncTask<String, String, String> {

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                pDialog = new ProgressDialog(SingleImageViewActivity.this);
                pDialog.setTitle("Connect to Server");
                pDialog.setMessage("This process can take a few seconds to a few minutes, depending on your Internet Connection Speed.");
                pDialog.setIndeterminate(false);
                pDialog.setCancelable(false);
                pDialog.show();
            }
            @Override
            protected String doInBackground(String... args) {
                // updating UI from Background Thread
                try {  
                    Intent in = getIntent();

                    big_image_url = in.getStringExtra(KEY_BIG_URL);
                    title = in.getStringExtra(KEY_TITLE);
                    artist = in.getStringExtra(KEY_ARTIST);


                    url = new URL(big_image_url);
                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();   
                    conn.setDoInput(true);   
                    conn.connect();     
                    InputStream is = conn.getInputStream();
                    bmImg = BitmapFactory.decodeStream(is); 
                }
                catch (IOException e)
                {       
                    e.printStackTrace();  
                }

                return null;   
            }
                @Override       
        protected void onPostExecute(String args) {
            // dismiss the dialog after getting all products
             TextView lblName = (TextView) findViewById(R.id.name_title);
                TextView lblCost = (TextView) findViewById(R.id.name_artist);



                lblName.setText(title);
                lblCost.setText(artist);

                ActionBar ab = getSupportActionBar();
                ab.setTitle(title);
                ab.setSubtitle(artist);

                view = (ImageView) findViewById(R.id.single_image);
                view.setImageBitmap(bmImg);


            pDialog.dismiss();


        }

                }

Logcat :

08-28 22:19:44.225: E/AndroidRuntime(20825): FATAL EXCEPTION: AsyncTask #3
08-28 22:19:44.225: E/AndroidRuntime(20825): java.lang.RuntimeException: An error occured while executing doInBackground()
08-28 22:19:44.225: E/AndroidRuntime(20825):    at android.os.AsyncTask$3.done(AsyncTask.java:278)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.lang.Thread.run(Thread.java:856)
08-28 22:19:44.225: E/AndroidRuntime(20825): Caused by: java.lang.NullPointerException
08-28 22:19:44.225: E/AndroidRuntime(20825):    at com.example.androidhive.SingleImageViewActivity$loadSingleView.doInBackground(SingleImageViewActivity.java:91)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at com.example.androidhive.SingleImageViewActivity$loadSingleView.doInBackground(SingleImageViewActivity.java:1)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
08-28 22:19:44.225: E/AndroidRuntime(20825):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
08-28 22:19:44.225: E/AndroidRuntime(20825):    ... 4 more
08-28 22:19:49.631: E/WindowManager(20825): Activity com.example.androidhive.SingleImageViewActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@416c0328 that was originally added here
08-28 22:19:49.631: E/WindowManager(20825): android.view.WindowLeaked: Activity com.example.androidhive.SingleImageViewActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@416c0328 that was originally added here
08-28 22:19:49.631: E/WindowManager(20825):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:428)
08-28 22:19:49.631: E/WindowManager(20825):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
08-28 22:19:49.631: E/WindowManager(20825):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
08-28 22:19:49.631: E/WindowManager(20825):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
08-28 22:19:49.631: E/WindowManager(20825):     at android.view.Window$LocalWindowManager.addView(Window.java:537)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.Dialog.show(Dialog.java:278)
08-28 22:19:49.631: E/WindowManager(20825):     at com.example.androidhive.SingleImageViewActivity$loadSingleView.onPreExecute(SingleImageViewActivity.java:72)
08-28 22:19:49.631: E/WindowManager(20825):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
08-28 22:19:49.631: E/WindowManager(20825):     at android.os.AsyncTask.execute(AsyncTask.java:511)
08-28 22:19:49.631: E/WindowManager(20825):     at com.example.androidhive.SingleImageViewActivity.onCreate(SingleImageViewActivity.java:57)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.Activity.performCreate(Activity.java:4465)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
08-28 22:19:49.631: E/WindowManager(20825):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 22:19:49.631: E/WindowManager(20825):     at android.os.Looper.loop(Looper.java:137)
08-28 22:19:49.631: E/WindowManager(20825):     at android.app.ActivityThread.main(ActivityThread.java:4512)
08-28 22:19:49.631: E/WindowManager(20825):     at java.lang.reflect.Method.invokeNative(Native Method)
08-28 22:19:49.631: E/WindowManager(20825):     at java.lang.reflect.Method.invoke(Method.java:511)
08-28 22:19:49.631: E/WindowManager(20825):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:982)
08-28 22:19:49.631: E/WindowManager(20825):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)
08-28 22:19:49.631: E/WindowManager(20825):     at dalvik.system.NativeStart.main(Native Method)
  • 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-10T15:04:58+00:00Added an answer on June 10, 2026 at 3:04 pm

    You declared ImageView as

    ImageView view;
    

    You have to set Image on ImageView.
    It should be like this

    view = (ImageView) findViewById(R.id.single_image);
    view.setImageBitmap(bmImg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting my downloaded drawables correctly and they show up correctly. I just want
I want to show a notification bar when an application is being downloaded in
I want to show a border type look for an element but without using
I am building an Android app. For that i want to show image at
I want to show icon that associated with file type. Something like this But
This is an image based project. In this I want to download image from
Hi I want to show an image gallery on my site and then have
I want to load an image from url on a button click & to
In android when Bitmap is downloaded from the Internet using BitmapFactory.Options with inSampleSize >
I want to show an image in a Toast in Android. In my layout.xml,

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.