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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:42:55+00:00 2026-06-13T05:42:55+00:00

How can I rename android text view dynamically? I want to assign a name

  • 0

How can I rename android text view dynamically? I want to assign a name depending on what edit text answer is given the name has to relate to a already created textview.
For instance name a is already assigned a res id in the xml
example
final TextView name a =
(TextView) this.findViewById(R.id.Texti5);

    editext.setOnKeyListener(new View.OnKeyListener() {
    public boolean onKey(View v, int keyCode, KeyEvent event) {
        // TODO Auto-generated method stub
        if (keyCode==KeyEvent.KEYCODE_ENTER) { 
            if("test1".equalsIgnoreCase(anstext.getText().toString())) {
                 // Here i want to give textview1 the 'name a'
                }}
            else
            if("test2".equalsIgnoreCase(editext.getText().toString())) {
                // Here i want to give textview1 the 'name b'
            }

        if("test5".equalsIgnoreCase(editext.getText().toString())) {
            // Here i want to give textview1 the 'name c'
        }

        if("test7".equalsIgnoreCase(editext.getText().toString())) {
            // Here i want to give textview1 the 'name d'
        }
        if (editext.getText().toString() != null){
          testwrong.seText("wrong");               }
        }
      // here i want to see what name is given and give the name to textview1 so i can 
         perform click on that textview as it is clickable
      textview1.performClck();
    return true;




    } });
  • 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-13T05:42:57+00:00Added an answer on June 13, 2026 at 5:42 am

    Perhaps a method that might achieve a similar goal is to give the textview a tag depending on your if statements.

    textview1.setTag("a");
    

    Then you can get the tag back like:

    if (textview1.getTag() == "a") {
    // do something
    }
    

    this would, at the very least, be more conventional than what you are proposing.

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

Sidebar

Related Questions

Given a zipfile with an unknown directory, how can I rename or move that
Possible Duplicate: Rename Oracle Table or View I know you can use ALTER TABLE
can someone please edit %:s/\([0-9]*\)_\(*\)/\2 so that i can rename files. for example, if
The title is self-explanatory, I want to know how I can rename a file
I'm using Python v2.x and am wondering how I can rename a known text
I want to programatically change a Sensor name, more specifically, I want to Rename
How can I rename empty package name in IDEA 11? I can rename only
I of course know that I can rename the init arg for an attribute
How can I rename all hidden directories under the current directory in DOS? I've
I can run RENAME TABLE student TO student_new ; The command is same and

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.