What i am doing wrong with Class Overview?
Posted
by RFM software
on Stack Overflow
See other posts from Stack Overflow
or by RFM software
Published on 2010-06-08T15:07:44Z
Indexed on
2010/06/08
15:22 UTC
Read the original article
Hit count: 233
This code not work. Anyone can helpme?
.java
package rfmsoftware.util.test1;
import android.app.Activity;
import android.os.Bundle;
public class test1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)findViewById(R.id.Button01); <---- Error at this line !?
}
}
.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<EditText android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10"></EditText>
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Scan"></Button>
<View android:id="@+id/View01" android:layout_width="wrap_content" android:layout_height="wrap_content"></View>
</LinearLayout>
.error
Button cannot be resolved to a type (type Java problem) ???
© Stack Overflow or respective owner