jeudi 12 novembre 2015

use checkbox in listview and get the value of them android

i m developing a app that get pic from a server by j-son and show them to user in a list-view that they can choose some pic for download by check-box. i wanna use 2 array-list , one for the pic urls and another one for check-box value. my problem is i don't know much about list-views. check-box of special row must change when user click on that row, and how to get the check-box value from list-view (more important).

 void pics(JSONArray data){
   String url;int i;
   for (i=0;i<data.length();i++){
       try {
           String u=data.getJSONObject(i).getJSONObject("images").getJSONObject("res2").getString("url");
           String t=data.getJSONObject(i).getJSONObject("images").getJSONObject("resolution1").getString("url");
           myList.add(t);
           Lists.add(u);
           url=data.getJSONObject(i).getString("type");
         if (url.equals("video"))
             continue;
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
   }
   try {
    if(i<data.length()){
       String t=data.getJSONObject(i).getJSONObject("videos").getJSONObject("standard_resolution").getString("url");
       myList.set(i, t);}
    else{


    }
   } catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

}




Aucun commentaire:

Enregistrer un commentaire