Search code examples
androidlistviewandroid-4.0-ice-cream-sandwich

listview not listing on ICS


I'm trying to list json data in a listview. My application works on froyo and blue stacks emulator. But it's not listing anything in ListView on my phone and my friend's phone(both of them are ICS)

ListView list = (ListView) findViewById(R.id.lstEcz);
SimpleAdapter mSchedule = new SimpleAdapter(
        this, nobList, R.layout.nob_eczane, 
        new String[] { "istasyon", "adres", "tel", "ilce" }, 
        new int[] { R.id.tvEczAd, R.id.tvEczAdres, R.id.tvEczTel, R.id.tvEczIlce }
);

list.setAdapter(mSchedule);

Solution

  • public class getInternet extends AsyncTask<String, Void, Void> 
        {
    
    
               @Override
                protected void onPreExecute() 
               {
                   super.onPreExecute();
                   Utils.ShowProgressDialog();
    
               }
    
               @Override
               protected Void doInBackground(String... arg0)
               {
    
                try 
                {
    
                          //your json parsing code...
                } 
                catch (Exception e) 
                {
                 e.printStackTrace();
                }
    
                return null;
               }
    
               @Override
               protected void onPostExecute(Void result)
               {
                   super.onPostExecute(result);
    
                try
                {
                    Utils.hideProgressDialog();
                    list.setAdapter(mSchedule);
                }
                catch (Exception e)
                {
                 Log.v("log", e.toString());
                }
               }
    
      }