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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:32:46+00:00 2026-05-29T16:32:46+00:00

Im a newbie in android development and thats why im asking you experts such

  • 0

Im a newbie in android development and thats why im asking you experts such a simple problem

I created a table view and it is working fine.

I tried to move to a new view when clicking on the first cell and for that i created a new file Newview.java.

But when clicking on the first cell app is crashing and showing the message “Unfortunately HelloTableLayout has stopped”.

Can anyone please help me with this.

HelloTableLayoutActivity.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class HelloTableLayoutActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TextView name =  (TextView)findViewById(R.id.label);
        name.setOnClickListener(new View.OnClickListener()
        {

                    public void onClick(View v) {
        Intent nameActivity =new Intent();
        nameActivity .setClass(getApplicationContext(), Newview.class);
        startActivity(nameActivity);

    }
        });
    }
}

Main.xml

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="1">

    <TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="@string/name"
            android:padding="3dip" />
        <TextView
            android:text="@string/initial"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>

    <TableRow>
        <TextView
            android:layout_column="1"
            android:text="@string/hometown"
            android:padding="3dip" />
        <TextView
            android:text="@string/state"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>      
</TableLayout>

Newview.java

import android.app.Activity;
import android.os.Bundle;

public class Newview extends Activity
{
 /** Called when the activity is first created. */

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.foo);
    }
}

HelloTableLayout Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sweans.tb"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
         >
        <activity
            android:label="@string/app_name"
            android:name=".HelloTableLayoutActivity">
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity 
            android:name=".NewviewActivity"
            android:label="@string/app_name"
            >
        </activity>

    </application>

</manifest>

foo.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />


</LinearLayout>

Can anyone please help me where im going wrong in my code and why the app is crashing.

Thanks in advance.

  • 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-29T16:32:53+00:00Added an answer on May 29, 2026 at 4:32 pm

    Please change the following code .

     Intent nameActivity =new Intent();
     nameActivity .setClass(getApplicationContext(), Newview.class);
     startActivity(nameActivity);
    

    with the below code.

    Intent nameActivity =new Intent(HelloTableLayoutActivity.this,Newview.class);
     startActivity(nameActivity);
    

    and define your Newview class in android manifest file.

    <activity android:name=".Newview" > </activity>
    

    Because as you call Newview from your main class and you declare NewviewActvity class in android manifest file , so when you click on textview at that time android finds the Newview class in android manifest file, because it not present in that manifest file your application goest to crash.

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

Sidebar

Related Questions

Hi am newbie to android development. I had created one application where i need
I am a newbie in Android app development, I tried to create a nested
I am a newbie to android development.Now i would like to do gallery view
Extreme Android developer newbie here...well, new to Android development, not development in general. I
Everyone, I am a newbie to android development. Now I have a question that
I am a newbie to android app development. I want to customize my android
I am a newbie to Android and the Eclipse development environment and would like
As a newbie to Android development, I'm trying to do the basics and build
I am a newbie to android development, and would like to know if it
I am newbie to android game development. I've been trying an example of game

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.