hrloo.java
view plaincopy to clipboardprint?
package hello.pak;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class hrllo_act<heloo> extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn=(Button)findViewById(R.id.go);
btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
EditText edt=(EditText)findViewById(R.id.edt);
TextView txt= (TextView)findViewById(R.id.txt);
txt.setText(getString(R.string.go)+edt.getText());
}
});
}
}
main.xml
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android

rientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<EditText id="@+id/edt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<Button id="@+id/go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/go">
<requestFocus />
</Button>
</LinearLayout>
strings.xml
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, hrllo_act!</string>
<string name="app_name">heloo_app</string>
<string name="go">go,go,go</string>
</resources>
i think maybe folowing code have error:
view plaincopy to clipboardprint?
EditText edt=(EditText)findViewById(R.id.edt);
TextView txt= (TextView)findViewById(R.id.txt);
thank you!