Thanks Kumar,
I said it previous that i know i can load it async or in new thread.
But after getting the image I don't know how to replace that image
back in textview.

Can you help me with small piece of code that how can i do it ?

On Oct 27, 4:05 pm, Kumar Bibek <coomar....@gmail.com> wrote:
> Do the fetching image part in a thread. That will solve your problem.
>
> On Wed, Oct 27, 2010 at 4:25 PM, umakantpatil <umakantpat...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
>
>
> > I have HTML text, I need to show it in textview. I did it. There are
> > some images in it. I also made ImageGetter
> > which loads image from remote server and displays it. But the issue is
> > now its very slow.
> > I know i can load it async. But i haven't got a single example or help
> > for this.
>
> > Below is the code to get the image
>
> > �...@override
> >                public Drawable getDrawable(String source) {
> >                        Drawable drawable = null;
> >                        Bitmap bitmap = null;
> >                    InputStream in = null;
> >                    BufferedOutputStream out = null;
> >                    try {
> >                            in = new BufferedInputStream(new
> > URL(source).openStream(),4096);
> >                        final ByteArrayOutputStream dataStream = new
> > ByteArrayOutputStream();
> >                        out = new BufferedOutputStream(dataStream, 4096);
> >                        copy(in, out);
> >                        out.flush();
> >                        final byte[] data = dataStream.toByteArray();
> >                        bitmap = BitmapFactory.decodeByteArray(data, 0,
> > data.length);
> >                        drawable = new BitmapDrawable(bitmap);
>
> >                            int width = getScreen();
> >                            int fin = width - 120;
>
> >                        drawable.setBounds(0, 0, fin, 200);
> >                        return drawable;
> >                    }catch (Throwable e) {
> >                        return null;
> >                }
> > }
>
> > Can any one tell my how can get it async without stopping UI?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs 
> > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to