【发布时间】:2021-04-20 04:32:38
【问题描述】:
我一直在尝试将数据从我的主项目发送到我的库项目。 我的库项目是在主项目中定义的,所以添加 lib 项目的依赖项没有问题。我发现与我的问题类似的另一个线程,但到目前为止没有运气...thread
GetUserprofile 是主项目的活动,LockscreenActivity 是库项目的活动。
我在主项目端写过代码
Intent myIntent = null;
try {
myIntent = new Intent(GetUserprofile.this,LockscreenActivity.class);
myIntent.putExtra("examiddetails",exam_id);
startActivity(myIntent);
} catch (Exception e) {
e.printStackTrace();
}
现在我正在使用以下代码获取有关库项目的考试详细信息的数据
Intent intent = getIntent();
try{
if(intent != null){
String Examid = intent.getStringExtra("examiddetails");
}
}catch(Exception e){
System.out.println("getdataFromService exception"+e.toString());
}
我在库项目中得到了检查字符串的空值。
【问题讨论】:
-
请检查exam_id 的值。变量的签名是什么?
-
它的字符串,所以这不是问题
标签: android nullpointerexception