mercredi 24 décembre 2014

How to call new JSON AsynTask() in the Adapter's getView() on CheckBox click?

I know the JSON parsing. I have A List View and Grid View in same Activity. My List View has Check Box. So I am getting it's click in adapter class. So when I check that Check Box, then A new JSON will call and the data will set in the Grid View. But when I am trying to call the new JSON on setOnCheckedChangeListener(). then I am getting “System services not available to Activities before onCreate()” in onPostExecute().


Here is my code.



checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {

ac = new PhoneAndTabletsActivity();
ac.new SendFilterInfo().execute();


}
});


In postExecute()



@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
phoneTabletAdapter = new PhoneAndTabletAdapter1(
PhoneAndTabletsActivity.this,
R.layout.row_phone_and_tablet1, filterArray);
gridView.setAdapter(phoneTabletAdapter);
}




Aucun commentaire:

Enregistrer un commentaire