Detect logon before redirecting to each activity

Source: Internet
Author: User

Tag: blog HTTP Io ar Java SP data 2014 on

=============== Problem description ====================


Generally, You need to log on to an application. Otherwise, you will be prompted to log on to a specific activity.
I know that J2EE seems to be able to implement such a check through a filter. I wonder if there is a corresponding method in Android. Do I have to make my own judgment every time I jump to the activity?

============= Solution 1 ======================


You save the login status in an application, and then, when you jump to the application, determine whether there is login information in the application.

============= Solution 2 ======================


Generally, it is verified when data is obtained.

============= Solution 3 ======================


Write a baseactivity. Java, so all of them inherit this class. In the parent class, you can check whether you have logged on to the database SQLite or static class or sharedpreference.

============= Solution 4 ======================


Put it in sharedpreference.

Detect logon before redirecting to each activity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.