the context : i have 2 class, a class Listactivity and another class AudioListActivity in wich i have define a custom arrayadapter. So in the ListActivity with oncreate, i call once my custom arrayadapter with setListAdapter ( MyListAdapter = new .... ) to populate my listview with 10 items. It works well. My problem is that on an onclick, in listactivity : 1/ i call a thread to reload an array with 10 others items ( works well ) 2/ i want to refresh my listview with this array ( without setListAdapter again because i don t want to create another adapter object in memory ). So i have think to notifydatasetchanged(). But when i try MyListAdapter. "completion" it doesn't give notifydatasetchanged. Then how can i do ? how can i notify my arrayadapter to refresh the listview ? need some help ! thank you !
heres Listactivity
ListView ClassListView;
ListAdapter MyListAdapter;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_audio);
ClassListView = getListView();
ClassListView.addFooterView(footer);
//chargement des données de la premiere page de la listview via LA thread
threadChargeListe(0, "PremierePage", "aucun");
setListAdapter(MyListAdapter=new AudioListAdapter(this, 0, MyApplication.getMyArrayDonneesListeAudio()));
//Mise en place des listeners
addListener();
}
private void addListener() {
//listener bouton page suivante
ImageButton MyPageSuivante = (ImageButton) findViewById(R.id.pagesuivante);
MyPageSuivante.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//chargement des données de la page suivante via LA thread
int I = MyApplication.getMyArrayDonneesListeAudio().size();
int idref = MyApplication.getMyArrayDonneesListeAudio().get(I - 1).getIdDemandeAudio(); /* calcul de la ref de l'audio pivot */
chargeListe(idref, "PageSuivante", "aucun");
MyListAdapter. >>>>> HERE i CAN T ACCESS notifydatasetchanged ???
}
});
here are first lines of my arraydapter
public class AudioListAdapter extends ArrayAdapter<DonneesListeAudio> {
// Variables
private Activity activity;
private ArrayList<DonneesListeAudio> DataOfListView;
private static LayoutInflater Inflater = null;
int classPosition = 0;
ViewWrapper Holder;
private long classTimeHeureLecture = 0;
private AsyncTask<Integer, Void, Void> MyAsynchTask;
private AtomicBoolean isThreadRunnning = new AtomicBoolean();
private AtomicBoolean isThreadPausing = new AtomicBoolean();
String classAudioFileName;
//Constructeur
public AudioListAdapter(Activity activity, int textViewResourceId, ArrayList<DonneesListeAudio> _Liste) {
super(activity, textViewResourceId, _Liste);
try {
this.activity = activity;
this.DataOfListView = _Liste;
Inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
} catch (Exception e) {
}
}
//construction de la vue de l'item
public View getView(int position, View convertView, ViewGroup parent) {
classPosition = position;
View ItemView = convertView;
try {
if (convertView == null) { AND SO ON .....