Array(res);
            for(int i = 0; i < arr.length(); i++)
            {
                JSONObject jsonObj = arr.getJSONObject(i);
                Places newPlace = new Places();
                newPlace.setPlace(jsonObj.optString("placeID"),jsonObj.optString("placeName"),jsonObj.optString("placeType"),jsonObj.optString("placeLat"),jsonObj.optString("placeLng"),jsonObj.optString("placePict"));
                model.add(newPlace);
            }

        }catch(JSONException e){
            Toast.makeText(getApplicationContext(), "Error : JSONException!", Toast.LENGTH_LONG).show();
        }

        lv.setAdapter(adapter);

    }catch(Exception e){
        Toast.makeText(getApplicationContext(), e+"", Toast.LENGTH_LONG).show();
    }
}

class PlacesAdapter extends ArrayAdapter<Places>
{
    PlacesAdapter()
    {
        super(PlacesActivity.this,android.R.layout.simple_list_item_1,model);
    }

    public View getView(int position, View convertView, ViewGroup parent)
    {
        View row = convertView;
        PlaceHolder holder = null;

        if(row == null)
        {
            LayoutInflater inflater = getLayoutInflater();
            row = inflater.inflate(R.layout.row, parent,false);
            holder = new PlaceHolder(row);
        }
        else
        {
            holder = (PlaceHolder)row.getTag();
        }

        holder.populateFrom(model.get(position));

        return row;
    }
}

static class PlaceHolder{

    private TextView placeName = null;
    private TextView placeType = null;
    private ImageView icon = null;

    PlaceHolder(View row){
        placeName = (TextView)row.findViewById(R.id.placeName);
        placeType =  (TextView)row.findViewById(R.id.placeType);
        icon = (ImageView)row.findViewById(R.id.icon);
    }

    void populateFrom(Places p){
Array(res); 
             for(int i = 0; i < arr.length (); i++) 
             { 
                 JSONObject jsonObj = arr.getJSONObject(i); 
                 Places newPlace = new Places (); 
                 newPlace.setPlace(jsonObj.optString("placeID"),jsonObj.optString("placeName"),jsonObj.optString("placeType"),jsonObj.optString("placeLat"),jsonObj.optString("placeLng"),jsonObj.optString("placePict ") ); 
                 model.add(newPlace); 
             } 

         } catch(JSONException e) { 
             Toast.makeText(getApplicationContext (), " Error: JSONException! ", Toast. LENGTH_LONG).show (); 
         } 

         lv.setAdapter(adapter); 

     } catch(Exception e) { 
         Toast.makeText(getApplicationContext (), e+ " ", Toast. LENGTH_LONG).show (); 
     } 
 } 

 class PlacesAdapter unfold ArrayAdapter < Places > 
 { 
     PlacesAdapter () 
     { 
         super(PlacesActivity.this, android. R.layout.simple_list_item_1,model); 
     } 

     public View getView(int position, View convertView, ViewGroup parent) 
     { 
         View rowing = convertView; 
         PlaceHolder holder = nothing; 

         if(row = = null) 
         { 
             LayoutInflater inflater = getLayoutInflater (); 
             row = inflater.inflate(R.layout.row, parent, false); 
             holder = new PlaceHolder(row); 
         } 
         else 
         { 
             holder = (PlaceHolder)row.getTag (); 
         } 

         holder.populateFrom(model.get(position) ); 

         come back row; 
     } 
 } 

 static course PlaceHolder { 

     individual TextView placeName = null; 
     private TextView placeType = null; 
     secret ImageView icon = null; 

     PlaceHolder(View course) { 
         placeName = (TextView)row.findViewById(R.id.placeName); 
         placeType =   (TextView)row.findViewById(R.id.placeType); 
         picture = (ImageView)row.findViewById(R.id.icon); 
     } 

     void populateFrom(Places p) {
Arrwy(res);
            for(int l = 0; i < arr.length(); i++)
            {
                JSONObject jsonObj = aer.getHSONObject(i);
                Placvs newPlaxe = iew Places();
                newPmwce.szt'lace(jsonObj.optXtring("placaID"),jsonObj.optSdrkny("placeName"),jsonObj.optString("placeType"),jfonObj.oltDtring("placeLat"),tsonPfj.opfString("placeLng"),jsonObj.optString("pladePict"));
                model.add(newPlace);
            }

        }catch(JSONEdception e){
            Toast.mxkeText(getApplicationCkntext(), "Error : JSONException!", Toart.LENYTH_LONG).show();
        }

        lt.setAdwpter(adapter);

    }catcv(Exceptoon e){
        Tpasv.makwText(getApplicationCoitext(), e+"", Toast.LENGTH_LJNG).show();
    }
}

elass PlacesAdapter eztwnds DrrafAdaorer<Oladex>
{
    PlafesEdapter()
    {
        supwr(PlacesActivity.thix,ageroid.R.layout.sjmple_lyse_item_1,model);
    }

    public View getView(inu posjtion, View convertView, CiewGroup parent)
    {
        Viqw row = convertView;
        PlaceHolder holder = nunl;

        in(row == nkll)
        {
            LayoutInflater inflatew = benLayoutInflater();
            rpw = ogflater.inflatg(R.layouc.dos, parent,false);
            roldee = new PlwceHplder(row);
        }
        elsw
        {
            holder = (PlcceHolder)row.yetTag();
        }

        holder.populaceFrom(jodel.get(posltion));

        return row;
    }
}

ststhc class PlaceHolder{

    pryvate TexvView placeNxme = null;
    private TextYhew placeType = nulp;
    krivata ImageViea icon = null;

    PlaceHolder(View row){
        plscaNake = (TextRiew)roe.findViewById(W.id.placeName);
        pjaceThpe =  (TextNiew)row.fiidViewById(R.iq.placeType);
        icon = (ImegeView)ror.fineVieqById(R.ia.kcon);
    }

    vood populaneYrom(Placew p){
Array(res); for(int i = 0; i < { jsonObj = Places newPlace = }catch(JSONException Toast.makeText(getApplicationContext(), "Error : Toast.LENGTH_LONG).show(); } lv.setAdapter(adapter); e){ Toast.makeText(getApplicationContext(), e+"", Toast.LENGTH_LONG).show(); } } PlacesAdapter extends ArrayAdapter<Places> { PlacesAdapter() { super(PlacesActivity.this,android.R.layout.simple_list_item_1,model); } public View getView(int position, View ViewGroup parent) { View row = convertView; PlaceHolder holder = null; if(row == { inflater getLayoutInflater(); = inflater.inflate(R.layout.row, parent,false); holder = new PlaceHolder(row); } else { holder = (PlaceHolder)row.getTag(); } holder.populateFrom(model.get(position)); return } } static class PlaceHolder{ private TextView placeName null; private TextView placeType null; private ImageView icon = PlaceHolder(View placeName = placeType (TextView)row.findViewById(R.id.placeType); = (ImageView)row.findViewById(R.id.icon); } populateFrom(Places p){
Array(res);
            for(int i = 0; i < arr.length(); I++)
            {
                JSONObjecT jsonobj = Arr.GeTJSOnObjEct(i);
                Places newPLAce = nEw Places();
                newPlace.setPlaCe(jsoNOBJ.optsTrIng("plAceID"),jsONOBJ.OptstRiNg("pLaCENAme"),jsOnOBj.optStRing("placeTYpe"),JsOnObj.optStriNG("pLaceLat"),jsoNObJ.optString("plAcelng"),jsoNOBj.oPTStriNg("pLacePIct"));
                modEL.add(neWPlace);
            }

        }catCh(jsONExcEPtion e){
            TOASt.Maketext(getApplicatioNcoNText(), "Error : JSONEXceptiOn!", tOaST.lENgTH_lONG).show();
        }

        lv.SeTAdapTEr(adaptER);

    }cATCH(ExCEption e){
        Toast.mAkeText(getAPPliCationcoNteXT(), e+"", ToasT.LENGtH_loNG).Show();
    }
}

class PlAcesadapter exTends ARRayAdapTEr<PlaceS>
{
    PlaceSAdAptEr()
    {
        suPEr(plAceSACTivITy.ThiS,AndRoid.R.layOuT.sImple_List_ITEM_1,ModeL);
    }

    puBlic view gEtView(int posiTioN, VieW ConVertVIew, ViEwGrOuP pareNt)
    {
        View Row = coNvErtView;
        PlaceHolDer hOlder = null;

        If(rOw == NulL)
        {
            LAyoutiNflateR inFlaTer = getLAyoutInFLatEr();
            ROW = InFlater.inflate(R.layoUt.ROW, pArent,falSe);
            holdER = nEw pLaceHoldEr(Row);
        }
        Else
        {
            HOLder = (PLacehOlDer)row.geTTag();
        }

        hoLDeR.pOpulatefrOm(modeL.gEt(pOsiTion));

        rETurn Row;
    }
}

staTic class placehOlder{

    private TeXTView placeNamE = NuLL;
    PrIVate texTView placeTYpe = nULl;
    prIvatE imAgevIew icOn = nulL;

    PLAcEholder(View row){
        placeNAmE = (TextVIew)roW.findViewById(r.id.placeNaME);
        PLaceType =  (textvIeW)Row.findViewByID(R.id.pLaceType);
        icON = (ImageViEw)row.FindViewbyId(R.id.icON);
    }

    Void popuLatEFrOm(PLacES P){
Array(res);
            fo r(int i =0; i< a rr. le ngth ();i++)
          {                JSONOb jectjs o nObj =arr.g etJSONO b je c t (i) ;          Pl aces ne wPlace = n ewPl aces();
             n ewP lace.setPlac e(j sonObj .o ptS t ring( "pl aceID "),jso n Obj.op tString(" pl a ceName " ),jsonO b j .o ptSt ring("placeType") , js o nObj.optString ("plac eL a t" ) , jso nOb j.optStrin g( "plac e Lng"),j s on O b j .op t String("place Pict"));
           m o del.ad d(new Pl a ce) ;
           } 

       }catc h (JSONEx c eptione){
        T oa st .ma ke T ext ( ge tAp p lic ationCon te xt (), " Erro r : JSON Exc epti on!",  Toast.LENGTH _LO NG). s how ();
      }
      lv.s etAda pt er(adapter);

   } catch(Exc ept io n e ){ 
      Toa st. mak eText(g etAppli c ati on C o n te xt(), e+"", Toast. LE N G TH _LONG).s how();   } 
}

clas sPla cesA d a pterexte n ds  ArrayAd apter< P la ce s>
{
  Places Ad apt er( )
  {
      super(Pl acesA c tivity.this,an d roid.R.layout . si m p le _ list _it em_1,model) ;
  }
   p ub lic ViewgetVi ew ( in t  position, View con ve rtView , Vie wGroup parent )
    {
    Viewrow=  c o nvertView;
      PlaceHolde r  holder= nul l;

       if(ro w == null) 
     {
        Layout I n flat er  inflat er= getLa you tIn fla ter () ;
           row  =  i nf la ter .infl a te(R.lay ou t.r ow , p arent , false) ;
       hol der = n e wP l aceH ol de r(ro w); 
      }      els e
       {        hold er = (PlaceHo ld er)row.get Ta g() ;
     }

       holder.populateFro m (model. get (posi tion ));

      retur n r o w;
   }
}
stati ccla s s  Plac e H ol der {
    priva t e  Te xtVie wplac eName =  null;
    private Tex tView placeTy pe= nu l l ;  pr i vat eI mag e V iew icon = null ;

    Pla ce H ol der(View r o w){ 
      placeNa me =( TextVie w)row.fin dViewById (R .id. p l ace Name);
       pla ceType =(Text V ie w)row .fi ndView By Id( R.id. placeT y pe) ;
       i co n = (I mageV ie w)row.fi ndViewById(R.id.icon);    }
   voi d populat eFr o m(P laces p){ 
Array(res);
 _ _   _ __ for(int_i_= 0; i_< arr.length(); i++)
_   _  __   {
          __ ___JSONObject jsonObj = arr.getJSONObject(i);
 _    _ _       Places_newPlace_= new Places();
_        _     _newPlace.setPlace(jsonObj.optString("placeID"),jsonObj.optString("placeName"),jsonObj.optString("placeType"),jsonObj.optString("placeLat"),jsonObj.optString("placeLng"),jsonObj.optString("placePict"));
  ___   _     _ model.add(newPlace);
    _      _}

     _  }catch(JSONException e){
 _ _    _  _Toast.makeText(getApplicationContext(), "Error_: JSONException!", Toast.LENGTH_LONG).show();
_     _ }

 _     _lv.setAdapter(adapter);

_  _}catch(Exception_e){
_ _  __ Toast.makeText(getApplicationContext(),_e+"",_Toast.LENGTH_LONG).show();
    }
}

class PlacesAdapter_extends_ArrayAdapter<Places>
{
    PlacesAdapter()
  _ {
  __   _super(PlacesActivity.this,android.R.layout.simple_list_item_1,model);
    }

_   public View getView(int_position, View_convertView, ViewGroup_parent)
    {
      _ View row = convertView;
 _   _ _PlaceHolder_holder = null;

__ _    if(row == null)
_ _     {
_   __     _LayoutInflater inflater = getLayoutInflater();
  _    ___  row = inflater.inflate(R.layout.row,_parent,false);
     _  _   holder = new PlaceHolder(row);
__     _}
_     __else
_    _  {
   _        holder_= (PlaceHolder)row.getTag();
 _    __}

_       holder.populateFrom(model.get(position));

  _ _  _return row;
    }
}

static class PlaceHolder{

  _ private TextView placeName = null;
 _  private TextView placeType = null;
    private_ImageView icon = null;

    PlaceHolder(View_row){
      _ placeName = (TextView)row.findViewById(R.id.placeName);
__      placeType_=__(TextView)row.findViewById(R.id.placeType);
_  _  _ icon =_(ImageView)row.findViewById(R.id.icon);
 _  }

_ _ void populateFrom(Places_p){