Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个线程 A 与串行设备连接蓝牙。当活动重新启动(屏幕旋转示例)时,线程与活动一起死亡,因此连接蓝牙结束。是否有一种方法可以在活动重新启动时使线程 A 存活或在连接蓝牙中存活?没有使用服务,我的老师告诉我不要将它用于此应用程序。
用来onRetainNonConfigurationInstance()保留你的线程。请参阅涵盖此案例的本教程。
onRetainNonConfigurationInstance()