Click here to Skip to main content
15,180,707 members
Home / Discussions / Android
   

Android

 
QuestionRe: on android E-health care project Pin
Nick_314159265413-Apr-17 12:25
MemberNick_314159265413-Apr-17 12:25 
QuestionHow to port my HTML5 Websocket site to cordova app? Pin
TonyManso23-Feb-17 18:01
professionalTonyManso23-Feb-17 18:01 
QuestionMethod not returning expected value Pin
Davidw196923-Feb-17 4:13
MemberDavidw196923-Feb-17 4:13 
AnswerRe: Method not returning expected value Pin
Eddy Vluggen23-Feb-17 4:35
professionalEddy Vluggen23-Feb-17 4:35 
GeneralRe: Method not returning expected value Pin
Davidw196924-Feb-17 17:41
MemberDavidw196924-Feb-17 17:41 
AnswerRe: Method not returning expected value Pin
Jochen Arndt23-Feb-17 4:45
professionalJochen Arndt23-Feb-17 4:45 
GeneralRe: Method not returning expected value Pin
Richard MacCutchan23-Feb-17 6:45
mveRichard MacCutchan23-Feb-17 6:45 
AnswerRe: Method not returning expected value Pin
Davidw196924-Feb-17 17:52
MemberDavidw196924-Feb-17 17:52 
Thank you Jochen. Sorry it took so long for me to get back to you. I have been working a lot. I did not end up using the method that was used in that post, but it did lead me to the answer, so I will mark your post as the answer.

What I did is rework my code so that instead of trying to return a value from the asynchronous method, I simply call a new method if the condition matches what I am looking for.

lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            Spacecraft listItem = (Spacecraft) lv.getItemAtPosition(position);
            Level = listItem.getLevel();
            EverPlayedNextLevel(); //Check if the user played next level
        }
    });


Next, make sure the point value for this level is not -1. -1 means the level is locked.
private void EverPlayedNextLevel(){
        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) {

                if((long)dataSnapshot.getValue() != -1)
                LaunchMainActivity();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

    }


So if it is not -1, launch the main activity by calling another method.

Thanks for your help. Thumbs Up | :thumbsup:
AnswerRe: Method not returning expected value Pin
Richard MacCutchan23-Feb-17 4:58
mveRichard MacCutchan23-Feb-17 4:58 
GeneralRe: Method not returning expected value Pin
Davidw196924-Feb-17 17:53
MemberDavidw196924-Feb-17 17:53 
QuestionAndroid and C# Web Services Pin
Member 1155786814-Feb-17 23:41
MemberMember 1155786814-Feb-17 23:41 
SuggestionRe: Android and C# Web Services Pin
Richard Deeming15-Feb-17 3:39
mveRichard Deeming15-Feb-17 3:39 
QuestionAndroid: High Pass filter Pin
Himanshu Bhutani13-Feb-17 2:36
MemberHimanshu Bhutani13-Feb-17 2:36 
QuestionRe: Android: High Pass filter Pin
David Crow13-Feb-17 3:41
MemberDavid Crow13-Feb-17 3:41 
AnswerRe: Android: High Pass filter Pin
Nick_314159265415-Apr-17 4:55
MemberNick_314159265415-Apr-17 4:55 
QuestionAndroid Day of Week Calculator Pin
Pavlex49-Feb-17 10:50
MemberPavlex49-Feb-17 10:50 
AnswerRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 11:02
MemberDavid Crow9-Feb-17 11:02 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 11:09
MemberPavlex49-Feb-17 11:09 
GeneralRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 11:12
MemberDavid Crow9-Feb-17 11:12 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 11:15
MemberPavlex49-Feb-17 11:15 
SuggestionRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 11:23
MemberDavid Crow9-Feb-17 11:23 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 11:32
MemberPavlex49-Feb-17 11:32 
GeneralRe: Android Day of Week Calculator Pin
David Crow9-Feb-17 11:36
MemberDavid Crow9-Feb-17 11:36 
GeneralRe: Android Day of Week Calculator Pin
Pavlex49-Feb-17 11:38
MemberPavlex49-Feb-17 11:38 
GeneralRe: Android Day of Week Calculator Pin
Richard MacCutchan9-Feb-17 22:07
mveRichard MacCutchan9-Feb-17 22:07 

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.