gramyang
V2EX  ›  Android

android 报 ActivityThread: handleWindowVisibility: no activity for token

  •  
  •   gramyang · Dec 3, 2019 · 18036 views
    This topic created in 2368 days ago, the information mentioned may be changed or developed.

    android 用我自己写的 socket 连接,返回的信息用 eventbus 发送到 activity 上触发回调信息。

    因为报 ActivityThread: handleWindowVisibility: no activity for token 的错误,导致 eventbus 收不到信息。

    版本为 28,最低版本 21。BaseActivity 的代码如下: import android.support.v7.app.AppCompatActivity; public abstract class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        unbinder = ButterKnife.bind(this);
        init();
    }
    

    只要是继承了这个 BaseActivity 的 activity 都会报这个错。。。。

    在网上查了半天没头绪,实在没招了,求助万能的 v 友!!

    Supplement 1  ·  Dec 3, 2019
    发现原因了。。。。Android Q 对 startactivity 的限制。。。。
    心累
    1 replies    2019-12-03 19:01:57 +08:00
    jerry12547
        1
    jerry12547  
       Dec 3, 2019
    android10 限制蛮多的 获取设备 id 就直接炸了不少老项目
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1557 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:37 · PVG 00:37 · LAX 09:37 · JFK 12:37
    ♥ Do have faith in what you're doing.