【问题标题】:Re-Render my RecyclerView causes Slowness重新渲染我的 RecyclerView 导致缓慢
【发布时间】:2019-03-19 19:14:13
【问题描述】:

我有一个 我运行Get(来自HttpOk)并将itens发送到RecyclerView的活动A。 一切都在第一次运行良好:onCreate、Start、Resume 等。 因此,用户选择他想要“购买”的项目,我通过 Intent (JSONObject.toString) 传递它:

 startActivity(
     new Intent(this, CompraCreditoAVista.class)
        .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
        .putExtra("fromListaProdutos", true)
        .putExtra("infos", infosVenda)
        .putExtra("total", total)
 );
this.finish();

但是,在那之后,当我从一个包含 RecyclerView 的活动之前启动另一个 Intent 时,例如:在 CompraCreditoAVista 上放置一个按钮以重复操作(或将相同的参数传递给 CompraCreditoAVista 的 onBackPressed())应用程序变为更慢,recyclerView 需要 3-4 倍的时间来加载,并且像换屏(另一个意图)这样的功能也变得更慢。

在 NEW_TASK / CLEAR_TASK(和 finish())之后,活动所花费的时间与他第一次渲染时所花费的时间相同吗?

【问题讨论】:

  • 如果活动正在结束,那么我不认为它正是因为你的想法。在我看来,您应该只使用调试器。众所周知,您的第二次使用会导致一些长时间运行的循环。

标签: android performance android-recyclerview


【解决方案1】:

活动标签:

android:hardwareAccelerated="true"

是什么导致我的应用程序运行缓慢,为什么?连我都不知道。

【讨论】:

    猜你喜欢
    • 2020-11-16
    • 2018-12-03
    • 2021-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    相关资源
    最近更新 更多