第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

應(yīng)用程序在 count 和 dialog box上崩潰

應(yīng)用程序在 count 和 dialog box上崩潰

大話西游666 2019-03-21 22:19:12
我使用下面的代碼:public class MyCount extends CountDownTimer    {         public MyCount(long millisInFuture, long countDownInterval)          {             super(millisInFuture, countDownInterval);         }         @Override         public void onFinish()          {              displayAlertForRestart();         }         @Override         public void onTick(long millisUntilFinished)          {             counter.setText("Time Left: " + millisUntilFinished/1000 + " sec");         }      }    public void displayAlertForRestart()    {     AlertDialog.Builder builder = new AlertDialog.Builder(this);     builder.setCancelable(true);     builder.setMessage("Do you want to Restart?");     builder.setTitle("Game Over");     builder.setInverseBackgroundForced(true);     builder.setPositiveButton("Yes", new DialogInterface.OnClickListener()     {       public void onClick(DialogInterface dialog, int which) {             Intent myIntent = new Intent(context,Level.class);             startActivity(myIntent);             dialog.dismiss();             finish();       }       });     builder.setNegativeButton("No", new DialogInterface.OnClickListener() {       public void onClick(DialogInterface dialog, int which) {         dialog.dismiss();         finish();       }     });     AlertDialog alert = builder.create();     alert.show();    }alert.show();處的 LogCat error:36: E/AndroidRuntime(9829): android.view.WindowManager$BadTokenException: Unable to add window -- token android. os.BinderProxy@43cf1e38 is not valid; is your activity running?
查看完整描述

2 回答

?
白衣染霜花

TA貢獻1796條經(jīng)驗 獲得超10個贊

AlertDialog.Builder builder = new AlertDialog.Builder(this);
參數(shù)應(yīng)該是一個activity的引用.

查看完整回答
反對 回復(fù) 2019-04-28
  • 2 回答
  • 0 關(guān)注
  • 503 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號