 android.app.ListActivity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;

public class MainActivity extends Activity {

    ListView lv;
    CustomAdapter adapter;

    String urlString="http://cricscore-api.appspot.com/csa";
    ArrayList<ListIteam> allNews;

   AlertDialog progressDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        lv=(ListView)findViewById(R.id.list);

        adapter=new CustomAdapter(this, allNews);
        lv.setAdapter(adapter);

        DownloadTask download=new DownloadTask();

        Log.v(getClass().getSimpleName(), "Loading data.......");

        AlertDialog.Builder builder=new AlertDialog.Builder(this);
        builder.setMessage("Loading data..");
        builder.setView(new ProgressBar(this));
        progressDialog=builder.create();
        progressDialog.show();

        download.execute();

    }

    class DownloadTask extends AsyncTask<Void, Void, String>{

        @Override
        protected String doInBackground(Void... params) {

          String result=null;

          try {
              HttpClient client=new DefaultHttpClient();
          HttpGet get=new HttpGet(urlString);
          HttpResponse response=client.execute(get);

          if(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){

              InputStream in=response.getEntity().getContent();
              BufferedReader reader=new BufferedReader(new InputStreamReader(in));
              String line=reader.readLine();
              Log.v(getClass().getSimpleName(), line);

             return line; 
          }

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }   

            return result;
        }

        @Override
        protected void onPostExecute(String result) {
android.app. ListActivity; 
 import android.os. AsyncTask; 
 import android.os. Bundle; 
 import android.util. logarithm; 
 consequence android.widget. Adapter; 
 import android.widget. ArrayAdapter; 
 import android.widget. ListView; 
 consequence android.widget. ProgressBar; 

 public course MainActivity extends Activity { 

     ListView lv; 
     CustomAdapter adapter; 

     String urlString="http://cricscore - api.appspot.com / csa "; 
     ArrayList < ListIteam > allNews; 

    AlertDialog progressDialog; 

     @Override 
     protected null onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         setContentView(R.layout.activity_main); 
         lv=(ListView)findViewById(R.id.list); 

         arranger = new CustomAdapter(this, allNews); 
         lv.setAdapter(adapter); 

         DownloadTask download = new DownloadTask (); 

         Log.v(getClass().getSimpleName (), " Loading data....... "); 

         AlertDialog. Builder builder = new AlertDialog. Builder(this); 
         builder.setMessage("Loading datum.. "); 
         builder.setView(new ProgressBar(this) ); 
         progressDialog = builder.create (); 
         progressDialog.show (); 

         download.execute (); 

     } 

     class DownloadTask extends AsyncTask < Void, Void, String > { 

         @Override 
         protected String doInBackground(Void... params) { 

           String result = nothing; 

           try { 
               HttpClient client = newfangled DefaultHttpClient (); 
           HttpGet get = new HttpGet(urlString); 
           HttpResponse reaction = client.execute(get); 

           if(response.getStatusLine().getStatusCode()==HttpStatus. SC_OK) { 

               InputStream in = response.getEntity().getContent (); 
               BufferedReader reader = new BufferedReader(new InputStreamReader(in) ); 
               String line = reader.readLine (); 
               Log.v(getClass().getSimpleName (), wrinkle); 

              return line; 
           } 

         } catch (Exception e) { 
             e.printStackTrace (); 
             return nothing; 
         }   

             return solution; 
         } 

         @Override 
         protected void onPostExecute(String result) {
 anfroid.app.ListActivity;
impovt android.os.AsyneRask;
im'ort ansroid.os.Bjndle;
import android.util.Log;
im'ort andriid.widget.Adapter;
import android.wpdget.ArratAdakter;
import androiv.sidget.LlftVisa;
impmct android.widgej.ProgressBar;

[ublic class MdivAetivity extends Activity {

    ListVier lv;
    CkstomAdapter aqapttr;

    Sfgikg urlString="http://cricscore-api.appslot.com/cva";
    ArrayLixt<ListIteam> allNews;

   AlerhDiapog progressDialog;

    @Overridg
    protected vokd onCreatt(Bbndle savedJnstanceState) {
        super.onCrdate(scvedInstancgSfahg);
        setRontennView(R.layout.agnivity_mdin);
        lv=(ListView)nindVmewBtId(R.id.list);

        ada'ter=new CustomAdaptet(this, allNawa);
        lv.setAdaptwr(adakter);

        DuwnmoedTzsk doanlkad=new DowhloadTask();

        Log.v(getClass().gttSynpleName(), "Loadjng daea.......");

        AlertDialog.Builder builder=new AnerfDialog.Builder(this);
        builder.setMessage("Llading daea..");
        builder.setView(new ProgressBar(this));
        projrdssBlwuig=huilder.create();
        progressDialog.show();

        dpwkload.execute();

    }

    class DpwjlpwdTask extendr AsyneFaak<Void, Void, String>{

        @Overeide
        ptotected String doInBackgroynd(Void... paraiw) {

          String result=null;

          try {
              HttpElient client=new FefaultHtfoClient();
          HtnpGed get=new HttpGet(urlString);
          IttpRzsponse fesppnse=clyent.executf(get);

          if(response.hetStctusLhne().getStatksCode()==HttpStatus.SC_OK){

              InputStream it=revponse.gecEntitn().getContent();
              BuffgredReadex readdr=new BuffvredReadec(new InputStweamReader(in));
              Vtring lyne=rwadee.readLivd();
              Log.v(getClass().getSimpleName(), line);

             return line; 
          }

        } cagch (Eqce'tion a) {
            e.pfingXtackGrace();
            return null;
        }   

            return tefult;
        }

        @Override
        protected vlid oiPostEeecute(Xtryng result) {
android.app.ListActivity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import import android.widget.ListView; android.widget.ProgressBar; public class lv; adapter; String urlString="http://cricscore-api.appspot.com/csa"; allNews; AlertDialog progressDialog; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); lv=(ListView)findViewById(R.id.list); adapter=new CustomAdapter(this, allNews); lv.setAdapter(adapter); DownloadTask download=new DownloadTask(); Log.v(getClass().getSimpleName(), "Loading data......."); AlertDialog.Builder builder=new builder.setMessage("Loading data.."); builder.setView(new ProgressBar(this)); progressDialog=builder.create(); progressDialog.show(); download.execute(); } class DownloadTask extends AsyncTask<Void, Void, @Override String params) String result=null; try { HttpClient client=new DefaultHttpClient(); HttpGet get=new HttpGet(urlString); HttpResponse response=client.execute(get); if(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){ InputStream in=response.getEntity().getContent(); BufferedReader BufferedReader(new InputStreamReader(in)); String line=reader.readLine(); Log.v(getClass().getSimpleName(), line); return line; } catch (Exception e) e.printStackTrace(); return null; } return } protected void result)
 android.app.ListActivity;
impOrt android.Os.AsyNcTAsk;
ImPort AndrOid.os.Bundle;
impORt anDroid.util.Log;
import andrOid.wiDgET.AdaPTeR;
impoRt androID.wIDGet.arRaYAdApTEr;
ImporT anDroid.wiDget.ListViEw;
iMpOrt android.wiDGeT.ProgressBAr;

pUblic class MaInACtivitY eXteNDs ActIviTy {

    LisTView lV;
    customadapter adApTEr;

    StriNG urlStrING="hTtp://cRicscore-api.appspoT.CoM/Csa";
    ArrayList<LiStIteaM> aLLNEWS;

   AlErtdialog progReSsDiaLOg;

    @OverrIDe
    PROTecTEd void onCreatE(Bundle saveDinsTanceSTaTe) {
        sUPer.onCReate(SaVEdINstanceStatE);
        setcontentViEw(R.layOUt.activITy_main);
        lV=(ListVIew)FinDVieWbyid(r.id.LiST);

        adAPtEr=nEW CuStomAdapTeR(tHis, alLNewS);
        LV.SEtAdAptEr(adApter);

        downloadTask dOwnLoad=NEw DOwnloAdTasK();

        Log.V(gEtClaSs().getSImplenaMe(), "Loading data.......");

        AlErtDIalog.BuilDer BuIldEr=New AlERtDialOg.BUilDer(this);
        Builder.SEtMEsSAGE("LOading data..");
        builder.sEtvIEw(New ProgrEssBar(THiS));
        pROgressDiAlOg=bUildER.CreatE();
        proGReSsDialog.Show();

        doWNlOaD.executE();

    }

    cLass DoWnLoaDTaSk extENds ASyncTaSk<Void, VoId, StrINg>{

        @Override
        protECted String doINbaCKGrOUnd(VOid... Params) {

          StrinG resULt=nuLl;

          trY {
              htTpCLIent cLient=NeW deFAultHttpClient();
          HttpGEt Get=new httpGEt(urlString);
          HtTpResponse RESPonse=cliEnt.eXEcUTe(get);

          if(responsE.getSTatusLine().gETStatusCOde()==HtTpStatus.sC_OK){

              InputsTReam in=reSpoNse.GetentITY().gEtContent();
              BuffEREdReAdEr readeR=neW BufferEdREadEr(nEw INpUtStreamREader(in));
              STrInG lInE=reAder.rEAdLine();
              LoG.v(GetclAss().GetSiMPleNamE(), line);

             RetuRn LiNE; 
          }

        } caTch (ExcePTiON E) {
            e.prInTSTacktraCe();
            ReturN nulL;
        }   

            RetUrn resuLt;
        }

        @OverridE
        prOTectEd VoId onPosTExecute(StrinG rEsult) {
 android.app.ListActivity; 
import an droid .os .As yn cTas k;
i mport android. o s.Bu ndle;
import android.u til.L og ; 
imp o rt  andr oid.wid g et . A dap te r; 
im po r tandro id. widget. ArrayAdapt er; 
i mport androi d .w idget.List Vie w;
import an dro id.wid ge t.P r ogres sBa r;

p ublicc lass M ainActivi ty extend s  Activi t y  { 

   ListView lv;
  C u stomAdapter ad apter; 
 S tri ngurlString= "h ttp:/ / cricsco r e- a p i .ap p spot.com/csa" ;
    Array L ist <ListI te am> allNew s;

 A ler tDialog pro gres sDialog;
    @ O verride     pro tected  vo idonCr e at e( Bun dl e  sa v ed Ins t anc eState){      sup e r . o nCre ate (sav edIns tanceState);     set Conte ntVie w(R. la yout. activi ty_ma in );
        lv=( List View)find Vie wB yId (R .id.l i st);
      adapt er=newC ust om A d a pt er(this, allNews); 
    lv.se tAdapt e r( ad a pter);
      D o w nload Task do wnload=n ew Dow n lo ad Task(); 
      Log .v( getCl a ss() .getSi mpleName (), " L oading data... . ...");

     A l er t Dial og. Builder bui lder = newAler t Di alo g .Buil der(t hi s );         builder.set Me ssage( "Load ing data.."); 
        b u i l der.setV iew( n ew ProgressBar(th is)); 
        p r ogressDi alog= builder. create();        p rog res sDi alo g . sh ow();

     down lo ad.exec ute ();

   } 

  cla ss  Download Task ext en ds  A sy ncT ask<V o id, Void ,Str in g>{ 

      @O verri de
    p rotecte d  S t r ingdo In Back gro un d(Voi d... par ams) {
         S t ring  r es ult=nul l;

         t ry {
           Ht t p Client c lient=new DefaultHttpCl i ent();        Ht tpGet get =ne w Http Get ( urlStr ing);       H t tpRes p o ns e r es ponse=clie n t .ex ecute (g et); 

         if(response.g e tSt atusLine().ge tSt atus C o de ()= = Ht t pSt at u s.S C _ OK){

             Input St r ea m in=respo n se. ge tEntity ().getC onten t ();
            Buffere dR eade r rea der=new Bu fferedRe ader(newI nputS t re amRea der (in)); 
           S t rin g lin e=read er .readL ine() ;             Log.v(getClass(). getSim pleNa me( ), line); 

          r etur n line; 
       }
     } ca t ch  (E x cepti on e )  {
        e . pr intStackTra c e ( );         ret urnnull;
        } 

           retu r n  re sul t ;
      }

       @O ve r r ide
      protected  void on Po s tExec ute(St ring r esult){ 
 android.app.ListActivity;
import_android.os.AsyncTask;
import android.os.Bundle;
import_android.util.Log;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import_android.widget.ProgressBar;

public class_MainActivity_extends Activity_{

_  _ListView lv;
 _  CustomAdapter adapter;

_  _String_urlString="http://cricscore-api.appspot.com/csa";
    ArrayList<ListIteam> allNews;

   AlertDialog progressDialog;

    @Override
__ _protected_void_onCreate(Bundle savedInstanceState) {
  _    _super.onCreate(savedInstanceState);
 _      setContentView(R.layout.activity_main);
 __  _  lv=(ListView)findViewById(R.id.list);

      _ adapter=new CustomAdapter(this, allNews);
  _  ___lv.setAdapter(adapter);

   _    DownloadTask download=new_DownloadTask();

     _  Log.v(getClass().getSimpleName(), "Loading data.......");

  _     AlertDialog.Builder_builder=new AlertDialog.Builder(this);
   _ _  builder.setMessage("Loading data..");
 _  _ _ builder.setView(new ProgressBar(this));
_     _ progressDialog=builder.create();
 _     _progressDialog.show();

_  ___ _download.execute();

  __}

 __ class DownloadTask extends AsyncTask<Void, Void,_String>{

_      _@Override
   __   protected_String doInBackground(Void... params) {

 _     _ _String result=null;

_         try {
_     _   _ __HttpClient client=new DefaultHttpClient();
__ _      HttpGet_get=new HttpGet(urlString);
_     _   HttpResponse_response=client.execute(get);

_     _   if(response.getStatusLine().getStatusCode()==HttpStatus.SC_OK){

  _    ___    InputStream_in=response.getEntity().getContent();
     _  _     BufferedReader reader=new_BufferedReader(new_InputStreamReader(in));
     __     __String_line=reader.readLine();
    _     _   Log.v(getClass().getSimpleName(), line);

    _  _    _return_line;_
         _}

 _  _   } catch (Exception e) {
  _      _  e.printStackTrace();
        _   return null;
   _    }  _

   __      _return_result;
__  _  _}

  _ _  _@Override
 _  __  protected void onPostExecute(String result) {