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 8728303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:36:27+00:00 2026-06-13T08:36:27+00:00

I have a small application that launches a login activity as a sub activity

  • 0

I have a small application that launches a “login” activity as a sub activity from my main application activity. The login activity collects username and password using EditText fields and then sends the credentials to main activity for validation after clicking a submit button. For some reason though, my onActivityResult() is not working. I even tried including a TextView that I would manipulate at different points of the method to deduce where it is going wrong, but it appears that the method itself isn’t executing for some reason. Any help would be much appreciated.

My MainActivity:

public class MainActivity extends Activity {

private final String userName = "9590778";
private final String userPass = "1234567";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu){
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

public void activity_about(View view){
    Intent aboutIntent = new Intent(this, AboutActivity.class);
    startActivity(aboutIntent);
}

public void activity_login(View view){
    Intent loginIntent = new Intent(this, LoginActivity.class);
    startActivityForResult(loginIntent, LoginActivity.LOGIN_REQUEST);
}

public void OnActivityResult(int requestCode, int responseCode, Intent resultIntent){
    String passedUser;
    String passedPass;

    Intent intent = getIntent();

    TextView lblTest = (TextView)findViewById(R.id.lblTest);
    lblTest.setText("ATLEAST THIS IS WORKING!"); //THIS IS WHERE I AM TRYING TO MANIPULATE THE TEXTVIEW TO SEE IF METHOD IS EXECUTING!

    if(requestCode == LoginActivity.LOGIN_REQUEST){

        passedUser = intent.getStringExtra("PASSED_USER");
        passedPass = intent.getStringExtra("PASSED_PASS");

        if(passedUser.equals(userName)){
            if(passedPass.equals(userPass)){
                lblTest.setText("LOGIN SUCCESSFUL!");
            }
        }
        else{
            lblTest.setText("ACCESS DENIED!");
        }
    }
}

}

Also, this is my LoginActivity:

public class LoginActivity extends Activity {

public static final int LOGIN_REQUEST = 9999;
public static final int LOGIN_RESPONSE = 1234;

private String passedUser;
private String passedPass;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_login, menu);
    return true;
}

public void submitCred(View view){

    Intent intent = getIntent();

    EditText lblUser = (EditText)findViewById(R.id.txtUserName);
    EditText lblPass = (EditText)findViewById(R.id.txtPassword);

    passedUser = lblUser.getText().toString();
    passedPass = lblPass.getText().toString();


    intent.putExtra("PASSED_USER", passedUser);
    intent.putExtra("PASSED_PASS", passedPass);
    setResult(LOGIN_RESPONSE, intent);

    finish();
}
}
  • 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-13T08:36:29+00:00Added an answer on June 13, 2026 at 8:36 am

    You have a typo, the function you want is onActivityResult, (notice the lowercase o).

    It’s a good habit to use the @Override statement before any method you want to override. If you put @Override before OnActivityResult in your case it would complain at you that OnActivityResult is not a superclass method.

    It’s a good check to make sure you have the right name and right parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small homework application that writes random numbers from 5 to 77
I have a small application that builds up a xml document using XDocument. However,
I have a Java application that launches a small C# application on the client
I have a small email application that lets a user build a message from
I have a small VB.NET application that I'm working on using the full version
I have a login script for a small application that works by storing session
I have a small application that using BackgroundWorker to process the IEnumerator<T> list at
I have a small command-line application written in C that acts as a wrapper/launcher
I have a small application that uses WCF to communicate with a webserver. This
I have a small application that I am building a Chat application into, so

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.