Question

I'm having a very weird situation in my app. I have an activity, on which I have log in button. On button click I'm checking whether user is logged in or not, and simultaneously showing proper message. My code looks like this:

@Override
public void onClick(View v) {
    if (loginUserId == null || loginAccessToken == null) {

        Intent intent = new Intent();
        intent.setClassName("com.example.poc",
                "com.example.poc.LoginPromptDialog");
        startActivity(intent);
    } else {
        System.out.println("Else condition here!");
    }
}

On else condition I'm printing on the log.

In my case take a scenario that user is not logged in, then Login Prompt Activity will be shown. I have a skip button on my Second Activity, on that button I'm just calling finish() method. And I'm coming back from Second Activity to First Activity. This is confirmed that my onResume() method is called when coming back from Second Activtiy.

Still user is not logged in and when I click again button on the First Activity my else condition is called. Why again my if condition is not called?

I can't figure out why this is happening.

Any kind of help will be appreciated.

Was it helpful?

Solution

I was getting "" values from the other activity. Thanks to the comments I got. Solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top