Click here to Skip to main content
15,896,063 members
Home / Discussions / Android
   

Android

 
GeneralRe: I don't find the mistake I make Pin
Richard MacCutchan26-Mar-17 7:40
mveRichard MacCutchan26-Mar-17 7:40 
GeneralRe: I don't find the mistake I make Pin
User 1106097926-Mar-17 7:44
User 1106097926-Mar-17 7:44 
GeneralRe: I don't find the mistake I make Pin
David Crow26-Mar-17 10:38
David Crow26-Mar-17 10:38 
GeneralRe: I don't find the mistake I make Pin
User 1106097927-Mar-17 3:07
User 1106097927-Mar-17 3:07 
QuestionRe: I don't find the mistake I make Pin
David Crow27-Mar-17 12:32
David Crow27-Mar-17 12:32 
GeneralRe: I don't find the mistake I make Pin
Richard MacCutchan27-Mar-17 21:44
mveRichard MacCutchan27-Mar-17 21:44 
SuggestionRe: I don't find the mistake I make Pin
David Crow26-Mar-17 10:36
David Crow26-Mar-17 10:36 
QuestionRe: I don't find the mistake I make Pin
David Crow26-Mar-17 10:34
David Crow26-Mar-17 10:34 
GeneralRe: I don't find the mistake I make Pin
User 1106097927-Mar-17 3:36
User 1106097927-Mar-17 3:36 
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 
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 
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 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 

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.