-3

最后一行和第 4 行“EditText numTxt;” 包含错误但我似乎无法解决它们,它说缺少一个},但是当我输入这些或其他类似的东西时它没有解决。不知道这里有什么问题,但我正在关注一个教程,这正是代码的样子

 public class SecondScreen extends Activity {
Button sendSMS;
EditText msgTxt;
EditText numTxt;

@Override
 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.secondscreen);

    TextView SecondScreenText = (TextView) findViewById(R.id.SecondScreenText);

    Intent i = getIntent();
    // Receiving the Data
    String value = i.getStringExtra("value");


    // Displaying Received data
    SecondScreenText.setText(value);

    sendSMS = (Button) findViewById(R.id.sendsms);
    msgTxt = (EditText) findViewById(R.id.message);
    numTxt = (EditText) findViewById(R.id.number);
    sendSMS.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String myMsg = msgTxt.getText().toString();
            String theNumber = numTxt.getText().toString();
            sendMsg(theNumber, myMsg);



    Button next = (Button) findViewById(R.id.Button02);
    next.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent intent = new Intent();
            setResult(RESULT_OK, intent);
            finish();
        }


    });
        }


protected void sendMsg(String theNumber, String myMsg) {
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(theNumber, null, myMsg, null, null);
}
    }
4

1 回答 1

0

只需使用此语句完成来结束您的代码,这意味着:

protected void sendMsg(String theNumber, String myMsg) {
   SmsManager sms = SmsManager.getDefault();
   sms.sendTextMessage(theNumber, null, myMsg, null, null);}
                  });}}

希望能帮到你。

于 2013-04-22T22:12:48.243 回答