Hi ,
Im unable to bind the service to second activity. I have bind and started the service from one activity but when i go to other acitivity i want to bind that activity also. but there are errors. please have a look :
first activity :
protected void onPause() {
Toast.makeText(this, "service unbinded", Toast.LENGTH_LONG).show();
unbindService(myconn);
super.onPause();
}
public void OnShowDevices(View v){
Intent in = new Intent(this , ConnectedDevice.class);
startActivity(in);
}
protected void onResume() {
super.onResume();
Intent intq = new Intent(this ,Server.class);
startService(intq);
bindService(intq, myconn, Context.BIND_AUTO_CREATE);
try{
}
catch(Exception ex){
((TextView)findViewById(R.id.txtStatus)).setText(ex.getMessage());
}
}
while the second activity :
try{
Toast.makeText(this, "Starting", Toast.LENGTH_SHORT).show();
Intent intq = new Intent(this ,Server.class);
bindService(intq, myconn, Context.BIND_AUTO_CREATE);
}
catch(Exception ex)
{
Toast.makeText(this, ex.getMessage(), Toast.LENGTH_SHORT).show();
}