Reputation: 2571
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>
Upvotes: 0
Views: 112
Reputation: 23873
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.
Upvotes: 1
Reputation: 41
change the class name and try again,also check if the activity name mentioned in the android manifest is correct.
Upvotes: 0
Reputation: 2823
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
Upvotes: 1
Reputation: 24031
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....
Upvotes: 1