title: Android programming: I cant get data to reload into arrayadapter
body: <p>I am still stuck with this issue, can anyone help. It seems that my problem is that I cant update the data list. I have tried every solution that I've searched for on google etc.. but half the time i'm not even sure that I'm doing the correct thing.</p>
  
  <p>I've used the onResume() to call notifyDataSetChanged, it didn't work. I've tried putting a refresh method into the adapter which i then called in OnResume(). Again it didn't work. Some people suggest clearing the adpater (adapter.clear();) in onResume and then using the addAll() function to relist the data but nothing works.</p>
  
  <p>There has to be a simple solution to this. I have literally been stuck on this for 2 days now. very frustrated.</p>
  
  <p>Here's my Fragment code again...</p>
  
  <pre><code>enter code here
  
  public class SavedAppFragment extends ListFragment {
  
  private static final String TAG = "AppClicked"; //DEBUGGER
  
  private ArrayList&lt;App&gt; mSavedApps;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  //Populate the ArrayList
     mSavedApps = SavedAppData.get(getActivity()).getApps();
  
  
    AppAdapter adapter = new AppAdapter(mSavedApps);
    setListAdapter(adapter);
  
  }
  
  //LIST ITEM CLICKED: /*Control what happens when list item is clicked: I.E. Load up a quiz while putting an EXTRA key containg the package name of the App to be launhced should the user get the question correct */ @Override public void onListItemClick(ListView l, View v, int position,long id) { //Return the crime for the list item that was clicked App c = ((AppAdapter) getListAdapter()).getItem(position); Log.d(TAG, "was clicked");
  
          //Start the Activity that will list the detail of the app
          Intent i = new Intent(getActivity(), Quiz_Activity.class);
          String name = c.getPackage();
          i.putExtra("packagename", name);
          startActivity(i);
  }
  
  private class AppAdapter extends ArrayAdapter {
  
      private ArrayList&lt;App&gt; mSavedApps;
  
      public AppAdapter(ArrayList&lt;App&gt; apps) {
  
          super(getActivity(), 0, apps);
  
      }
  
  
  
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          //If we weren't given a view, inflate one
          if (null == convertView) {
              convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_app, null);
              //((AppAdapter) getListAdapter()).notifyDataSetChanged();
          }
  
          ((AppAdapter) getListAdapter()).notifyDataSetChanged();
          //Configure the view for this crime
          App c = getItem(position);
  
  
              TextView nameTextView = (TextView) convertView.findViewById(R.id.app_name);
              nameTextView.setText(c.getName());
              // nameTextView.setText(applicationInfo.loadLabel(packageManager));
  
  
              TextView packageTextView = (TextView) convertView.findViewById(R.id.app_package);
              packageTextView.setText(c.getPackage());
  
  
  
              CheckBox appCheckBox = (CheckBox) convertView.findViewById(R.id.app_checked);
              appCheckBox.setChecked(c.isChecked());
  
  
              //Return the view object to the ListView
              return convertView;
  
  
      }
  
  }
  
  }
  </code></pre>
  
  <p>THANKS!!!</p>