1

I am calling a Async task present in other fragment on check box listener from some other fragment customview. Here is my code:

     OnCheckedChangeListener myChangeListener = new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                int checkedRow = (Integer) buttonView.getTag();
                int itemid = fetchedNewPick.get(checkedRow).getItemTypeId();
                int actionid = fetchedNewPick.get(checkedRow).getItemActionId();
                String serial = fetchedNewPick.get(checkedRow).getItemSerial();
                String itemRemark = fetchedNewPick.get(checkedRow).getItemRemark();
                Log.i("values", itemid+" " +actionid +" " + serial + itemRemark);

        "I want myAsyc called here"
                if(postStatus.contains("Success")){
                    dbController.deleteNewPickStatus(context, serial);
                    Setting_Fragment.updateArraylist(checkedRow);
                    notifyDataSetChanged();
                }
                }
            }
        };

I tried to write something like this: new MyAsyc(context).execute(); But didn't work.

user3740085
  • 244
  • 1
  • 9
  • I think that the asynctask is an inner class of your fragment and you are trying to call it from a class in another file have a look at this and you will fiqure out how to do it http://stackoverflow.com/questions/70324/java-inner-class-and-static-nested-class – Illegal Argument Jun 15 '14 at 17:43
  • I have nothing to do with static..neither I want my asyntask to be static. – user3740085 Jun 15 '14 at 17:56

1 Answers1

0

I normally use event bus for communicating between fragments with Square Otto or Greenrobot Eventbus would be the choices.

Yogesh Narayanan
  • 866
  • 7
  • 10