has leaked service connection in activity that was originally bound here

by Marco Nelissen » Wed, 29 Apr 2009 22:56:41 GMT


Sponsored Links
 ou should unbind() when you're done.


On Wed, Apr 29, 2009 at 1:25 AM, mawei1981 <mawei...@gmail.com> wrote:


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Emulator crashes when launching a new Activity

Hello,

I've got a problem when I'm trying to create a new activity when I
click on a button.
My virtual device (emulator) crashes when I click on the button saying
something
like: "The application has stopped unexpectedly"

Could you please help?

My main activity I launch my application is LaunchRecruitMobile as
below. I'd like this activity to lauch another activity MenuMain when
I click on a button.



public class LaunchRecruitMobile extends Activity {

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.logon);


       ImageButton
btn=(ImageButton)findViewById(R.id.logon_ok_imagebutton);
       btn.setOnClickListener(new Button.OnClickListener() {
           public void onClick(View v) {
                Intent intent = new Intent(LaunchRecruitMobile.this,
MenuMain.class);
                startActivity(intent);
           }
       });

   } //end of constructor

 }


 public class MenuMain extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu_main);
    }

 }




In the manifest I've only got:
<application android:icon="@drawable/icon" android:label="@string/
app_name">
       <activity android:name=".LaunchRecruitMobile"
                 android:label="@string/app_name">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category
android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
</application>

I've tried the same in adding the following but doesn't work neither:
<activity android:name=".MenuMain"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.DEFAULT" /
            </intent-filter>
        </activity>


Thanks a lot.
Best regards.
Julien.

-- 

2. Can we access Java.util Map of a class in another class

I am using a SortedMap in a calss that extends SimpleCursoradapter. can i 
acess that map from another class that extends ListActivity.
 
The code im using is given below.
 
* 

public* *class* ListContacts *extends* ListActivity {

ListAdapter lAdapter;

@Override

*public* *void* onCreate(Bundle savedInstanceState) {

*super*.onCreate(savedInstanceState);

setContentView(R.layout.*activitylist*);

//

/**

* 

* Use the ContentResolver instance to query the database and return a

* Cursor with the contacts list. The query is performed against the URI

* stored in ContactsContract.Contacts.CONTENT_URI.

*/

Cursor cursor = getContentResolver().query(

ContactsContract.Contacts.*CONTENT_URI*, *null*,

ContactsContract.Contacts.*HAS_PHONE_NUMBER* + " = 1", *null*,null); 

startManagingCursor(cursor);

// start mappings

String[]  columns = *new* String[] { ContactsContract.Contacts.*DISPLAY_NAME
* };

*int*[] names  = *new* *int*[] { R.id.*contact_name* };

lAdapter = *new* ImageCursorAdapter(*this*, R.layout.*main*, cursor, columns
,names);

 

@Override

*protected* *void* onListItemClick(ListView l, View v, *int* position, *long
* id) {

*super*.onListItemClick(l, v, position, id);

}

 

 

} //  end of class ListContacts 

 
* 

public* *class* ImageCursorAdapter *extends* SimpleCursorAdapter {

*private* Cursor c;

*private* Context context;

SortedMap<String, String> phoneNumberMap = *new* TreeMap<String, String>();

*public* SortedMap<String, String> getPhoneNumberMap() {

*return* phoneNumberMap;

}

*public* *void* setPhoneNumberMap(SortedMap<String, String> phoneNumberMap) 
{

*this*.phoneNumberMap = phoneNumberMap;

}

   

*public* ImageCursorAdapter(Context context, *int* layout, Cursor c,

String[] from, *int*[] to) {

*super*(context, layout, c, from, to);

*this*.c = c;

*this*.context = context;

}

  *public* View getView(*int* pos, View inView, ViewGroup parent) {

phoneNumberMap.put("1", "fasfa");

  phoneNumberMap.put("2", "fasfa1"); 

phoneNumberMap.put("3", "fasfa2"); 

phoneNumberMap.put("4", "fasfa3"); 

phoneNumberMap.put("5", "fasfa4");

phoneNumberMap.put("6", "fasfa5");

System.*out*.println(" Map : size: " + phoneNumberMap.size());

}

}// end of  class ImageCursorAdapter

 

How can i access phoneNumberMap in the onListItemClick () method of 
Listcontacts class.

-- 

3. Android 2.3 emulator crashed after a requestLocationUpdates call

4. initialization of usb from android Application

5. CPU cost of a semi-infinite loop

6. Start default email client

7. Need Android Service suggestions