⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac01.java

📁 Google Android应用框架原理与程序设计 第三版(中文高清PDF)高焕堂
💻 JAVA
字号:
package com.misoo.ex01_06;import android.app.Activity;import android.content.Intent;import android.content.SharedPreferences;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.TextView;public class ac01 extends Activity implements OnClickListener {    /** Called when the activity is first created. */	private boolean init_state = false;	Button btn, btn2;	@Override    public void onCreate(Bundle icicle) {        super.onCreate(icicle);        init_state = true;        setContentView(R.layout.ac01);        btn = (Button)findViewById(R.id.pu_btn);        btn.setOnClickListener(this);        btn2 = (Button)findViewById(R.id.exit_btn);        btn2.setOnClickListener(this);     }   	 @Override	    protected void onResume() {	        super.onResume();	        if(init_state)	        	{ 	        	  init_state = false;	        	  return;	        	}	     SharedPreferences passwdfile = getSharedPreferences(                   "ITEM", 0);          String im = passwdfile.getString("ITEM", null);          TextView tv = (TextView)findViewById(R.id.tv);         tv.setText("choice: " + im);		       	    }	    public void onClick(View v) { 	if (v == btn){		Intent in = new Intent(ac01.this, pickup.class);        startActivity(in);       }     if(v == btn2){   		  this.finish();         }      } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -