Thursday, March 6, 2014

android client obtains server side image problem!


Question: I do not know how the server side of the path to the picture, the client can open this picture!

Server-side code:

ArrayList > list = new ArrayList > ();
HashMap map = new HashMap ();
map.put ("nid", 1);
map.put ("title", "NB");
map.put ("imgsrc", "http://192.168.0.103:8080/web/img/a01");
map.put ("digest", "123");
map.put ("source", "456");
map.put ("ptime", "789");
map.put ("commentcount", "4444");
list.add (map);

Is map.put ("imgsrc", "http://192.168.0.103:8080/web/img/a01.png"); should assign the client how to open a server-side photos ah? !
I entered http://192.168.0.103:8080/web/img/a01.png in IE can open my pictures.

Client code:

Interface:
android: id = "@ + id / fsd"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_alignParentLeft = "true"
android: layout_alignParentTop = "true"
android: layout_marginLeft = "92dp"
/>

Program:
/ / --------------------------------------------
One method used to ImageView SimpleAdapter assignment:

mNewsListAdapter = new SimpleAdapter (this, mNewsData, R.layout.newslist_item,
new String [] {"newslist_item_title", "newslist_item_digest", "newslist_item_source", "newslist_item_ptime", "fsd"},
new int [] {R.id.newslist_item_title, R.id.newslist_item_digest, R.id.newslist_item_source, R.id.newslist_item_ptime, R.id.fsd}) ;/ /

View loadMoreLayout = mInflater.inflate (R.layout.loadmore, null);
mNewsList.addFooterView (loadMoreLayout);
mNewsList.setAdapter (mNewsListAdapter);
/ / ----------------------------------------------


private int getSpeCateNews (int cid, List > newsList, int startnid, Boolean firstTimes) {
if (firstTimes) {
newsList.clear ();
}
/ / Xuan Feng Zhi URL Coffee & Hanshiwa quilted cover
��String url = "http://192.168.0.103:8080/web/getSpecifyCategoryNews";
String params = "startnid =" + startnid + "& count =" + NEWSCOUNT + "& cid =" + cid;
SyncHttp syncHttp = new SyncHttp ();
try {
/ / Hay �^ et Kouguifangxuan Feng Zhi Benangouluan Fenggoumaliu Wuzidunyong
String retStr = syncHttp.httpGet (url, params);
System.out.println ("======================" + retStr);
JSONObject jsonObject = new JSONObject (retStr);
/ / Joseph Fengxiaomaliu Wulianguangren 0 Sum ㄧ ず Xi impart Dong
int retCode = jsonObject.getInt ("ret");
System.out.println ("F: retCode:" + retCode);
if (1 == retCode) {
System.out.println ("F: 1");
JSONObject dataObject = jsonObject.getJSONObject ("data");
/ / Luanfengxiaoma Youwusuoban Ju
int totalnum = dataObject.getInt ("totalnum");
if (totalnum> 0) {
/ / Luanfengxiaoma Youwuouban Jubanguhao
JSONArray newslist = dataObject.getJSONArray ("newslist");
for (int i = 0; i JSONObject newsObject = (JSONObject) newslist.opt (i);
HashMap hashMap = new HashMap ();
hashMap.put ("nid", newsObject.getInt ("nid"));
hashMap.put ("newslist_item_title", newsObject.getString ("title"));
hashMap.put ("newslist_item_digest", newsObject.getString ("digest"));
hashMap.put ("newslist_item_source", newsObject.getString ("source"));
hashMap.put ("newslist_item_ptime", newsObject.getString ("ptime"));
hashMap.put ("newslist_item_comments", newsObject.getString ("commentcount"));
hashMap.put ("fsd", newsObject.getString ("imgsrc"));
newsList.add (hashMap);
}
return SUCCESS;
}
else {
if (firstTimes) {
return NONEWS;
}
else {
return NOMORENEWS;
}
}
}
else {
return LOADERROR;
}
} Catch (Exception e) {
e.printStackTrace ();
return LOADERROR;
}
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Is that your input can be opened in the IE address to the client can be, specifically how to display See: http://www.open-open.com/lib/view/open1329994245811.html
Reply:
First download pictures to the phone in order to use ImageView View

No comments:

Post a Comment