Skip to content

AsyncHttpClient images #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Aug 12, 2011 · 1 comment
Closed

AsyncHttpClient images #12

ghost opened this issue Aug 12, 2011 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 12, 2011

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.

@loopj
Copy link
Collaborator

loopj commented Aug 15, 2011

See issue 8 for a discussion on this: #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant