by qlimax » Thu, 17 Dec 2009 21:04:04 GMT

Sponsored Links
 Hi guys.

I'm writing an application that use a service to play an audio file

I'm watching the LocalService.java and LocalServiceBinding.java
from the API DEMO

In the api demo, the LocalService.java make a notification in the
status bar, in my case it plays mp3 and make a notification. But that
doesn't matter.

My problem is that when the user press the "Back Button" the service
must stay active.
I want have the same behaviour as  when i press the "Home Button"...

Any help is welcome :D

ps:sorry for my eng



by qlimax » Thu, 17 Dec 2009 22:15:55 GMT

 sorry... maybe solved without binding
but using startService/stopService

----maybe... requires tests :::)))----


Sponsored Links


by G » Thu, 17 Dec 2009 23:03:08 GMT

 Hey I ran into this problem a while back and was pulling my hair out.
The fix is easy (and you're on the right track)

You can still call bindService, you just have to call startService
first. If the service is started via bindService, then it will live
and die with the activity that called it, but if you start it with
startService and THEN bind it with bindService, it should stay alive



by qlimax » Fri, 18 Dec 2009 00:16:43 GMT

 Hi G,
thanks a lot for the explanation.
(souch thigs should be better documented...)



Other Threads

1. how to bind objects to their xml graphic

How does an object that you create sutch as...

EditText aText = new EditText(this);

relate to the xml graphic?

2. Display problem.

Thanks for the greate help. But now i want to display list of strings.
This code is helpful for converting the sms to string insteade of

import android.app.Activity;
import android.app.ListActivity;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.provider.Telephony.Carriers;

import android.telephony.gsm.SmsMessage;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class tele extends ListActivity {

     // Button ms1;
      /** Called when the activity is first created. */
    public void onCreate(Bundle icicle) {

        Uri uri = Uri.parse("content://sms/inbox");
        Cursor c= getContentResolver().query(uri, null, "body like '%s

       // Cursor c = getContentResolver().query(Carriers.CONTENT_URI,
null, null, null, null);

        if(c.getCount() !=0)
                    String[] str = new String[c.getCount()];
                    int i = 0;

                                str[i] = (c.getString



                    new ArrayAdapter<String>(this,



Please help me how can i display the list of strings. I want to
display String[] str. Kindly remember i have to search the strings .
So want the list of strings not the listadapter.
Thanks a lot in advance.

3. Capture clicks on map

4. Accessing email

5. Multiple alarms - Intent aims at the same service but different values - Not possible?

6. Multiple EditText's in the same view

7. Is there a way to know what external API's are supported by Android?