3

I am new in android and working on app.help me in this.My Log is here

  Could not dispatch event: class com.shalom.shalombase.event.RequestPurchaseEvent to handler [EventHandler public void com.shalom.shalombase.activity.MainActivity.onRequestPurchaseEvent(com.shalom.shalombase.event.RequestPurchaseEvent)]: null
        at com.squareup.otto.Bus.throwRuntimeException(Bus.java:456)
        at com.squareup.otto.Bus.dispatch(Bus.java:386)
        at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:367)
        at com.squareup.otto.Bus.post(Bus.java:336)

Myfragment subcriptionfragment that is posting event to main activity.

  public class SubscribeFragment extends ShalomBaseFragment {


private Button subscribeLayout;
private LinearLayout subscribebuttonslayout;
private FrameLayout sampleframe;
private RelativeLayout subscribelayout;
View progressLayout;


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    return inflater.inflate(R.layout.subscribe_layout, container, false);
}

@Subscribe
public void onStoreProgressEvent (StoreProgressEvent event) {

    if(event!=null&&progressLayout!=null)
    {

        if(event.isInProgress)
            progressLayout.setVisibility(View.VISIBLE);
        else
            progressLayout.setVisibility(View.GONE);

    }
}


@Override
public void onViewCreated(View view, Bundle savedInstanceState) {

    super.onViewCreated(view, savedInstanceState);
    initialize(view);

    subscribebuttonslayout.setVisibility(View.VISIBLE);
    subscribelayout.setVisibility(View.VISIBLE);

    subscribeLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            bus.post(new RequestPurchaseEvent(BaseConstants.YEARLY_SUBSCRIPTION));

        }
    });

    getChildFragmentManager().beginTransaction()
            .replace(R.id.sample_frame, new LibrarySamleIssueFragment())
            .commit();



 }

private void initialize(View view) {

    subscribeLayout = (Button) view.findViewById(R.id.button1);
    subscribebuttonslayout = (LinearLayout) view.findViewById(R.id.subscribe_buttons_layout);
    sampleframe = (FrameLayout) view.findViewById(R.id.sample_frame);
    progressLayout = (View) view.findViewById(R.id.progress_layout);
    subscribelayout = (RelativeLayout) view.findViewById(R.id.subscribe_layout);
}



  }

Please help me in this.It is working fine on S3, but it is creating issue on Nexus7. I dont what is the problem with code.I am confused in this

Nadeem Yousaf
  • 563
  • 10
  • 31

1 Answers1

2

otto code :

method.invoke(target, event);

the next operation is:

@Subscribe
public void yourMethod(Event event) {
    //your code throw exception
}

your Method throw exception catched by otto

so, this is my condition.

cp Zheng
  • 21
  • 5