小编Jee*_*mar的帖子

通过bundle传递值并获取其他活动的值

正如我在代码中看到的那样,我正在通过Bundle传递价值.
现在,我希望它在另一项活动中具有价值onCreate().我尝试了它的值,但它显示nullpointerexception.

请帮我解决问题.

Bundle bundle = new Bundle();
String url = "http://www.google.com";
bundle.putString("url", url);
Intent myIntent = new Intent(context, NotificationService.class);
myIntent.putExtras(bundle);
context.startService(myIntent);
Run Code Online (Sandbox Code Playgroud)


获取价值代码:

if (!getIntent().getExtras().getString("url").contains(null)) {
        // Do something
}
Run Code Online (Sandbox Code Playgroud)

android android-intent

13
推荐指数
3
解决办法
7万
查看次数

使用TimeSpan作为计时器间隔

如何使用a的值TimeSpan作为间隔Timer

c# timespan timer

2
推荐指数
1
解决办法
6959
查看次数

标签 统计

android ×1

android-intent ×1

c# ×1

timer ×1

timespan ×1