0

Hi iam working on android getting the following problem for my login but i didn't got my mistake... The error notice is the application has been terminated unexpectedly

my code is

 package layout.program;
import android.app.Activity;
import android.os.Bundle;
public class Tablelayout extends Activity{
public void onCreate(Bundle savedInstanceState){
 super.onCreate(savedInstanceState);
 setContentView(R.layout.tablelayout);
}
}

tablelayout.xml

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
 <TextView android:layout_height="wrap_content" android:text="TextView" android:id="@+id/textView1" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="wrap_content"></TextView>
 <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent">
 <requestFocus></requestFocus>
 </EditText>
</TableRow>
 </TableLayout>

snapshot of logcat and emulator

asked Sep 9, 2011 at 8:42
5
  • it is showing the error : the application has been terminated unexpectedly Commented Sep 9, 2011 at 8:45
  • check logcat and see the exception and post that.. Commented Sep 9, 2011 at 8:46
  • what is Exception it shows in the logcat? Commented Sep 9, 2011 at 8:47
  • logcat is not showing any thing... what to do?? iam editing my question with snapshot of emulator and logcat.... Logcat is showing empty screen Commented Sep 9, 2011 at 8:52
  • Click on the device tab and select your emulator there and after that your log cat will load Commented Sep 9, 2011 at 9:06

4 Answers 4

1

Try Cleaning your Project.. By Selecting the Project and then go to top project option and then select clean. and then select OK..

Sometimes Changes are not made in R.java...Thats y this error comes

answered Sep 9, 2011 at 9:08
Sign up to request clarification or add additional context in comments.

Comments

1

Your code is working fine at my end..please look in your code if there is anything which is causing the exception..Try to debug with debugger....

answered Sep 9, 2011 at 9:04

1 Comment

i tried it and its showing like this Source not found : A:\AndroidSDK\android-sdk\platforms\android-8\android.jar has no source attachment
1

There's nothing wrong with your code or xml, so it has to be an error in your manifest. As this application is just a stub, why not do this:

  • Create a new Android project, call it anything you like.

  • Call the activity 'TableLayoutActivity'

  • Put your tablelayout.xml into the layout folder.

  • Change the automatically generated code in TablelayoutActivity.java to set the content view from setContentView(R.layout.main) to setContentView(R.layout.tablelayout)

This should work, then have a look at the manifest in the new project, to see where you went wrong in your original project.

answered Sep 9, 2011 at 9:10

Comments

0

change the class name and try again,also check if the activity name mentioned in the android manifest is correct.

answered Sep 9, 2011 at 9:08

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.