Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:33:56+00:00 2026-06-13T11:33:56+00:00

with this Login form, an admin with (ID: 001) should get a ‘AdminActivity’ whereas

  • 0

with this Login form, an admin with (ID: 001) should get a ‘AdminActivity’ whereas every other userID should get a ‘UserActivity’, and this is the code. It’s not returning the adminID for some reason. Thank you

btnLogin.setOnClickListener(new View.OnClickListener() {

            public void onClick(View view) {

                UserFunctions userFunction = new UserFunctions();   

                String id = inputId.getText().toString();
                String pswd = inputPassword.getText().toString();

                JSONObject json = userFunction.loginUser(id, pswd);             

                try {
                    if (json.getString(KEY_SUCCESS) != null) {
                        loginErrorMsg.setText("");

                        String res = json.getString(KEY_SUCCESS); 

                        if(Integer.parseInt(res) == 1){

                            DatabaseHandler db = new DatabaseHandler(getApplicationContext());

                            JSONObject json_user = json.getJSONObject("user");                          

                            if(id == "001"){
                                // Launch Admin Activity
                                Intent tab1 = new Intent(getApplicationContext(), AdminActivity.class);                     
                                    // Close all views before launching requestActivity
                                tab1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                startActivity(tab1);
                            }

                            // Clear all previous data in database
                            userFunction.logoutUser(getApplicationContext());

                            db.addUser(json_user.getString(KEY_ID), 
                                       json_user.getString(KEY_NAME), 
                                       json_user.getString(KEY_EMAIL),                                     
                                       json_user.getString(KEY_CREATED_AT));                            

                                // Launch User Activity
                            Intent tab = new Intent(getApplicationContext(), UserActivity.class);                       
                                // Close all views before launching requestActivity
                            tab.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            startActivity(tab);


                        }else{

                            loginErrorMsg.setText("Incorrect username/password");
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:33:57+00:00Added an answer on June 13, 2026 at 11:33 am
        if("001".equals(id)){
                                // Launch Admin Activity
                                Intent tab1 = new Intent(getApplicationContext(), AdminActivity.class);                     
                                    // Close all views before launching requestActivity
                                tab1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                                startActivity(tab1);
                                return;
                            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My login form is located at /account/login . GET requests to this URL cause
I've been making this login form in C# and I wanted to 'submit' all
I have this login form. This form is a grouped table view where the
I have a login form for my website. This login form have two text
I am using this tutorial to create a login form http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/ It authenticates against
I got this from for a login form tutorial: function sanitize($securitystring) { $securitystring =
I've been reading this post Creating a login form in CodeIgniter based on Ion
I have this situation: There are a login page with a login form (form
I have written a login form, in this I have used, form and method
I really need help on this one. I am having a simple login form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.