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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:35:29+00:00 2026-05-28T05:35:29+00:00

In the onCreate event i make an asynchronous request to the facebook api :

  • 0

In the onCreate event i make an asynchronous request to the facebook api :

Utility.mAsyncRunner.request(null, params1,
                    new myListener());

In myListener’s onComplete Event i would like to set the image in an imageview

public class PhotoDisplayListener extends BaseRequestListener {

        @Override
        public void onComplete(final String response, final Object state) {
        //set my image with the url provided in the response
        ...parse json....
ImageView img = (ImageView)findViewById(R.id.img);


                URL ulrn = new URL(photourl);
                HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
                InputStream is = con.getInputStream();
                Bitmap bmp = BitmapFactory.decodeStream(is);
                if (null != bmp){
                    img.setImageBitmap(bmp);
                    setImage(bmp);
                    }
                else
                    System.out.println("The Bitmap is NULL");

                }catch(Exception e){} catch (FacebookError e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    showToast(e.getMessage());
                }

}

}

the problem is that the imageview does not refresh with the new one set by me.
It sets it, by it doesn’t refresh it. If i lock and unlock the phone, the image appears as it should.
How can i force the refresh of the imageview?
Thanks!

  • 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-28T05:35:29+00:00Added an answer on May 28, 2026 at 5:35 am

    You can’t update the UI thread from outside (another thread). I would recommend you to call instead a method on your activity to update the ImageView.

    Article about this topic: Painless Threading

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

Sidebar

Related Questions

my code(prototype 1.6.1) Event.observe(window, 'load', function() { new Ajax.Request('/modal/order_same/', { parameters: {}, onComplete: function(){alert('err0');},
I am trying to make my first Android app. I noticed that the SQLiteOpenHelper.onCreate()
I am developing Android LBS application. I would like to make function calls randomly
I am trying to make a click event for a ListView in monodroid. public
In the onCreate() of an activity, I've got a call to requestFocus() on an
I've noticed in some coding people use icicle with the onCreate method, and I
I have Activity with ListView inside it and in the onCreate method of the
I have a class derived from CTreeCtrl . In OnCreate() I replace the default
I have built my interface by using ViewStubs, which I inflate during onCreate. But
For invoke search android example, every time query search result is received by onCreate().

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.