Getintent() Wrote In Red
I am trying to pass string from main activity to another class extends from services. I send it like this from onCreate method at main: Intent phoneintent = new Intent(MainActivity
Solution 1:
Intentphoneintent=newIntent(MainActivity.this, AlarmServic.class);
StringphoneN= phoneNumber.getText().toString();
phoneintent.putExtra("PhoneNumber",phoneN );
startService(phoneintent);// If its a Service
And Retrieve in Service as
publicintonStartCommand(Intent intent, int flags, int startId){
String phoneNumber= intent.getStringExtra("PhoneNumber");
...........
}
Post a Comment for "Getintent() Wrote In Red"