本文整理匯總了Java中com.google.firebase.database.DatabaseError.toException方法的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseError.toException方法的具體用法?Java DatabaseError.toException怎麽用?Java DatabaseError.toException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.firebase.database.DatabaseError
的用法示例。
在下文中一共展示了DatabaseError.toException方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDataListener
import com.google.firebase.database.DatabaseError; //導入方法依賴的package包/類
private ValueEventListener createDataListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if (dataSnapshot.hasChild(Integer.toString(remoteOpponentSeqNum))) {
DataSnapshot newCheckPointData = dataSnapshot.child(Integer.toString(remoteOpponentSeqNum));
remoteOpponentSeqNum++;
CheckPoint newCheckPoint = new CheckPoint(
((double)newCheckPointData.child(FirebaseNodes.LATITUDE).getValue()),
((double)newCheckPointData.child(FirebaseNodes.LONGITUDE).getValue()));
callbackHandler.hasNewData(newCheckPoint);
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例2: createReadyListener
import com.google.firebase.database.DatabaseError; //導入方法依賴的package包/類
private ValueEventListener createReadyListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstReadyCallback) {
firstReadyCallback = false;
} else {
callbackHandler.isReady();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例3: createFinishedListener
import com.google.firebase.database.DatabaseError; //導入方法依賴的package包/類
private ValueEventListener createFinishedListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstFinishedCallback) {
firstFinishedCallback = false;
} else {
callbackHandler.isFinished();
remoteOpponentFinished = true;
if (localUserFinished) {
removeActiveListeners();
firebaseHelper.deleteChallengeNode(challengeName);
isChallengeTerminated = true;
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例4: createAbortListener
import com.google.firebase.database.DatabaseError; //導入方法依賴的package包/類
private ValueEventListener createAbortListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstAbortCallback) {
firstAbortCallback = false;
} else {
removeActiveListeners();
isChallengeTerminated = true;
deleteChallenge();
callbackHandler.hasLeft();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例5: createInRoomListener
import com.google.firebase.database.DatabaseError; //導入方法依賴的package包/類
private ValueEventListener createInRoomListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(firstInRoomCallback) {
firstInRoomCallback = false;
} else {
callbackHandler.opponentInRoom();
firebaseHelper.removeUserChallengeListener(challengeName, remoteOpponent, inRoomListener, FirebaseNodes.ChallengeStatus.IN_ROOM);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}