2017-08-21 19 views
0
public class ForceOfflineReceiver extends BroadcastReceiver { 
    @Override 
    public void onReceive(final Context context, Intent intent) { 
     AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); 
     dialogBuilder.setTitle("Warning"); 
     dialogBuilder.setMessage("You are forced to be offline. Please try to login again."); 
       dialogBuilder.setCancelable(false); 
     dialogBuilder.setPositiveButton("OK", 
       new DialogInterface.OnClickListener() { 
        @Override 
        public void onClick(DialogInterface dialog, int which) { 
         ActivityCollector.finishAll(); 
         Intent intent = new Intent(context, 
           LoginActivity.class); 
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 

         context.startActivity(intent); 
        } 
       }); 
     AlertDialog alertDialog = dialogBuilder.create(); 

     alertDialog.getWindow().setType(TYPE_SYSTEM_ALERT); 
     alertDialog.show(); 
    } 

} 

ボタンをクリックすると、ダイアログは表示されません。 、ログは次のとおりBoostFramework():mPerf = [email protected]

8月21日10:40:05.756 13851から13851/com.project.ics.day0821rememberpassword V/BoostFramework:BoostFramework():MPERF = com.qualcomm.qti.Performance @ c4322f2 08-21 10:40:05.757 13851-13851/com.project.ics.day0821rememberpassword V/BoostFramework: BoostFramework():mPerf = [email protected] 08-21 10:41: 06.499 13851-13851/com.project.ics.day0821rememberpassword W/IInputConnectionWrapper:clearMetaKeyStates on inactive InputConnection 08-21 10:41:07.559 13851-13851/com.project.ics.day0821rememberpass単語I /振付: スキップされた57のフレーム!アプリケーションがそのメインスレッドの で多すぎる作業を行っている可能性があります。 githubの上

ソースコード: https://github.com/gowufang/AndroidStu/tree/master/Day0821RememberPassword

答えて

0

はあなたがボタンを押すか、あなたはそれが間違って綴られているときに実行取得されたメソッドの名前を設定していないかもしれ、私はこの問題を持っていたが、後私はそれを持っています(ボタンの "onClick"プロパティ名は設定されていないか、間違って設定されていません)。

+0

これは質問に対する答えではありません。たぶんそれはコメントとして意図された? – jdv

+0

質問と回答の両方がわかりにくい – Ibo

関連する問題