小编Ope*_*aus的帖子

在popBackStack之后调用哪种方法?

我有一个活动,我打电话给三个碎片 - 每个碎片相互依赖:

A(ctivity) - > f1(片段1,标题{是|应该}:列表) - > f2(片段2,标题{是|应该}:概述) - > f3(片段3,标题{是|应该}:详情)

ATM我使用以下方法调用向后跳转:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            FragmentManager fragmentManager = getSupportFragmentManager();
            if (fragmentManager.getBackStackEntryCount()>0){
                fragmentManager.popBackStack();
            }
    }
}
Run Code Online (Sandbox Code Playgroud)

这很好用.

我在每个片段中覆盖ActionBar标题,如下所示:

ActionBar bar = getSherlockActivity().getSupportActionBar();
bar.setTitle(R.string.title_f3);
Run Code Online (Sandbox Code Playgroud)

当向前导航时(如上所示),这可以完美地工作但向后导航ActionBar的标题没有更新:

f3(title {is | should}:detail) - > f2(title {is}:detail,{should}:overview) - > f1(title {is}:detail,{should}:list)

显然,我可以在显示片段时再次更新它.但是我的调试器永远不会停留在任何方法中,除非像onResume()那样调用.

那么在popBackStack()之后实际上是否在前一个片段中调用了任何方法?

java android android-fragments

25
推荐指数
2
解决办法
2万
查看次数

如何使用项目提供程序功能从 Bootstrap-Vue 异步更新 b 表中的项目?

我正在使用 Bootstrap-Vue v2.0.0-rc.11,但我无法理解如何更新表格内容。我相信这是微不足道的。

我正在使用项目提供程序功能从后端提取我的内容。

        <b-table
                 :items="myProvider"
        >
Run Code Online (Sandbox Code Playgroud)

初始调用使用以下方法可以正常工作。

export default {
    methods: {
        myProvider(ctx) {
            let promise = axios.get('/backend?currentPage=' + ctx.currentPage);

            return promise.then((response) => {
                return(response.items || []);
            });
        },
Run Code Online (Sandbox Code Playgroud)

要复制一个行项目,我打开一个模式来输入一个新名称。我为重复工作做了一个后端调用,效果很好。现在我想刷新显示新项目的表格中显示的内容。我该怎么做呢?

我能想到的最简单的方法是再次调用项目提供程序函数(此处:'myProvider')。我可以从模态中做到这一点,但我无法提供正确的参数(此处:'ctx')。

是否有触发/发出事件以重新发出后端调用?

我试过这样的事情:

this.$refs.nameOfTable.$forceUpdate()

this.$refs.nameOfTable.$emit('XXX') // XXX = placeholder for various events
Run Code Online (Sandbox Code Playgroud)

任何提示表示赞赏!谢谢你。

javascript vue.js bootstrap-vue

14
推荐指数
1
解决办法
1万
查看次数

如何通过ContentResolver调用ContentProvider中的自定义方法,然后访问Bundle?

save()在自定义ContentProvider类中有一个自定义方法MyContentProvider,我想通过ContentResolver调用它.目标是将POJO作为Bundle传递给MyContentProvider.

我现在用的call是提到的方法在这里和定义在这里.

我没有得到任何错误.该方法无法访问.

使用自定义方法的(缩短的)自定义ContentProvider如下所示:

public class MyContentProvider extends ContentProvider {

    public void save() {

        Log.d("Test method", "called");
    }
}
Run Code Online (Sandbox Code Playgroud)

我称之为:

ContentResolver contentResolver = context.getContentResolver();
Bundle bundle = new Bundle();
bundle.putSerializable("pojo", getPojo());
contentResolver.call(Contracts.CONTENT_URI, "save", null, bundle);
Run Code Online (Sandbox Code Playgroud)

为什么这个save方法永远不会被调用,如果我到达这一点,我如何在save()方法中访问被调用的Uri和Bundle ?我无法在SO或网络上找到任何参考资料.

谢谢您的回答!

android android-contentresolver android-contentprovider

9
推荐指数
1
解决办法
6887
查看次数

如何在MultiCore设置中使用Solr的MoreLikeThis功能?

因此,我使用MultiCore功能设置Solr具有多个内核,该功能正常:

http://localhost:8080/solr/core_one/select/?q=Book
Run Code Online (Sandbox Code Playgroud)

按预期工作并列出结果.

现在,我想要做的就是将相同的查询发送到Solr,启用MoreLikeThis:

http://localhost:8080/solr/core_one/select/?q=Book&mlt=true&mlt.fl=category
Run Code Online (Sandbox Code Playgroud)

在org.apache.solr.schema.FieldType.storedToIndexed中获得HTTP状态500 - null java.lang.NullPointerException.mlt.fl的字段存在.有趣的是,如果我查询没有任何结果的东西,Solr会正确返回一个空的结果集.

这是一个错误还是我错过了什么?

这是完整的堆栈跟踪:

HTTP Status 500 - null java.lang.NullPointerException at
org.apache.solr.schema.FieldType.storedToIndexed(FieldType.java:360) at
org.apache.solr.handler.MoreLikeThisHandler$MoreLikeThisHelper.getMoreLikeThis(MoreLikeThisHandler.java:320) at
org.apache.solr.handler.component.MoreLikeThisComponent.getMoreLikeThese(MoreLikeThisComponent.java:82) at
org.apache.solr.handler.component.MoreLikeThisComponent.process(MoreLikeThisComponent.java:57) at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:194) at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129) at
org.apache.solr.core.SolrCore.execute(SolrCore.java:1368) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356) at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864) at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665) at java.lang.Thread.run(Thread.java:679)
Run Code Online (Sandbox Code Playgroud)

solr full-text-search morelikethis

3
推荐指数
1
解决办法
750
查看次数