|
94Java代碼
public class CMCCPhoneBillQueryActivity extends Activity { private static final int MENU_OFFER = 1; private static final int MENU_ABOUT = 2; private static final int MENU_EXIT = 3; private Button query ; private String num ; private String text; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); num = getString(R.string.receiver_value); text = getString(R.string.query_value); query = (Button)findViewById(R.id.query); query.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmsManager smsMgr = SmsManager.getDefault(); smsMgr.sendTextMessage(num, null, text, null, null); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, MENU_ABOUT, 1, R.string.menu_about).setIcon( android.R.drawable.ic_menu_info_details); menu.add(0, MENU_EXIT, 1, R.string.menu_exit).setIcon( android.R.drawable.ic_menu_close_clear_cancel); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_ABOUT: showAboutDialog(); break; case MENU_EXIT: this.finish(); break; } return super.onOptionsItemSelected(item); } protected void showAboutDialog(){ TextView info = new TextView(this); info.setText(R.string.about); new AlertDialog.Builder(this) .setTitle(getResources().getText(R.string.app_name)) .setIcon(android.R.drawable.ic_dialog_info) .setView(info) .show(); } }
CMCCPhoneBillQuery.zip (140.1 KB)描述: 解壓以后安裝即可下載次數(shù): 317
源碼.zip (99.8 KB)下載次數(shù): 119
|
上一篇: androud異步加載,處理圖片溢出下一篇: Android中基于XMPP協(xié)議的即時(shí)聊天系統(tǒng)的開(kāi)發(fā)筆記 - 注冊(cè)、登陸
|