Android Get album list implementation (iv)

Source: Internet
Author: User

The project implements the following functions:
Get Mobile album, click on each album to enter the picture list of the album interface, in the Picture list interface can achieve multiple selection of pictures, and then into the selected image interface, in this interface can achieve the selected image upload and other functions.
The biggest feature of the project:
1, to obtain a list of albums, the current network above the introduction of the album to obtain a few items, this article specifically about the acquisition of albums.
2, using the Android-universal-image-loader Integration Framework-third-party jar load local images, familiar with the jar developer is not unfamiliar, the jar is very powerful, in addition to access to network images, local images are also possible. At the same time, an Oom exception can be effectively resolved by referencing a third-party jar.

The address of the above three posts is as follows:
Android Get album list implementation (i)
Android Get album list implementation (II)
Android Get album list implementation (III)

This article continues the above three blog posts, the following is given in the selected album in the picture, activity jumps to the selected image of the interface, that is, the selected images loaded into the interface display, so that the process to facilitate the developer of the selected image processing, such as uploading can be further developed according to their own needs.
The code for the Activity class is given below:

 Public  class selectedimagesactivity extends Activity  implements  Onclicklistener{    PrivateGridView GridView;PrivateTextView Back,ok;PrivateArraylist<photoupimageitem> ArrayList;//Store the list of selected pictures    PrivateSelectedimagesadapter adapter;//Adapter    @Override    protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate);        Requestwindowfeature (Window.feature_no_title);        Setcontentview (R.layout.selected_images_grid);        Init ();    Setclicklistener (); }@SuppressWarnings("Unchecked")Private void Init() {gridview = (GridView) Findviewbyid (R.ID.SELECTED_IMAGES_GRIDV);        back = (TextView) Findviewbyid (r.id.back);        OK = (TextView) Findviewbyid (r.id.sure); ArrayList = (arraylist<photoupimageitem>) getintent (). Getserializableextra ("Selectima"); adapter =NewSelectedimagesadapter (selectedimagesactivity. This, arrayList);    Gridview.setadapter (adapter); }Private void Setclicklistener() {Back.setonclicklistener ( This); Ok.setonclicklistener ( This); Gridview.setonitemclicklistener (NewOnitemclicklistener () {@Override             Public void Onitemclick(adapterview<?> parent, view view,intPositionLongID) {}}); }@Override    protected void OnDestroy() {Super. OnDestroy (); }@Override     Public void OnClick(View v) {Switch(V.getid ()) { CaseR.id.back:finish (); Break; CaseR.id.sure:toast.maketext (selectedimagesactivity. This,"Upload and so on, developers can do their own", Toast.length_long). Show (); Break; }    }}

The Activity class code is simple, and the adapter code is given below:

 Public  class selectedimagesadapter extends baseadapter {    PrivateArraylist<photoupimageitem> ArrayList;PrivateLayoutinflater Layoutinflater;PrivateImageloader Imageloader;PrivateDisplayimageoptions options; Public Selectedimagesadapter(Context context,arraylist<photoupimageitem> ArrayList) { This. arrayList = arrayList;        Layoutinflater = Layoutinflater.from (context); Imageloader = Imageloader.getinstance ();//Use Displayimageoption.builder () to create DisplayimageoptionsOptions =NewDisplayimageoptions.builder (). Showstubimage (R.drawable.album_default_loading_pic)//Set up pictures to display during picture download. Showimageforemptyuri (R.drawable.album_default_loading_pic)//Set picture to display when the image URI is empty or wrong. Showimageonfail (R.drawable.album_default_loading_pic)//Set Picture of error display during picture loading or decoding. Cacheinmemory (true)//Set whether the downloaded picture is slow in memory. Cacheondisc (true)//Set whether the downloaded picture is slow to exist on the SD card                //. Displayer (New Roundedbitmapdisplayer )                //Set rounded picture. Bitmapconfig (config.argb_8888). Imagescaletype (Imagescaletype.in_sample_int). build ();//Create a configured Displayimageoption object}@Override     Public int GetCount() {returnArraylist.size (); }@Override     PublicObjectGetItem(intPosition) {returnArraylist.get (position); }@Override     Public Long Getitemid(intPosition) {returnPosition }@Override     PublicViewGetView(intPosition, View Convertview, ViewGroup parent) {Holder Holder;if(Convertview = =NULL) {Convertview = Layoutinflater.inflate (R.layout.selected_images_adapter_item, parent,false); Holder =NewHolder ();            Holder.imageview = (ImageView) Convertview.findviewbyid (R.id.selected_image_item);        Convertview.settag (holder); }Else{holder = (holder) Convertview.gettag (); } imageloader.displayimage ("file://"+arraylist.get (position). Getimagepath (), Holder.imageview, options);returnConvertview;    } class holder{ImageView ImageView; }}

The adapter code is also very simple, directly using the picture loader-third-party jar package Implementation, click the OK button developers can follow up the development work.
This concludes the entire project. If your friends have any questions or find the error in the text, please do not hesitate to enlighten! Thank you so much! At the same time, because my level is limited, if there is anything wrong in the blog place, please forgive me, welcome to criticize! Handshake

SOURCE download

Android Get album list implementation (iv)

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.