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

by Jason Parekh » Wed, 29 Apr 2009 07:17:58 GMT


Sponsored Links
 The easiest solution for your situation is to refresh the summaries in your
preference activity's onResume.

Otherwise you'll have to override onPreferenceTreeClick and start the
activity manually.

(sent from phone)




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

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



Other Threads

1. OOT: kompas.com

Br buka m.kompas.com n liat artikel "Tantangan Android: Kestabilan Data!"

Quote
JAKARTA, KOMPAS.com -
Menurut pendiri Komunitas ID
Android, Agung Sumonangan,
tantangan Android ke depan
adalah terkait dengan kestabilan
data. Selama ini, akses data
dinilai masih belum stabil.

Qoute

Maap nubi, tp selain pak Agus, emang ada pak Agung yah?

m.kompas.com/news/read/data/2010.07.18.10030034

Rgds,
Albri
-- sent from spica clair --
cetsolution.com

-- 
"Indonesian Android Community [id-android]" 

2. SoftKeyboard background color

Hey there,
does anyone have a nice and easy way to change the color of the soft
keyboard? Maybe even change the color of the keys????
Whenever I define a background color as follows it crashes the
keyboard:

CODE:
line 21: <com.example.android.softkeyboard.LatinKeyboardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/keyboard"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/keyboard_background1"
        android:keyBackground="@drawable/btn_keyboard_key"
        />

ERROR:
03-27 07:03:53.324: ERROR/AndroidRuntime(560): Uncaught handler:
thread main exiting due to uncaught exception
03-27 07:03:53.334: ERROR/AndroidRuntime(560):
android.view.InflateException: Binary XML file line #21: Error
inflating class com.example.android.softkeyboard.LatinKeyboardView
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.view.LayoutInflater.inflate(LayoutInflater.java:385)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
com.jmuenster.android.softkeyboard.SoftKeyboard.onCreateInputView(SoftKeyboard.java:
110)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:
950)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:
1303)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:
1278)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.inputmethodservice.InputMethodService
$InputMethodImpl.showSoftInput(InputMethodService.java:388)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:
148)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
com.android.internal.os.HandlerCaller
$MyHandler.handleMessage(HandlerCaller.java:45)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.os.Handler.dispatchMessage(Handler.java:99)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.os.Looper.loop(Looper.java:123)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.app.ActivityThread.main(ActivityThread.java:4363)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
java.lang.reflect.Method.invokeNative(Native Method)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
java.lang.reflect.Method.invoke(Method.java:521)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
dalvik.system.NativeStart.main(Native Method)
03-27 07:03:53.334: ERROR/AndroidRuntime(560): Caused by:
java.lang.ClassNotFoundException:
com.example.android.softkeyboard.LatinKeyboardView in loader
dalvik.system.pathclassloa...@4470e8c0
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-27 07:03:53.334: ERROR/AndroidRuntime(560):     at
android.view.LayoutInflater.createView(LayoutInflater.java:466)

Thanks heaps
Julian

-- 

3. Android RFC 3339 time string parsing does not work

4. Upgrade Android

5. XML Pull Parser Bugging Out

6. Google Maps API in Israel

7. RIM And Nokia Respond To Apple's Antennagate Press Conference [Attenuation]