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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:53:15+00:00 2026-06-13T14:53:15+00:00

I have been tweaking my main xml layout, adjusting the different views’ positions in

  • 0

I have been tweaking my main xml layout, adjusting the different views’ positions in my relative layout, and suddenly when I started it on my emulator, it crashed with the message:ClassCastException

My XML :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >

 <com.example.bingbong.Render
    android:id="@+id/render"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@color/pattern5"
    android:clickable="true" />

<TextView
    android:id="@+id/fps"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:text="fpasds"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/score_top"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:text="asd"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/score_bot"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    android:text="asfa"
    android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>

The error log:

10-30 20:25:33.266: E/AndroidRuntime(269): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bingbong/com.example.bingbong.Main_Activity}: java.lang.ClassCastException: android.widget.TextView
...
10-30 20:25:33.266: E/AndroidRuntime(269): Caused by: java.lang.ClassCastException: android.widget.TextView
10-30 20:25:33.266: E/AndroidRuntime(269):  at com.example.bingbong.Main_Activity.onCreate(Main_Activity.java:26)

The Main_Activity – where line 26 is :

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.main_layout);
        r = (Render) findViewById(R.id.render);   // <--- Line 26.
        r.setView((TextView)findViewById(R.id.fps),(TextView)findViewById(R.id.score_top),(TextView)findViewById(R.id.score_bot));
    }
  • 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-13T14:53:16+00:00Added an answer on June 13, 2026 at 2:53 pm

    I get this occasionally if I am moving around views or changing the types of views (ie, a TextView change to a Button, or something like that). What usually fixes it for me is to do a clean build.

    In the “Project” menu in Eclipse, select “Clean…” and either do all projects or select that particular project.

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

Sidebar

Related Questions

I have been tweaking a regular expression over several days to try to capture,
Have been trying to encrypt an xml file to a string so that I
Have have been trying to make a validator for my xml files. I have
I have been tweaking Ruby code on sonar 2.13.1 for a couple of days.
I have been tweaking my program all day and I am having a problem
I have been tweaking with below sample code. The documentation for MathJax isn't very
I have been developing and tweaking things as much as I can and know
I have been currently tweaking my Vim _gvimrc file to add a few features
Have been working on this question for a couple hours and have come close
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only

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.