Android GridView load picture, one sheet display

Source: Internet
Author: User

Simply put, get sdcard pictures or video thumbnails do not say, many online, mainly write down the way to load pictures, in the Grideview adapter GetView () method defined:

Asynchronously loading a picture to achieve a single display

New Loadimageasyctask (gridviewhold. Icon). Execute (paths[position]);


class Loadimageasyctask extends asynctask<string, Void, bitmap>{

ImageView View;


Public Loadimageasyctask (ImageView view) {

Super ();

this. View = view;

}


@Override

protected Bitmap doinbackground (String ... params) {

TODO auto-generated Method stub

Bitmap Videoicon = Thumbnailutils.createvideothumbnail (

Params[0], video.thumbnails. mini_kind);

return Videoicon;

}


@Override

protected void OnPreExecute () {

TODO auto-generated Method stub

Super. OnPreExecute ();

}


@Override

protected void OnPostExecute (Bitmap result) {

TODO auto-generated Method stub

this. view. Setimagebitmap (Result);

Super. OnPostExecute (Result);

}

}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.