ProgessDialog im RemoteService?

GMoN

GMoN

Dauergast
394
Ich habe einen RemoteService, in dem ich gerne einen ProgressDialog aufrufen würde. Leider klappt das nicht. Da die Toasts im RemoteService funktionieren, dachte ich, dass ein ProgressDialog auch funktionieren sollte.

E/JavaBinder(20403): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
E/JavaBinder(20403): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/JavaBinder(20403): at android.os.Handler.<init>(Handler.java:121)
E/JavaBinder(20403): at android.app.Dialog.<init>(Dialog.java:99)
E/JavaBinder(20403): at android.app.AlertDialog.<init>(AlertDialog.java:63)
E/JavaBinder(20403): at android.app.ProgressDialog.<init>(ProgressDialog.java:80)
E/JavaBinder(20403): at android.app.ProgressDialog.<init>(ProgressDialog.java:76)
E/JavaBinder(20403): at android.app.ProgressDialog.show(ProgressDialog.java:101)
E/JavaBinder(20403): at android.app.ProgressDialog.show(ProgressDialog.java:90)
E/JavaBinder(20403): at de.carknue.gmon.RemoteService$5.kml_export(RemoteService.java:284)
E/JavaBinder(20403): at de.carknue.gmon.ISecondary$Stub.onTransact(ISecondary.java:67)
E/JavaBinder(20403): at android.os.Binder.execTransact(Binder.java:287)
E/JavaBinder(20403): at dalvik.system.NativeStart.run(Native Method)
Und dies ist die Funktion, wo es crasht. Direkt bei kmlProgressDialog = ....

Code:
private final ISecondary.Stub mSecondaryBinder = new ISecondary.Stub() {
        
        
        public void kml_export() {
            Log.v(TAG, "Sevice kml_export call");
            do_wlan_scan = false;
            kmlProgressDialog = ProgressDialog.show(RemoteService.this , "Please wait...", "Exporting KML to\n/sdcard/gmon/gmon_wlan.kml", true);
            Log.v(TAG, "Sevice kml_export call end");
            //Thread kml = new kmlThread();
            //kml.start();}}

Läßt sich das irgendwie lösen? Oder muss ich den ProgressDialog aus meiner Activity aufrufen?
 
Ich rufe die Progressbar jetzt nicht mehr in der ISecondary.Stub mSecondaryBinder auf, sondern über einen seperaten Handler. Crasht dann zwar immer noch aber mit ner anderen Exception. Die so ähnlich lautet, wie dass ein Window fehlt. Dachte, dass zumindest die losgelöste Progressbar auch im Remote Service funktioniert, wie die Toasts ja auch. Ist aber wohl leider nicht so.

Oder hat noch jemand eine Idee? Meine Activity ist ja zu dem Zeitpunkt ja im Vordergrund und hätte ein Window für die Prograessbar. Ich möchte sie allerdings vom Remote Service starten und beenden.
 

Ähnliche Themen

D
  • djsnoopy
Antworten
6
Aufrufe
614
djsnoopy
D
S
Antworten
8
Aufrufe
509
swa00
swa00
D
  • Data2006
Antworten
14
Aufrufe
484
jogimuc
J
Zurück
Oben Unten