java如何在活动中显示通过服务获得的数据?
我有一个从网上下载一些数据的服务,但当我试图将其传递给活动并向用户显示时,我收到以下错误:
E/JavaBinder:!!!活页夹事务失败
// This gets populated in the server based on information from a server.
byte[] downloadedData;
// Instantiated downloadedData from server connection, code removed for brevity.
// Try to start activity with downloaded data.
Intent i = new Intent(this, MainActivity.class);
i.putExtra("DATA", downloadedData);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
# 1 楼答案
试试看
1在活动中注册自定义广播接收器
2从您的服务发送广播