I have a string that I'm trying to pass to my main activity that is bound to this service. The data doesn't seem to be making it through to the other side and I've tried a plethora of techniques. Any help would be appreciated Here's the service
public int onStartCommand(Intent intent, int flags, int startId) {
String thename=intent.getStringExtra("stockName");
String TAG="hello";
Intent putIntent=new Intent(LocalService.this,Binding.class);
if(thename.equals("AMZN"))
{
//Toast.makeText(this, "The price is $1,755.25", Toast.LENGTH_LONG).show();
putIntent.putExtra("theName","WORKED");
}
and here is the activity itself
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_binding);
final Button priceButton=findViewById(R.id.priceButton);
final EditText stockPrice=findViewById(R.id.stockText);
final Intent theIntent=new Intent(Binding.this,LocalService.class);
priceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String stockText=stockPrice.getText().toString();
theIntent.putExtra("stockName",stockText);
startService(theIntent);
Intent getit=getIntent();
String name=getit.getParcelableExtra("theName");
Toast.makeText(getApplicationContext(), name, Toast.LENGTH_LONG).show();
}
});
}