Reputation:
I have activity and plugin for cordova.I need to get string value from the plugin and want to send this string to activity.I used the bundle, getextra, putextra etc.But always i'm getting value as null. Please reply. I googled, but didn't got solution. My code is as below.
Plugin code: Context context=this.cordova.getActivity().getApplicationContext(); Intent intent=new Intent(context,First.class);
intent.putExtra("Id", "MyData");
context.startActivity(intent);
At my activity code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.intent);
Intent intent = getIntent();
intent.getStringExtra(String name) method. In your case:
String id = intent.getStringExtra("Id");
Log.i("ID":id+"");
}
Upvotes: 0
Views: 942
Reputation: 978
String id = intent.getStringExtra("Id");
Try this, you set Id in plugin and get id in activity, for this reason it's always null
Upvotes: 0