简体   繁体   English

单击NavigationBar后退按钮上的Reload活动

[英]Reload Activity on click on NavigationBar Back Button

I am using MikePenz Material Drawer to build a drawer in my xamarin application. 我正在使用MikePenz材料抽屉在xamarin应用程序中构建抽屉。 So far it works great. 到目前为止,效果很好。 URL : Material Drawer URL: 物料抽屉

All my activities are inherited from a BaseActivity, and within this base activity I have initiated the drawer plugin. 我的所有活动都是从BaseActivity继承的,在此基础活动中,我启动了抽屉插件。

But, when I click on the back arrow in the toolbar, I need to reload the previous activity. 但是,当我单击工具栏中的后退箭头时,我需要重新加载上一个活动。 At the moment it loads that activity but the data is not refreshed. 目前,它会加载该活动,但不会刷新数据。

I have overriden the below method for the back button. 我已经为后退按钮覆盖了以下方法。 But what I need to know is how can I start an activity depending on which page its called from. 但是我需要知道的是如何根据活动从哪个页面开始活动。

public bool OnNavigationClickListener (View clickedView)
    {
        this.Finish();
        return true;
    }

Note : The above method is in the base activity. 注意 :上面的方法在基本活动中。

You should update your logics in onResume() of previous activity. 您应该在先前活动的onResume()中更新逻辑。

I am sure that onResume of the visible activity will be called. 我确定将调用可见活动的onResume。

Cheers, 干杯,
Sha

Activities sit in a stack, so when you call finish() it is actually just popping this off of the stack and showing you what is left in the stack. 活动位于堆栈中,因此,当您调用finish()时,实际上只是将其从堆栈中弹出并向您显示堆栈中剩余的内容。 However, it is your responsibility to invalidate the cache at that point. 但是,此时您有责任使缓存无效。 So whatever you are binding to, ie an adapter of some sort or your activity view, should be invalidated. 因此,无论您绑定到什么,即某种适配器或您的活动视图,都应该无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM