a have a activity called ClientAYmsg.java , a Serivice name
AYmsgService.java, an AIDL called IAYmsgService.aidl (which
automatically create IAYmsgService.java) and a java class Called
AYmsg.java
the ClientAYmsg.java only filled with onCreate like this :
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
AYmsg aymsg = new AYmsg(this);
}
the constructor in AYmsg only called bind Service :
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder
service)
{
Log.d(TAG, "Connected");
mService = IAYmsgService.Stub.asInterface(service);
}
public void onServiceDisconnected(ComponentName className)
{
mService = null;
}
};
public AYmsg(Activity activity)
{
activity.bindService(new Intent(IAYmsgService.class.getName()),
mConnection, Context.BIND_AUTO_CREATE);
Log.d(TAG, "Starting the service");
};
I already impelent the onBind(Intent intent) on the AYmsgService.java
like this:
@Override
public IBinder onBind(Intent intent)
{
Log.i(TAG,"AYmsgService: onBind");
if (IAYmsgService.class.getName().equals(intent.getAction()))
return mBinder;
return null;
}
but the bindService doesnt start the service.
but if i called it direcly with :
Intent i = new Intent(activity, AYmsgService.class);
activity.startService(i,null);
the service works fine.
any body know what's seems to be the problem ?
thanx b4.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---