Indonesian English French German Spain Italian Russian Portuguese Japanese Dutch Arabic Chinese Simplified

How to get results from intent launched from preference screen...

Monday, August 2, 2010

THis method can help get result from intent launched from preference screen.
Do not mention intent while creating preference like I did in above
code.. Mention intent on OnPreferenceClickListener and then do

        // Intent preference
       DevicePref =
       // Show a Screen with list of Devices Discovered


       DevicePref.setTitle("Select Device");

   OnPreferenceClickListener onPreferenceClick = new
Preference.OnPreferenceClickListener() {
           public boolean onPreferenceClick(Preference preference) {

                   if (preference ==DevicePref )
                       Intent i = new

               return true;

   protected void onActivityResult(int requestCode, int resultCode,
Intent data)

           switch (requestCode) {

                   case Constants.CHOOSE_DEVICE:
                           if (data!=null )
                                   Bundle b = data.getExtras();
                                   mSelectedDevice =    (String) b.get("Name");



0 comment:

Post a Comment

Theme by New wp themes | Bloggerized by Dhampire