我现在有这样的代码:如何获得火力地堡异常成switch语句
if (!task.isSuccessful() && task.getException() != null) {
FirebaseCrash.report(task.getException());
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(SignUp.this, "Authentication failed: " + task.getException().getMessage(),Toast.LENGTH_LONG).show();
}
有时候用户得到一个FirebaseAuthUserCollisionException
,我要检测它在switch
声明,如下所示:
switch(task.getException()){
case /*I don't know what goes here*/:
//Whatever
}
但是,当你阅读,我不知道要在case
声明中放什么。我在那里放什么?换句话说,FirebaseAuthUserCollisionException
位于哪里以便我可以访问它? FirebaseAuthUserCollisionException
只是一个类,所以我目前无法做任何事情。
同样的问题是[这里讨论](http://stackoverflow.com/q/37859582/4815718)。当我看到事情时,没有简单而干净的方式去做你想做的事。除了这里回答中提供的方法之外,您还可以考虑[此解决方案](http://stackoverflow.com/a/38490022/4815718)。 –