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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:21:18+00:00 2026-06-04T07:21:18+00:00

So, starting with Android and Java, and I have this baffling error: The application

  • 0

So, starting with Android and Java, and I have this baffling error: The application fails with a stopped unexpectedly message when reaches a findViewByID(R.id.answer) but only if I add another one to the code.

The code is as below:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical" android:layout_width="match_parent"
            android:layout_height="match_parent">
  <LinearLayout android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="@string/site" />
    <EditText android:id="@+id/site" 
             android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_weight="1"/>
  </LinearLayout>
  <!-- 
  <LinearLayout android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="@string/username" />
    <EditText android:id="@+id/username" 
      android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_weight="1"/>
  </LinearLayout>
   -->
  <LinearLayout android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="@string/password" />
    <EditText android:id="@+id/password" 
      android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_weight="1"/>
  </LinearLayout>
  <LinearLayout android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="@string/question" />
    <EditText android:id="@+id/question" 
      android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_weight="1"/>
  </LinearLayout>
  <LinearLayout android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="@string/answer" />
    <EditText android:id="@+id/answer" 
      android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_weight="1"/>
  </LinearLayout>
  <Button android:id="@+id/confirm" 
          android:text="@string/confirm"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
</LinearLayout>

OnCreate method

 super.onCreate(savedInstanceState);
 setContentView(R.layout.keyedit);
 setTitle(R.string.edit_entry);
 mDbHelper = new KeyRingDbAdapter(this);
 mDbHelper.open();
 mSiteText = (EditText) findViewById(R.id.site);
 //mUsernameText = (EditText) findViewById(R.id.username);
 mPasswordText = (EditText) findViewById(R.id.password);
 mQuestionText = (EditText) findViewById(R.id.question);
 mAnswerText = (EditText) findViewById(R.id.answer);

So, the above works and the line mAnswerText = (EditText) findViewById(R.id.answer); assigns the right object to mAnswerText. Once I uncomment the code, that same line, that has worked before, fails. When I see the xml on the graphical layout, all appears correctly. The R file seems to be ok (I deleted it and go it regenerated, just in case).

Any ideas? Any more info needed?

EDIT: Well, awkward. Last night I got home and, when I uncommented the lines, this time it worked. I am experienced enough as programmer and I did enough checking to know that it wasn’t me just uncommenting part or doing something else entirely stupid. Though it could have been something related to the fact that I am new to Eclipse as well. Not cool, as right now the error has been fixed “magically” and I am not the wiser.

  • 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-04T07:21:19+00:00Added an answer on June 4, 2026 at 7:21 am

    I faced the same issue today. In a RelativeLayout I reordered the layout xml file – and got this error.

    I cleaned the project (Eclipse: Project / Clean) et voilà it worked again.

    Eclipse help: “Clean – This command discards all previous build results. If autobuild is on, then this invokes a full build.”

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

Sidebar

Related Questions

Starting from Android 3.2 I have this strange problem. It's very easy to reproduce:
I'm starting at the android and java now, and I have a problem. I
as someone's who's just starting to get into Android/Java programming, I've read the docs
I'm starting Android Market via my app to search for similar products using this
I have the following scenario: android up, compatible starting with android 1.6 and up.
I am starting to build my first Android app. I have reached the point
I'm starting to get into libGDX game engine. I have copied this example and
Hi I'm starting with android developing, and I have to create a login form
so I am starting to learn how to develop Android Applications. I have experience
I'm just starting out with learning Java, and have run into a problem. When

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.