标签:android style color io os ar 使用 java sp
============问题描述============
package com.example.message; import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsManager; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { public Button send; public EditText number,message; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); send = (Button)this.findViewById(R.id.send); number = (EditText)this.findViewById(R.id.number); message = (EditText)this.findViewById(R.id.msg); send.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub sendMessage(); } }); } public void sendMessage(){ String pnumber = number.getText().toString().trim(); String msg = message.getText().toString().trim(); PendingIntent sentIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0); if("".equals(msg)||"".equals(pnumber)){ Toast.makeText(this, "需要填写号码,切短信内容不能为空", Toast.LENGTH_LONG).show(); }else{ Log.i("message", "接收者:"+pnumber+" 信息:"+msg); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(pnumber, "13652179825", msg, sentIntent, null); Toast.makeText(this, "发送成功!", Toast.LENGTH_LONG).show(); } } @Override 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; } }
============解决方案1============
============解决方案2============
============解决方案3============
标签:android style color io os ar 使用 java sp
原文地址:http://www.cnblogs.com/meizhenfen42/p/4041905.html