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
-
it is showing the error : the application has been terminated unexpectedlyRAVITEJA SATYAVADA– RAVITEJA SATYAVADA2011年09月09日 08:45:19 +00:00Commented Sep 9, 2011 at 8:45
-
check logcat and see the exception and post that..Pa.M– Pa.M2011年09月09日 08:46:08 +00:00Commented Sep 9, 2011 at 8:46
-
what is Exception it shows in the logcat?Balaji.K– Balaji.K2011年09月09日 08:47:12 +00:00Commented 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 screenRAVITEJA SATYAVADA– RAVITEJA SATYAVADA2011年09月09日 08:52:13 +00:00Commented Sep 9, 2011 at 8:52
-
Click on the device tab and select your emulator there and after that your log cat will loadAurelian Cotuna– Aurelian Cotuna2011年09月09日 09:06:14 +00:00Commented Sep 9, 2011 at 9:06
4 Answers 4
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
Comments
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....
1 Comment
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.
Comments
change the class name and try again,also check if the activity name mentioned in the android manifest is correct.