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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:41:43+00:00 2026-05-31T06:41:43+00:00

Ok I have declared my main.xml as follows <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=wrap_content

  • 0

Ok I have declared my main.xml as follows

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal" >

<RelativeLayout
    android:id="@+id/AdMob"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true" >
</RelativeLayout>

<ScrollView
    android:id="@+id/scrollview1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/AdMob" >

    <TableLayout
        android:id="@+id/tablelayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TableRow
            android:id="@+id/tableRow0"
            android:layout_height="wrap_content"
            android:background="@drawable/banner" />

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/start_message"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"
                android:textSize="15sp" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/start"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:text="Start Now" >
            </Button>
        </TableRow>
    </TableLayout>
</ScrollView>

</RelativeLayout>

and my main activity is

package com.michaelpeerman.demotivational_posters;

import com.michaelpeerman.demotivational_posters.R;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    TextView start_message = (TextView) findViewById(R.id.start_message);
    start_message.setText(Html.fromHtml("Thank you for downloading \"Demotivational Posters\" \n Click start below to start. \n To advance to the next picture click the \"Next\" button. \n If you see an image you would like to download click the \"Download\" button. \n If you enjoy this app please leave a rating."));
}
}

When i go to compile my program it force closes automatically. The logcat output is

03-13 01:59:50.240: E/AndroidRuntime(14336): FATAL EXCEPTION: main
03-13 01:59:50.240: E/AndroidRuntime(14336): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.michaelpeerman.demotivational_posters/com.michaelpeerman.demotivational_posters.MainActivity}: java.lang.ClassCastException: android.widget.TableRow cannot be cast to android.widget.TextView
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.os.Looper.loop(Looper.java:137)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread.main(ActivityThread.java:4424)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at java.lang.reflect.Method.invokeNative(Native Method)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at java.lang.reflect.Method.invoke(Method.java:511)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at dalvik.system.NativeStart.main(Native Method)
03-13 01:59:50.240: E/AndroidRuntime(14336): Caused by: java.lang.ClassCastException: android.widget.TableRow cannot be cast to android.widget.TextView
03-13 01:59:50.240: E/AndroidRuntime(14336):    at com.michaelpeerman.demotivational_posters.MainActivity.onCreate(MainActivity.java:16)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.Activity.performCreate(Activity.java:4465)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-13 01:59:50.240: E/AndroidRuntime(14336):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
03-13 01:59:50.240: E/AndroidRuntime(14336):    ... 11 more

I can not figure out what it means that i casted the tablerow to textview

  • 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-31T06:41:44+00:00Added an answer on May 31, 2026 at 6:41 am

    You need to clean and rebuild your project once again. If that is not working then close your project and open once again refresh the project and run. I tried with your given code. It is working in my case.

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

Sidebar

Related Questions

I have a ContentProvider class and is declared in AndroidMenifest.xml like this: <provider android:name=.MediaSearchProvider
I have an ImageView declared in main.XML . I want it to be Zoomed
I have a COM object written using the MS ATL library. I have declared
In my android application I have created 2 projects. The main project and a
I am building an Android app that uses wifi. I have properly declared these
I have 2 layout xml files: highlights.xml and highlights_cell.xml. Here is a simplified version
We have an XSD which validates an XML document with a namespace declared, but
I have a task to add a composite widget into the main ui.xml file,
I have the new 15 version android sdk and the new admob sdk. On
i have declared a variable in the class 'Main' with name 'context2'. But i

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.