1
@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  setContentView(R.layout.layout_currently);
  if(dHolder.getCurrentItems() == null)
  {
      defineView();
      new LoadCurrent().execute(currentItems);
  }
  else
  {
      try {
          ArrayList<CurrentlyItem> privateCItem = dHolder.getCurrentItems();
          Log.d("ListSize", "There is " + privateCItem.size() + " elements on list");
          int resID = R.layout.current_item;
          Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
          aa = new CurrentAdapter(this, resID, privateCItem, display.getRotation());
          currentListView = (ListView)findViewById(R.id.currentListView);
          currentListView.setAdapter(aa);
          aa.notifyDataSetChanged();
    } catch (Exception e) {
        Log.d(" - ERROR", e.toString());
    }

  }
}

This is a code which should handle screen rotation... Everything works with no error at all but List View doesn't show... I receive ArrayList with 140 elements (reported by Log.d in code) but for some reason List View doesn't show...

Thanks for your answer!

M.V.
  • 1,662
  • 8
  • 32
  • 55
  • can you post the `getView` method of your extended `ArrayAdapter`? – techi.services Apr 22 '11 at 09:44
  • It is a quite long code, but it works perfectly if called onCreate ... Can you please tell me which part of the code is relavant... – M.V. Apr 22 '11 at 10:15
  • I believe is is problem in filling old activity's data... – M.V. Apr 22 '11 at 10:17
  • 1
    If your UI is mostly a `ListView`, you should not be using `onConfigurationChanged()`, anyway. Please remove the `android:configChanges` attribute from your manifest and use `onSaveInstanceState()` and `onRetainNonConfigurationInstance()` to pass your model data (e.g., list contents) and such from the old activity instance to the new one. – CommonsWare Apr 22 '11 at 11:10

0 Answers0