Click here to Skip to main content
15,867,308 members
Home / Discussions / Android
   

Android

 
SuggestionRe: I don't find the mistake I make Pin
David Crow27-Mar-17 12:34
David Crow27-Mar-17 12:34 
GeneralRe: I don't find the mistake I make Pin
User 1106097927-Mar-17 21:43
User 1106097927-Mar-17 21:43 
QuestionAndroid project Pin
Member 1307301022-Mar-17 18:16
Member 1307301022-Mar-17 18:16 
GeneralRe: Android project Pin
Richard MacCutchan22-Mar-17 23:05
mveRichard MacCutchan22-Mar-17 23:05 
Questionon android E-health care project Pin
Member 1307301820-Mar-17 21:01
Member 1307301820-Mar-17 21:01 
QuestionRe: on android E-health care project Pin
Nick_314159265413-Apr-17 11:25
Nick_314159265413-Apr-17 11:25 
QuestionHow to port my HTML5 Websocket site to cordova app? Pin
TonyManso23-Feb-17 17:01
professionalTonyManso23-Feb-17 17:01 
QuestionMethod not returning expected value Pin
Davidw196923-Feb-17 3:13
Davidw196923-Feb-17 3:13 
I apologize for the vague title of this thread. I am a C# developer and I am having some issues with trying to understand the way things are done in Java / Android.

Java
private boolean EverPlayedNextLevel(final int Level){
        locked = false;
        String Uid = acct.getId();
        DatabaseReference db = FirebaseDatabase.getInstance().getReference();
        Query query = db.child("levels/uid/" + Uid + "/" + Level);
        query.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                locked = ((long)dataSnapshot.getValue() == -1);
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
        return locked;
    }


The Boolean variable locked is a class level variable. Notice that I set it to false at the beginning of the method. If I set a breakpoint at the closing brace of the onDataChange "inner" method and
((long)dataSnapshot.getValue() == -1);
returns true, then locked is of course true. But the method EverPlayedNextLevel still returns false. How should I deal with this? I don't understand what is going on. I want EverPlayedNextLevel to return true if
((long)dataSnapshot.getValue() == -1);
evaluates to true.
AnswerRe: Method not returning expected value Pin
Eddy Vluggen23-Feb-17 3:35
professionalEddy Vluggen23-Feb-17 3:35 
GeneralRe: Method not returning expected value Pin
Davidw196924-Feb-17 16:41
Davidw196924-Feb-17 16:41 
AnswerRe: Method not returning expected value Pin
Jochen Arndt23-Feb-17 3:45
professionalJochen Arndt23-Feb-17 3:45 
GeneralRe: Method not returning expected value Pin
Richard MacCutchan23-Feb-17 5:45
mveRichard MacCutchan23-Feb-17 5:45 
AnswerRe: Method not returning expected value Pin
Davidw196924-Feb-17 16:52
Davidw196924-Feb-17 16:52 
AnswerRe: Method not returning expected value Pin
Richard MacCutchan23-Feb-17 3:58
mveRichard MacCutchan23-Feb-17 3:58 
GeneralRe: Method not returning expected value Pin
Davidw196924-Feb-17 16:53
Davidw196924-Feb-17 16:53 
QuestionAndroid and C# Web Services Pin
Member 1155786814-Feb-17 22:41
Member 1155786814-Feb-17 22:41 
SuggestionRe: Android and C# Web Services Pin
Richard Deeming15-Feb-17 2:39
mveRichard Deeming15-Feb-17 2:39 
QuestionAndroid: High Pass filter Pin
Himanshu Bhutani13-Feb-17 1:36
Himanshu Bhutani13-Feb-17 1:36 
QuestionRe: Android: High Pass filter Pin
David Crow13-Feb-17 2:41
David Crow13-Feb-17 2:41 
AnswerRe: Android: High Pass filter Pin
Nick_314159265415-Apr-17 3:55
Nick_314159265415-Apr-17 3:55 
QuestionAndroid Day of Week Calculator Pin
Pavlex49-Feb-17 9:50
Pavlex49-Feb-17 9:50 
AnswerRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:02
David Crow9-Feb-17 10:02 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:09
Pavlex49-Feb-17 10:09 
GeneralRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 10:12
David Crow9-Feb-17 10:12 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 10:15
Pavlex49-Feb-17 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.