我得到了java.lang.runtimeexception
,java.lang.nullpointexception
请帮我处理这段代码。
package co.sds.iitr.bullsandcows;
import android.app.Activity;
import android.content.Intent;
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 MainActivity extends Activity implements OnClickListener {
TextView P1Num;
EditText np1;
Button btok;
String n;
int Num;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
P1Num = (TextView) findViewById(R.id.tvNum1);
np1 = (EditText) findViewById(R.id.etNum);
btok = (Button) findViewById(R.id.btNext);
btok.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
n = np1.getText().toString();
Num = Integer.valueOf(n);
Intent in = new Intent("co.sds.iitr.GUESSACTIVITY");
in.putExtra("Num", Num);
startActivity(in);
}