android new view,android
我在Button和EditText的以下代码中遇到上述错误.我只是不知道为什么会这样.如果你们能理解并告诉我这里到底出了什么问题,那就太好了.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Activity2 extends Activity {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity2);
Button btn = (Button) findViewByID(R.id.btn_OK);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent data = new Intent();
EditText txt_username = (EditText) findViewByID(R.id.txt_username);
data.setData(Uri.parse(txt_username.getText().toString()));
setResult(RESULT_OK, data);
finish();
}
});
}
}