TextView t =(TextView)findViewById(R.id.place);
t.setText("A");
i call the above code inside onCreate() method. My activity is a ListActivity. But why this gives me the following error
05-04 14:21:40.840: E/AndroidRuntime(16168): Caused by: java.lang.NullPointerException
and here is the XML where i defined TextView
<TextView android:id="@+id/place"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="16sp"
android:textStyle="bold"
android:focusable="false"
android:text=""
android:layout_gravity="left"/>
and how to fix it?
1 Answer