English 中文(简体)
a. 错误;
原标题:android - showDialog(); error
  • 时间:2012-05-04 06:01:31
  •  标签:
  • android

我试图写一下,如果其他情况是维系关系,而是错失。

后勤

05-04 13:32:51.227: E/WindowManager(4355): Activity com.smartmenu.SplashActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41813bd0 that was originally added here
05-04 13:32:51.227: E/WindowManager(4355): android.view.WindowLeaked: Activity com.smartmenu.SplashActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41813bd0 that was originally added here
05-04 13:32:51.227: E/WindowManager(4355):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:343)
05-04 13:32:51.227: E/WindowManager(4355):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245)
05-04 13:32:51.227: E/WindowManager(4355):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
05-04 13:32:51.227: E/WindowManager(4355):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
05-04 13:32:51.227: E/WindowManager(4355):  at android.view.Window$LocalWindowManager.addView(Window.java:537)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.Dialog.show(Dialog.java:274)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.AlertDialog$Builder.show(AlertDialog.java:932)
05-04 13:32:51.227: E/WindowManager(4355):  at com.smartmenu.SplashActivity.showDialog(SplashActivity.java:205)
05-04 13:32:51.227: E/WindowManager(4355):  at com.smartmenu.SplashActivity.onCreate(SplashActivity.java:93)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.Activity.performCreate(Activity.java:4465)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
05-04 13:32:51.227: E/WindowManager(4355):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-04 13:32:51.227: E/WindowManager(4355):  at android.os.Looper.loop(Looper.java:137)
05-04 13:32:51.227: E/WindowManager(4355):  at android.app.ActivityThread.main(ActivityThread.java:4340)
05-04 13:32:51.227: E/WindowManager(4355):  at java.lang.reflect.Method.invokeNative(Native Method)
05-04 13:32:51.227: E/WindowManager(4355):  at java.lang.reflect.Method.invoke(Method.java:511)
05-04 13:32:51.227: E/WindowManager(4355):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-04 13:32:51.227: E/WindowManager(4355):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-04 13:32:51.227: E/WindowManager(4355):  at dalvik.system.NativeStart.main(Native Method)

法典

  if(str.equals(""))
        {                          
           ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
        NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);    
        if (mWifi.isConnected()) {
           new Handler().postDelayed(new Runnable(){
                @Override
                public void run() {
                /* Create an Intent that will start the Menu-Activity.*/ 
                Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class);
                SplashActivity.this.startActivity(mainIntent);
                SplashActivity.this.finish();
                }
            }, SPLASH_DISPLAY_LENGHT);
        }
        else
        {                   
            a) 展示;
        }
        }
        else
        {
            ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
            NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);    
            if (mWifi.isConnected()) {                  
                  new Handler().postDelayed(new Runnable(){
                        @Override
                        public void run() {
                        /* Create an Intent that will start the Menu-Activity.*/ 
                        Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class);
                        SplashActivity.this.startActivity(mainIntent);
                        SplashActivity.this.finish();
                        }
                    }, SPLASH_DISPLAY_LENGHT);
                new DownloadFilesTask().execute();
            }
            else
            {                   
                a) 展示;
            }

a) 展示;

  private void showDialog()
    {
        AlertDialog.Builder dialog = new AlertDialog.Builder(this);
        dialog.setTitle("Attention");
        dialog.setMessage("No Internet Connection. Please enable the wifi. ");
        dialog.setPositiveButton("OK", new 
                DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, 
                int whichButton) 
                {
                    new Handler().postDelayed(new Runnable(){
                        @Override
                        public void run() {
                        /* Create an Intent that will start the Menu-Activity.*/ 
                        Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class);
                        SplashActivity.this.startActivity(mainIntent);
                        SplashActivity.this.finish();
                        }
                    }, SPLASH_DISPLAY_LENGHT);
                }
            });

        dialog.show();
    }
最佳回答

在PostExecute使用AsyncTask并展示你的方言。 在前言中,展示了你的间歇。

问题回答

www.un.org/spanish/ecosoc 你们在离开活动后,又试图展示糖尿病。

解决办法是在离开活动之前,例如在Pause(Pause)的Dilog,打电话解雇。

意见提及其母体背景(从建筑商的论点中得出)。 如果你离开活动而没有摧毁迪亚洛人和其他有活力的舆论,他们仍然提到你的活动(如果你在这种背景下产生:与新的进步(这一点)一样),因此不能由GC收集,造成记忆泄露。

原始答案是:。 HERE





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签