How to start an Intent from preference page AND GET RESULTS?

by Xin Zhao » Sat, 07 Mar 2009 08:37:37 GMT


Sponsored Links
 Hey guys,

I am trying to start an intent from a preference activity, AND GET RESULTS
once the new intent is done. As such, I can update the summary of the
preference.

Normall we do startActivityForResult() to wait for results. But how can I do
this here?

My code is as follow:

      PreferenceScreen intentPref =
getPreferenceManager().createPreferenceScreen(this);
      Intent intent = new Intent(this, PolicyEditor.class);
      intent.putExtra(PhoneCardDbAdapter.COL_ROWID, (long)rule.mRuleID);
      intentPref.setIntent(intent);  <--- I want to make sure once the
activity related to intent is done, we can update the summary
      title = "Rule " + (i+1);
      summary = rule.ruleSummary();
      intentPref.setTitle(title);
      intentPref.setSummary(summary);
      mlaunchPrefCat.addPreference(intentPref);

Any idea?

Thanks,
xin

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



How to start an Intent from preference page AND GET RESULTS?

by gymshoe » Wed, 29 Apr 2009 06:09:04 GMT


 see:
 http://www.anddev.org/starting_intent_from_preferences_screen-t4505.html 


This invokes an Intent directly from Preferences XML which is handy.
(Perhaps you could specify ACTION_GET_CONTENT to return a value to
your app, although I have not tried this.)  Invoking the intent works
OK internally, but I have not been able to invoke an activity outside
of my application. For instance, I have not been able to invoke the
generic phone Dialer. I have only been able to invoke activities
defined in my manifest file.  This doesn't seem fair since you can
invoke outside activities through java code using intents...

br,
Jim




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


Sponsored Links


Other Threads

1. android build problems

i'm having the same error, here on opensuse 11.

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

2. So when will we be allowed to Force Quit any process we want without root access?

This doesn't seem to be coming in Cupcake even though it's been
essential from day one.

I know it goes against the design goal of "let Android put processes
to sleep instead of quitting them," but even if this doesn't work only
1% of the time (for me it's been more like 10%), the option has to be
there. If not built in to a core application manager, it should at
least be available to third party apps for power users.

So, yeah, when do we get this?
--~--~---------~--~----~------------~-------~--~----~

3. SOLVED (was SurfaceHolder.lockCanvas(dirtyRectangle) bug?)

4. Displaying HTML Content

5. How to compile external packages using android toolchain

6. How to compile external packages using android toolchain

7. What JavaScript events are available to WebKit on Android?