吐司不是用genymotion模拟显示

问题描述:

我想用android studio 2.3.3和genymotion开发一个android应用2.10.0 我使用吐司味精来显示Firebase连接结果,但它并不显示,尽管有没有错误。 这里是我的代码吐司不是用genymotion模拟显示

 mAuth.signInWithEmailAndPassword(email, password) 
       .addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() { 
        @Override 
        public void onComplete(@NonNull Task<AuthResult> task) { 
         Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful()); 

         // If sign in fails, display a message to the user. If sign in succeeds 
         // the auth state listener will be notified and logic to handle the 
         // signed in user can be handled in the listener. 
         if (!task.isSuccessful()) { 
          Log.w(TAG, "signInWithEmail:failed", task.getException()); 
          Toast.makeText(LoginActivity.this, "Authentication failed !", 
            Toast.LENGTH_SHORT).show(); 
          setContentView(R.layout.failure); 
          finish(); 
         } 
         else{ 
          setContentView(R.layout.success); 
          Intent settings = new Intent(LoginActivity.this,SettingsActivity.class); 
          startActivity(settings); 
          finish(); 
         } 
        } 
       }); 
+0

你能看到'SettingsActivity.class '? –

+0

Toast语法没有问题。检查是否进入部分或其他部分 – Siva

+0

确保语句执行与否? – Shailesh

它不显示,因为您完成后敬酒活动 您可以ActivityContext改变的applicationContext

Toast.makeText(getApplicationContext(), "Authentication failed!" , Toast.LENGTH_SHORT).show();