java.lang.RuntimeException:无法恢复Android活动

时间:2013-03-19 19:01:02

标签: android android-tabhost

我正在尝试获取设备的蓝牙地址,所以当我点击发送

startActivityForResult(new Intent(getApplicationContext(),
                        DeviceListActivity.class), GET_DEVICE_TO_SEND);

通过蓝牙文件发现启动时,我选择了一个已创建的设备

onActivityResult 我有这些代码

if (requestCode == GET_DEVICE_TO_SEND && resultCode == RESULT_OK) {
String device = data
.getStringExtra(DeviceListActivity.DEVICE_ADDRESS);
String name = data.getStringExtra(DeviceListActivity.DEVICE_NAME);

调用函数onActivityResult,然后调用应用程序stopp

班级:MainUI包含Tabhost。

班级:FilesUI是函数onActivityResult所在的位置

日志

03-19 18:39:28.858: E/AndroidRuntime(22817): java.lang.RuntimeException: Unable to resume activity {com.android.Connect/com.android.Connect.UI.MainUI}: java.lang.RuntimeException:`enter code here` Failure delivering result ResultInfo{who=Files, request=1, result=-1, data=Intent { (has extras) }} to activity {com.android.Connect/com.android.Connect.UI.MainUI}: java.lang.NullPointerException

1 个答案:

答案 0 :(得分:-1)

问题出在这里

  String msg = "file," + fileToSend.getName() + "," + readFileAsString(fileToSend.getPath()); Log.d(TAG, "the file " + msg);