Я только начал изучать Android, и у меня есть следующая ошибка в моем первом примере, пожалуйста, помогите мне.
public class SecondActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button buttonNesnesi=(Button) findViewById(id.button1);
buttonNesnesi.setOnClickListener(
new OnClickListener()
{
public void onClick(View v)
{
Toast.makeText(SecondActivity.this, "Hello!!!",1000).show();
}
}
);
}
}
Исключение:
E / AndroidRuntime (543): java.lang.RuntimeException: невозможно запустить
деятельность
ComponentInfo {net.developersland / net.developersland.SecondActivity}:
java.lang.NullPointerException
А это мой main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<Button
android:id="@+id/button1"
android:layout_width="231dp"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>