-3
ADT說最後一行有語法錯誤,並且該行有多個標記。只有錯誤導致我的ADT阻止編譯。我相信它在代碼的上半部分中,找不到它。希望有人幫助!是否有語法錯誤?
public class MainActivity extends Activity {
Button btnSendSMS;
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
btnSendSMS.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v)
{
sendSMS("5566", "Hello my friends!");
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
//---sends an SMS message to another device---
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
}
}
}
錯誤是什麼意思? – arshajii
對不起,剛發佈的完整代碼。 – Joshua
但是你還沒有發佈錯誤是什麼。 – arshajii