title: No data in listview on device rotation
body: <p>Once the data is loaded and all set now if i rotate the device the list view is gone and there is no more data i have to restart the app to load data,but when device is offline and i load data just from table it retains the data even on rotation</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks&lt;Boolean&gt;{
  
  Toolbar tb;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      initilize();
      setSupportActionBar(tb);
      tb.setTitleTextColor(getResources().getColor(R.color.white));
      ConnectivityManager cm = (ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE);
      NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
      boolean isConnected = activeNetwork != null &amp;&amp; activeNetwork.isConnectedOrConnecting();
      if(isConnected){
          loadData();
      }else {
          Snackbar bar = Snackbar.make(findViewById(android.R.id.content), getResources().getString(R.string.noint), Snackbar.LENGTH_INDEFINITE).setAction("Dismiss", new View.OnClickListener() {
              @Override
              public void onClick(View v) {
              }
          });
          bar.show();
      }
      getSupportFragmentManager().beginTransaction().add(R.id.main_list,new lvfrag()).commit();
  }
  
  private void initilize() {
      tb = (Toolbar)findViewById(R.id.main_toolbar);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater mi = getMenuInflater();
      mi.inflate(R.menu.main_menu, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      int id = item.getItemId();
      switch (id)
      {
          case R.id.menu_refresh :
              break;
          case R.id.menu_setting :
              Intent is = new Intent(MainActivity.this,Prefs.class);
              startActivity(is);
              break;
          case R.id.menu_about:
              AlertDialog.Builder adb = new AlertDialog.Builder(this);
              adb.setTitle(getResources().getString(R.string.app_name));
              adb.setMessage(getResources().getString(R.string.abt));
              adb.create();
              adb.show();
              break;
      }
      return true;
  }
  
  @Override
  public Loader&lt;Boolean&gt; onCreateLoader(int id, Bundle args) {
      return new Loade(this);
  }
  
  @Override
  public void onLoadFinished(Loader&lt;Boolean&gt; loader, Boolean data) {
      setd(data);
  }
  
  private void setd(Boolean data) {
  }
  
  
  @Override
  public void onLoaderReset(Loader&lt;Boolean&gt; loader) {
  }
  
  private void loadData() {
      if(getSupportLoaderManager().getLoader(0) == null) {
          getSupportLoaderManager().initLoader(0, null, this).forceLoad();
      } else {
          getSupportLoaderManager().restartLoader(0, null, this).forceLoad();
      }
  }
  
  public static class lvfrag extends Fragment implements LoaderManager.LoaderCallbacks&lt;Cursor&gt;{
  
      CustomA ca;
      ListView lv;
      private static final int mId = 1001;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          Log.v("Added","");
          View v = inflater.inflate(R.layout.list_vw,container,false);
          ConnectivityManager cm = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
          NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
          boolean isConnected = activeNetwork != null &amp;&amp; activeNetwork.isConnectedOrConnecting();
          lv = (ListView)v.findViewById(R.id.frag_list);
          if(isConnected){
              getActivity().getContentResolver().delete(weathertable.mContentUri,null,null);
              ca = new CustomA(getActivity(),null);
              lv.setAdapter(ca);
              loadfData();
              lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      Intent dt = new Intent(getActivity(),Detail.class);
                      dt.setData(Uri.withAppendedPath(weathertable.mContentUri,String.valueOf(id)));
                      getActivity().startActivity(dt);
                  }
              });
          }else {
              Cursor c = getActivity().getContentResolver().query(weathertable.mContentUri,null,null,null,null);
              ca = new CustomA(getActivity(),c);
              lv.setAdapter(ca);
              lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      Toast.makeText(getActivity(),getResources().getString(R.string.cnt),Toast.LENGTH_SHORT).show();
                  }
              });
          }
          return v;
      }
  
      @Override
      public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) {
          switch (id){
              case mId:
                  return new CursorLoader(getActivity(),weathertable.mContentUri,null,null,null,null);
          }
          return null;
      }
  
      @Override
      public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {
          ca.swapCursor(data);
      }
  
      @Override
      public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
          ca.swapCursor(null);
      }
  
      private void loadfData() {
          if(getActivity().getSupportLoaderManager().getLoader(mId) == null) {
              getActivity().getSupportLoaderManager().initLoader(mId, null, this).forceLoad();
          } else {
              getActivity().getSupportLoaderManager().restartLoader(mId, null, this).forceLoad();
          }
      }
  
  }
  </code></pre>
  
  <p>}</p>