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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:17:58+00:00 2026-05-28T05:17:58+00:00

with this code, my program just force close(error) ***public View x = findViewById(R.string.nfoname);*** @Override

  • 0

with this code, my program just force close(error)

***public View x = findViewById(R.string.nfoname);***
@Override
public void onCreate(Bundle savedInstanceState) {    
super.onCreate(savedInstanceState);    
setContentView(R.layout.information);
//edittext
***final EditText infoname=(EditText)findViewById(R.id.infoname);***

//clear,confirm
Button clear = (Button)findViewById(R.id.buttonclear);
Button confirm = (Button)findViewById(R.id.buttonconfirm);

//clear button
clear.setOnClickListener(new View.OnClickListener() {       
    public void onClick(View v) {
        // TODO Auto-generated method stub
        infoname.setText("");
    }
});
//confirm button
confirm.setOnClickListener(new View.OnClickListener() {     
    public void onClick(View v) {

        ***x=(View) infoname.getText();***
    }
});
}

the one with the * are the source of error

program function:
if the user clicks confirm, his name will be set to R.string.nfoname
which will then be used in another layout through TextView x = setText(R.string.nfoname);

  • 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-28T05:17:59+00:00Added an answer on May 28, 2026 at 5:17 am

    I am not sure that you can save text to the R.string. This is a generated class that the compiler creates for you. It gets packaged with your apk. Think of the resources as a means of translation and to present text to the screen.

    I think what you would want to do is save the user input as a SharedPreference or in a database.

    See:SharedPreferences on the android docs for an example usage.

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

Sidebar

Related Questions

I have this code in my program: (I included the cout statements for debugging
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' to
This snippet of Perl code in my program is giving the wrong result. $condition
Code first: '''this is main structure of my program''' from twisted.web import http from
I have a piece of code like this: Class Program { static StreamReader sr
Well, I have this bit of code that is slowing down the program hugely
I have this program that should execute a piece of code base on the
This is the example code, I'm using these functions for a program, but scanf
I have some code that effectively does this : File file = new File(C:\\Program
For the following code fragment. /*This program demonstartes how a virtual table pointer *

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.