how to start a service from activity and how to call the service methods?
posted 6 years ago
I'm trying to fallow this tutorial for building a media player for android.
The tutorial talks about a service class
The code for binding service from the tutorial dose not compile in my system.
but this one dose:
(maybe the tutorial use earlier api version then mine? I'm using Android 2.2, API Level 8. )
anyway, my code compile and the call to bindService return true, but still my service object is null.
also the object m_connection whitch is a ServiceConnection stays null after bindService().
m_connection is defined at the begiining of the activity class, along with all data members:
of caurse m_IAudioPlayer is null too. if i tray to call any of the service mmethod
via m_IAudioPlayer.method() I get the null pointer exception.
what am I doing wrong with binding the service? or init or communicate with it?
why do I need this aidl interface actually? I saw code examples that starts a service without
using this interface?