Skip to content

AsyncHttpClient images #12

Closed
Closed
@ghost

Description

Greetings,

How to update an image from AsyncHttpClient?

Here's my code:

@Override
public void onSuccess(String response) {                
    Bitmap bm = BitmapFactory.decodeFile(response);

    ImageView imgView = (ImageView)findViewById(R.id.imageView1);
    imgView.setImageBitmap(bm);
}

I also tried this:

            @Override
            public void onSuccess(String response) {
                Drawable d = null;
                Object content=response.getBytes();
                InputStream is = (InputStream)content;
                d = Drawable.createFromStream(is, "src");

                ImageView imgView= (ImageView)findViewById(R.id.imageView1);
                imgView.setImageDrawable(d);
            }

But the image always appears blank ;( I need some way of converting the String response into a drawable...

I saw from another issue that there are plans to transmit binary data and not just Strings?

Any insight greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions