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

  • Home
  • SEARCH
  • 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 6602089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:50:08+00:00 2026-05-25T18:50:08+00:00

Im completely new to Android so apologies if this is a silly question. But

  • 0

Im completely new to Android so apologies if this is a silly question. But my problem is this:

I have created a number of classes for each of the pages in my app and I would like to update the text in a textview of a particular class from the text in an edittext field from another class.

To be more specific, I have a login page and I want the username (input by the user in an edittext box) to be transferred to a textfield in the logged in page. Currently I am trying to achieve this by using a click listener for the log in button in the log in page:

public void sign_in_click(View view) {
    EditText tv1 = (EditText) findViewById(R.id.txt_input_uname);

    String username=tv1.getText().toString();

    LoginDetails unamede=new LoginDetails();
    unamede.setuname(username);

    Intent myIntent = new Intent(view.getContext(), customer.class);
    startActivityForResult(myIntent, 0); 

}

So the click listener initialises a new class variable I have defined in another class like so:

public class LoginDetails {
public String uname;

public void setuname(String username){
        uname=username;     
}

public String getuname(){
    return uname;   
}
}

and it gives uname the username from the edittext box in the login page.

Then I have in the logged in page under oncreate:

LoginDetails unamed= LoginDetails();
String username=unamed.getuname();

tv1.setText(username);

but the text in the textview box doesnt get anything written to it. Now I wont be surprised if I’m doing this completely wrong but any advice would be much appreciated. thanks

  • 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-05-25T18:50:08+00:00Added an answer on May 25, 2026 at 6:50 pm

    What i would suggest is put the user’s log in information into a SharedPreference. To transfer the date to another activity.

    For example…

     SharedPreferences myPrefs = getSharedPreferences("USER_INFO", 0);
     myPrefsEdit.putString("USER_ID", username=tv1.getText().toString(););
     //This is the username you get from edittext
    
     myPrefsEdit.putString("PASSWORD", password);
     //this is the user password you get from edittext
    
     myPrefsEdit.commit();
    

    In your next activity.

    Get reference to your SharePreference like…

    SharedPreferences info = getSharedPreferences("USER_INFO, 0);
    String username = info.getString("USER_ID", "DOESNT EXIST");
    String userpassword = info.getString("PASSWORD", "DOESNT EXIST");
    

    This should do it

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

Sidebar

Related Questions

I'm new to Eclipse/Java/Android I have already created this project, but I wanted to
I'm completely new to Eclipse/Java/Android programming, so this might sound like a dumb question,
I am completely new to android, and pretty much a Java newb. I have
I'm relatively new to Java, eclipse and android so this could be a completely
I'm completely new to Android development, but I just got a HTC Hero and
I'm new to Android development and have some question regarding overlays in googlemaps API.
I'm new to Android development and have some question regarding overlays in googlemaps API.
I have an Android project completely fine, then I created a separate workspace and
I am completely new to Android development and have been reading many articles on
I'm completely new to programming on the Android platform but I'm interested in learning

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.