Q:

Set imageView from Thread

I am using a freind to download a picture and set in the ImageView; however, I get this error:

Only the original thread that created a view hierarchy can touch its views.

This is my code.
ImageView profilePicture =....
Thread thread = new Thread() {
    @Override
    public void run() {
        profilePic.setImageBitmap(image_profile);
    }
};
thread.start();

The image_profile Bitmap is a valid Bitmap file. (I checked it via debug.) 
This thread is running in the OnCreate method.

A:

You cannot update your UI directly from the Thread. Instead, use runOnUiThread() or equivalent.
Replace this:
profilePic.setImageBitmap(image_profile);

With this:
YourActivityName.this.runOnUiThread(new Runnable() {
    @Override
    public void run() {
        profilePic.setImageBitmap(image_profile);
    }
});

A:

You cannot update ui on another thread. Update ui on the main ui thread as below
Thread thread = new Thread()
{
    @Override
    public void run() {
    runOnUiThread(new Runnable() //run on ui thread
    {
        public void run() 
        { 
            profilePic.setImageBitmap(image_profile);

        }
    });
    }
    };
   thread.start();

