I am passing value through Bundle as you can see in my code.
Now, I want its value in another activity onCreate()
. I tried it to get its value but it is showing nullpointerexception.
Please help me solve the problem.
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);
Get Value code :
if (!getIntent().getExtras().getString("url").contains(null)) {
// Do something
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…