android activity has leaked window com.android.internal.policy.impl.phonewindow$decorview Issue

后端 未结 8 773
再見小時候
再見小時候 2020-11-28 05:56

I am working with Android application to show network error.

NetErrorPage.java

package exp.app;

import android.app.Activity;
impor         


        
8条回答
  •  自闭症患者
    2020-11-28 06:27

    Please try this Way And Let me know :

    Context mContext;
    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.neterrorlayout);
    
       mContext=NetErrorPage.this;
       Button reload=(Button)findViewById(R.id.btnReload);
       reload.setOnClickListener(this);    
       showInfoMessageDialog("Please check your network connection","Network Alert"); 
    }
    public void showInfoMessageDialog(String message,String title)
    {
       new AlertDialog.Builder(mContext)
       .setTitle("Network Alert");
       .setMessage(message);
       .setButton("OK",new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog,int which) 
           {   
              dialog.cancel();
           }
       })
       .show();
    }
    

提交回复
热议问题