本文主要是介绍短信快速回复(源码),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
安卓WIFI密码破解工具编写初探
http://www.eoeandroid.com/thread-207054-1-1.html
拉响手机QQ安全警报:聊天记录查看器的编写
http://www.eoeandroid.com/thread-207064-1-1.html
在GridView中实现单选或多选功能
http://www.eoeandroid.com/thread-207099-1-1.html
根据别人的代码写了一个demo,是短信快速回复的功能,主要是学习了服务和广播监听的简单用法
主界面
SmsReceiverActivity.java
package zdq.msg; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.widget.Toast; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; public class SmsReceiverActivity extends Activity { private Button bt01; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); getview(); bt01.setOnClickListener(bt01_onclick); } private void getview(){ bt01=(Button)findViewById(R.id.bt01); } private OnClickListener bt01_οnclick=new OnClickListener(){ @Override public void onClick(View v) { if(bt01.getText().equals(getResources().getString(R.string.bt01))){ Intent intent = new Intent(); intent.setClass(SmsReceiverActivity.this, Smsservice.class); startService(intent); bt01.setText(R.string.bt02); Toast.makeText(SmsReceiverActivity.this, "打开监听", Toast.LENGTH_SHORT).show(); }else{ Intent intent = new Intent(); intent.setClass(SmsReceiverActivity.this, Smsservice.class); stopService(intent); bt01.setText(R.string.bt01); Toast.makeText(SmsReceiverActivity.this, "关闭监听", Toast.LENGTH_SHORT).show(); } } }; public boolean onCreateOptionsMenu(Menu menu){ menu.add(0,0,0,R.string.about); menu.add(0,1,1,R.string.exit); return super.onCreateOptionsMenu(menu); } public boolean onOptionsItemSelected(MenuItem item){ super.onOptionsItemSelected(item); switch(item.getItemId()){ case 0: openDialog(); break<
这篇关于短信快速回复(源码)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!