Google electronics market 3-application, Google electronics market 3 --

Source: Internet
Author: User

Google electronics market 3-application, Google electronics market 3 --

 

Public class AppFragment extends BaseFragment {ArrayList <AppInfo> mList = null; @ Override public View onCreateSuccessView () {MyListView view = new MyListView (UIUtils. getContext (); view. setAdapter (new AppAdapter (mList); return view;} @ Override public ResultState onLoad () {AppProtocol protocol = new AppProtocol (); mList = protocol. getData (0); return check (mList);} class AppAdapter extends MyBa SeAdapter <AppInfo> {public AppAdapter (ArrayList <AppInfo> list) {super (list) ;}@ Override public BaseHolder <AppInfo> getHolder (int position) {return new AppHolder () ;}@ Override public ArrayList <AppInfo> onLoadMore () {AppProtocol protocol = new AppProtocol (); ArrayList <AppInfo> moreData = protocol. getData (getListSize (); return moreData ;}}----------------------------------------/*** access the network on the application page * * @ Author Kevin **/public class AppProtocol extends BaseProtocol <ArrayList <AppInfo> {private ArrayList <AppInfo> mAppList; // Application List set @ Override public String getKey () {return "app" ;}@ Override public String getParams () {return "" ;}@ Override public ArrayList <AppInfo> parseJson (String result) {try {JSONArray ja = new JSONArray (result); mAppList = new ArrayList <AppInfo> (); for (int I = 0; I <Ja. length (); I ++) {AppInfo info = new AppInfo (); JSONObject jo1 = (JSONObject) ja. get (I); info. des = jo1.getString ("des"); info. downloadUrl = jo1.getString ("downloadUrl"); info. iconUrl = jo1.getString ("iconUrl"); info. id = jo1.getString ("id"); info. name = jo1.getString ("name"); info. packageName = jo1.getString ("packageName"); info. size = jo1.getLong ("size"); info. stars = jo1.getDouble ("stars "); MAppList. add (info);} return mAppList;} catch (Exception e) {e. printStackTrace ();} return null;} -----------------------------------/*** application page holder ** @ author Kevin **/public class AppHolder extends BaseHolder <AppInfo> {private TextView tvName; private ImageView ivIcon; private TextView tvSize; private TextView tvDesc; private RatingBar rbStar; private BitmapUtils mBitmapUtils; @ Override pu Blic View initView () {View view = View. inflate (UIUtils. getContext (), R. layout. list_item_home, null); tvName = (TextView) view. findViewById (R. id. TV _name); ivIcon = (ImageView) view. findViewById (R. id. iv_icon); tvSize = (TextView) view. findViewById (R. id. TV _size); tvDesc = (TextView) view. findViewById (R. id. TV _desc); rbStar = (RatingBar) view. findViewById (R. id. rb_star); mBitmapUtils = BitmapHelper. get BitmapUtils (); mBitmapUtils. configdefaloadloadingimage (R. drawable. ic_default); return view ;}@ Override public void refreshView (AppInfo data) {if (data! = Null) {tvName. setText (data. name); tvSize. setText (Formatter. formatFileSize (UIUtils. getContext (), data. size); tvDesc. setText (data. des); rbStar. setRating (float) data. stars); mBitmapUtils. display (ivIcon, HttpHelper. URL + "image? Name = "+ data. iconUrl );}}}

  

Related Article

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.