2

進行状況ダイアログを開始する requestLocation というメソッドがあります。このメソッドを onResume(); から呼び出しています。

私の方法:

public void requestLocation() {
    try { 
        progressDialog = ProgressDialog.show(this, "", "Obtaining Location Service", true);
    }
    catch(Exception e) {

    }

    updates=0;
    startingLocal = null;
    latestLocal = null;
    gps = null;
    gps = new KNLocationService(this);
    gps.setParent(this);
    // check if GPS enabled
    if (gps.canGetLocation()) {

        double latitude = gps.getLatitude();
        double longitude = gps.getLongitude();

        //progressDialog.dismiss();
        //locationServiceText.setText("Aquiring location");

    } else {
        try { 
            progressDialog.dismiss();
        } catch (Exception e) {

        }

        locationServiceText.setText("No LocationService Provided");
    }

}

しかし、進行状況ダイアログが原因であると想定している次のエラーが表示されますが、正確に何が原因であるかを特定できないようです..

05-28 09:50:12.615: E/WindowManager(13774): Activity com.KingNozzle.KNAugmentedRealityActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@428a6f00 that was originally added here
05-28 09:50:12.615: E/WindowManager(13774): android.view.WindowLeaked: Activity com.KingNozzle.KNAugmentedRealityActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@428a6f00 that was originally added here
05-28 09:50:12.615: E/WindowManager(13774):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:374)
05-28 09:50:12.615: E/WindowManager(13774):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:292)
05-28 09:50:12.615: E/WindowManager(13774):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
05-28 09:50:12.615: E/WindowManager(13774):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
05-28 09:50:12.615: E/WindowManager(13774):     at android.view.Window$LocalWindowManager.addView(Window.java:547)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.Dialog.show(Dialog.java:277)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ProgressDialog.show(ProgressDialog.java:116)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ProgressDialog.show(ProgressDialog.java:99)
05-28 09:50:12.615: E/WindowManager(13774):     at com.KingNozzle.KNAugmentedRealityActivity.requestLocation(KNAugmentedRealityActivity.java:494)
05-28 09:50:12.615: E/WindowManager(13774):     at com.KingNozzle.KNAugmentedRealityActivity.onResume(KNAugmentedRealityActivity.java:162)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1184)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.Activity.performResume(Activity.java:5082)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2565)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2603)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2089)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
05-28 09:50:12.615: E/WindowManager(13774):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-28 09:50:12.615: E/WindowManager(13774):     at android.os.Looper.loop(Looper.java:137)
05-28 09:50:12.615: E/WindowManager(13774):     at android.app.ActivityThread.main(ActivityThread.java:4745)
05-28 09:50:12.615: E/WindowManager(13774):     at java.lang.reflect.Method.invokeNative(Native Method)
05-28 09:50:12.615: E/WindowManager(13774):     at java.lang.reflect.Method.invoke(Method.java:511)
05-28 09:50:12.615: E/WindowManager(13774):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-28 09:50:12.615: E/WindowManager(13774):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-28 09:50:12.615: E/WindowManager(13774):     at dalvik.system.NativeStart.main(Native Method)

アプリがクラッシュすることはないようですが、それでもこれを修正したいと思います。

4

2 に答える 2