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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:01:36+00:00 2026-05-24T06:01:36+00:00

I am relatively new to Android development but I do have a pretty good

  • 0

I am relatively new to Android development but I do have a pretty good understanding of Java and xml etc. so excuse me if this is an easy question and I just can’t put two and two together.

Anyway, I am trying to have a user input a few characters into an EditText field. When they press a Button, it will call a method that will output a String. I then want this String to be displayed on the same activity as the EditText field and Button.

How do I go about taking the String variable that is the result of the method and putting into a String in the strings.xml file?

  • 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-24T06:01:37+00:00Added an answer on May 24, 2026 at 6:01 am

    See this question. I don’t think that is possible, what you probably want to do is store what the user enters in SharedPreferences.

    EDIT:
    To take the string variable and display it on the screen you would want to add a TextView to your layout:

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/textview"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:text=""/>
    

    Then in code you will add a listener to your button to listen for click events, and have a reference to the TextView in your class:

    Fields in class:

    TextView tv;
    Button myButton;
    EditText et;
    
    onCreate():
    
    tv = (TextView)findViewById(R.id.textview);
    myButton = (Button)findViewById(R.id.button);
    et = (EditText)findViewById(R.id.edittext);
    
    //Now set the onclick listener:
    myButton.setOnClickListener(new Button.OnClickListener() {
    public void onClick(args....) 
    {
        String txt = et.getText().toString();
        tv.setText(txt);
    }
    });
    

    Also check out this tutorial.

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

Sidebar

Related Questions

I'm relatively new to java and android development so sorry if this is a
I am new to Java programming / Android development - but I have been
I'm relatively new to Java, eclipse and android so this could be a completely
I'm relatively new to Android development and Java (learning both simultaneously sort of...). My
I am relatively new to android. I have two applications A and B. I
I'm relatively new to Java and am used to generics in C# so have
I'm relatively new to java and android, in my android application I need to
I am relatively new to Android development and a quick google search turned up
I am new to Java / Android development, and I am now trying to
I am relatively new to Android Animation and Gestures. I have 15 images that

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.