Home  >  Q&A  >  body text

How does weex's customized WXComponent on the Android side override the onBackPressed method of the host Activity?

As the title states, the OnBackPressed method of the activity needs to be monitored in the rewritten component. How to implement it in the Component. Do you need to override onActivityBack?

漂亮男人漂亮男人2683 days ago891

reply all(2)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:24:27

    In the Component拿到你要操作的activity instance, then listen to the method you want

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:24:27

    Yes, override the onActivityBack就可以。不过需要注意的是,需要在你的宿主ActivityonBackPressed方法中,调用WXSDKInstanceonActivityBack method.

    reply
    0
  • Cancelreply