安卓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