Android简单数据存储类SharedPreferences详解及实例
2010-10-22 07:57:33 来源:WEB开发网android:orientation="horizontal" android:layout_marginTop="25dip">
< CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/cbrp"
android:text="记住密码" android:textSize="12px">< /CheckBox>
< CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/cbal"
android:text="自动登录" android:textSize="12px">< /CheckBox>
< /LinearLayout>
< /LinearLayout>
java代码
package com.wjq;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.wjq.beans.User;
import com.wjq.func.UserMgr;
public class Login extends Activity {
private EditText etAccount;
private EditText etPW;
private Button btnLogin;
private Button btnExit;
private CheckBox cbrp;
private CheckBox cbal;
private UserMgr userMgr;
private User user;
private SharedPreferences sp;
private TextView tvClear;
/*
* (non-Javadoc)
*
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
更多精彩
赞助商链接