declaring a service

by Mina Shokry » Sat, 26 Sep 2009 03:50:48 GMT

Sponsored Links

I am trying to run service example. I declare a service in a project
and want to call the service from an activity that exists in another

in first project, my AndroidManifest.xml looks like this
<manifest xmlns:android="" ;
                <service android:exported="true" 
android:name=".CalculatorService" /

the CalculatorService class extends the Service class and its onBind
method looks like this
public IBinder onBind(Intent intent) {
        if(calculator == null) {
                calculator = new CalculatorImpl();
        return calculator;

The CalculatorImpl class extends Calculator.Stub class and is generated from Calculator.aidl.

in the other project, in the activity onCreate there is a code like

Intent intent = new Intent(Calculator.class.getName());
boolean connected = bindService(intent, connection, BIND_AUTO_CREATE);

the method bindService returns false. what is missing in my both

note: the file is shared between both projects by a

thanks in advance.

Other Threads

1. Generating .java file from .aidl file


i am developing an android application with Eclipse/ADT.
i want to generate .java files from the existing .aidl file for my

i got some below hints from internet, but i could not see the below option
in* Android Tools*->

   1. In the Package Explorer view, right-click on the project.
   2. Choose *Android Tools* > *Create Aidl preprocess file for Parcelable

can anybody tell me the procedure to generate java files.



2. Show/Display more than one app at at time

Are there methods or api's that will allow me to have two separate
apps running in multi-task (a split screen) and displayed at the same

For example, I would like to display a date/time/temp app... but at
the same time, allow the user to view their email. Is it possible????

Thanks in advance!!!


3. No visual feedback for preference defaults - bug or feature?

4. Programmatic UI Issues

5. avd hangs

6. nexus one kernel not running on sdk emulator ?

7. N1 BM