Android Learning Notes

Source: Internet
Author: User

This project, which is based on Renren clients, is nearing the end of the campaign. I think of my 2 months of learning about Android, there are a lot of gains. Despite a lot of problems throughout the process, but eventually solved.

Here, record the problems and solutions that you encountered throughout the process.

I am responsible for the "Friends" interface section, the main needs to implement the following functions

1. Use a list View to display your buddy lists , where each Item contains the user's avatar / name /id, and use the database to save .

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/42/3C/wKioL1PXLguySxo4AACT83jIbw4422.jpg "title=" 1.jpg " alt= "Wkiol1pxlguysxo4aact83jibw4422.jpg"/>

The first problem encountered is the preservation of the picture. Because it is a network picture, and the List View uses simple Adapter to set the contents of each Item, and simple Adapter is not supported map (?,?) saved in Bitmap 's.

finally on the Internet search, generally adopted to achieve View Binder interface to solve this problem.

Fadapter.setviewbinder (New viewbinder ()  {                publicboolean setviewvalue (View view, object data,                       stringtextrepresentation)  {                   //  determine if the object we want to deal with                    if  (view instanceof  IMAGEVIEW && DATA INSTANCEOF BITMAP)  {                      imageviewiv =   (ImageView)  view;                    &nBsp; iv.setimagebitmap ((Bitmap) data);                      returntrue;                   }else                      returnfalse;                }             });

here, View is a custom layout, and Data It's the incoming List data. This function traverses the individual components in the layout so that the pictures saved in data are passed to simple Adapter.

2.to beItemset the Click event to get the firstItemof theIdthen throughIntentTeleport Past,Show your friends ' basic information in another interface.its layout isScroll Viewin NestingList View. In other words, when we first saw the official client, it was not clear, why not display all the information on an interface? Later, I found the following layout problem. When testing on a real machine,theScroll Viewthe drag will affectList Viewthe drag. In fact, the best way should be to useExpandablelistview. Second, it's in different phones.,the displayed information will not match the background picture. Thought before.Uito do cool, but ignore the layout to adapt to all the different sizes of equipment.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/42/3C/wKiom1PXLhTw-IC2AADgBuaC7Yk740.jpg "style=" float: none; "title=" 1.jpg "alt=" wkiom1pxlhtw-ic2aadgbuac7yk740.jpg "/> 650" this.width=650; "src=" http: S3.51cto.com/wyfs02/m01/42/3c/wkiom1pxlhwslbajaaca1uxj-tq998.jpg "title=" 2.jpg "style=" Float:none; "alt=" Wkiom1pxlhwslbajaaca1uxj-tq998.jpg "/>



2. Finally, there is a question of more doubt that the parsed "JSON" data need to do some processing

Like the following.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/42/3D/wKiom1PXLkTyNuksAAC1VB-B3Ns301.jpg "title=" 3.jpg " alt= "Wkiom1pxlktynuksaac1vb-b3ns301.jpg"/>

here, you need to get the "DOCTOR", "COLLEGE" and so on to the corresponding "Doctor", "undergraduate" and so on. Otherwise it will show

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/42/3D/wKioL1PXL3zTVWUwAAAL4ey-o5o027.jpg "title=" 5.jpg " alt= "Wkiol1pxl3ztvwuwaaal4ey-o5o027.jpg"/>

My idea is to use an array to convert. That is, "Doctor", "undergraduate" These are added to an array, and then the final parsed data is compared with one, so as to achieve the desired effect



This article is from the "hacker" blog, make sure to keep this source http://anglecode.blog.51cto.com/5628271/1532135

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.