Native Android, high imitation VW reviews merchant list;
First of all, please pay attention to my http://weibo.com/u/2841033197
Nonsense not much to say, on the code,
650) this.width=650; "style=" Float:none; "title=" 5dfad8d742f56c22f78e5f0d510c90a1.jpg "src=" http://s3.51cto.com/ Wyfs02/m01/6e/60/wkiol1v6machjfzpaak6cg0ivew257.jpg "alt=" Wkiol1v6machjfzpaak6cg0ivew257.jpg "/>
650) this.width=650; "style=" Float:none; "title=" 9H7ZF9@1FFHMTOD3VU6T7TU.png "src=" http://s3.51cto.com/wyfs02/M01/ 6e/60/wkiol1v6macgyic6aac3exrt_ii501.jpg "alt=" Wkiol1v6macgyic6aac3exrt_ii501.jpg "/>
650) this.width=650; "style=" Float:none; "title=" 95eff92f4a44823aa0735649c89a2c6d.jpg "src=" http://s3.51cto.com/ Wyfs02/m01/6e/64/wkiom1v6l_iwq3g9aalbr5pvzmc605.jpg "alt=" Wkiom1v6l_iwq3g9aalbr5pvzmc605.jpg "/>
Adapter
Class Myadapter extends Baseadapter {
protected final int mitemlayoutid;
list<businesses> data = new arraylist<businesses> ();
Private context context;
Private Layoutinflater Inflater;
Private Imagescaletype Imagescaletype;
Private displayimageoptions options;
Public Myadapter (list<businesses> data, Context cxt, int itemlayoutid, Imagescaletype imagescaletype) {
This.data = data;
This.context = CXT;
This.mitemlayoutid = Itemlayoutid;
This.inflater = Layoutinflater.from (context);
This.imagescaletype = Imagescaletype;
Init ();
}
/** initializing picture cache options **/
private void init () {
options = new Displayimageoptions.builder ()
. showimageonloading (R.drawable.thumb)
. Showimageonfail (R.drawable.ic_error)
. Cacheinmemory (True)
. Cacheondisk (True)
. Considerexifparams (True)
. imagescaletype (Imagescaletype! = null? imageScaleType:ImageScaleType.EXACTLY)
. delaybeforeloading (10)
. Displayer (New Simplebitmapdisplayer ())///display a picture normally
. build ();
}
@Override
public int GetCount () {
TODO auto-generated Method Stub
return data! = NULL? Data.size (): 0;
}
@Override
Public Object getItem (int position) {
TODO auto-generated Method Stub
return data! = NULL? Data.get (position): null;
}
@Override
public long getitemid (int position) {
TODO auto-generated Method Stub
return position;
}
@Override
Public View GetView (int position, View Convertview, ViewGroup parent) {
Viewholder holder = Getviewholder (position, convertview, parent);
TextView BUSINESS_ID_TV = Holder.getview (R.ID.BUSINESS_ID_TV);
TextView NAME_TV = Holder.getview (R.ID.NAME_TV);
TextView AVG_PRICE_TV = Holder.getview (R.ID.AVG_PRICE_TV);
TextView REGIONS_TV = Holder.getview (R.ID.REGIONS_TV);
TextView DISTANCE_TV = Holder.getview (R.ID.DISTANCE_TV);
String S_photo_url = data.get (position). Gets_photo_url ();
String Rating_s_img_url = data.get (position). Getrating_img_url ();
int business_id = Data.get (position). getbusiness_id ();
String name = Data.get (position). GetName ();
String branch_name = data.get (position). Getbranch_name ();
int avg_price = Data.get (position). Getavg_price ();
String regions = data.get (position). Getregions ();
String categories = Data.get (position). GetCategories ();
int distance = Data.get (position). Getdistance ();
Holder.displayimages (R.id.s_photo_url_iv, S_photo_url);
Holder.displayimages (R.id.star_iv, Rating_s_img_url);
Business_id_tv.settext ("" + business_id);
Name = name.substring (0, Name.indexof ("("));
if (! Stringutils.isempty (Branch_name)) {
Name = name + "(" +branch_name + ")";
}
Name_tv.settext (name);
if (Avg_price > 0) {
Avg_price_tv.settext ("¥" + avg_price + "/person");
}
Filter the data
Regions = Regions.replace ("\" "," "). Replace (" ["," ""). Replace ("]", ""). Split (",") [1];
Categories = Categories.replace ("\" "," "). Replace (" ["," ""). Replace ("]", "" ");
Regions_tv.settext (Regions + "" + categories);
if (Distance > 0) {
Float die = distance;
DecimalFormat decimalformat=new DecimalFormat (". 0");
if (die >= 1000) {
More than 1000 meters converted to kilometer display data
Die/= 1000;
String Temp_die = Decimalformat.format (die);
Temp_die = Temp_die.replace (". 0", "");
Distance_tv.settext (Temp_die + "km");
} else {
Distance_tv.settext (distance + "M");
}
}
Setclick (data, Holder.getconvertview (), position);
return Holder.getconvertview ();
}
Private Viewholder getviewholder (int position, View Convertview,
ViewGroup parent) {
Return Viewholder.get (Context, Convertview, parent, Mitemlayoutid,
position, options);
}
private void Setclick (final list<businesses> datas, final View Convertview,
final int position) {
Convertview.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View arg0) {
int business_ids = Datas.get (position). getbusiness_id ();
String keywords = "";
try {
Keywords = Urlencoder.encode ("" + Business_ids, "UTF-8");
Uri url = uri.parse ("dianping://shopinfo?id=" + keywords);
Intent Intent = new Intent (intent.action_view, URL);
Context.startactivity (Intent);
} catch (Exception e) {
No apps installed, HTML5 station opens by default
Intent Intent = new Intent (Intent.action_view, Uri
. Parse ("http://m.dianping.com/search.aspx?skey="
+ keywords));
Context.startactivity (Intent);
}
}
});
}
The source I put on my favorite blog, the Portal
This article is from "It Xiao Xiang Pig" blog, please be sure to keep this source http://edmzkj.blog.51cto.com/9115753/1661329
High imitation Volkswagen reviews merchant list