2013年4月29日 星期一

[Android] remember me checkbox


private CheckBox checkBox;
SharedPreferences login_pref;
private SharedPreferences.Editor loginPrefsEditor;
private Boolean saveLogin;

// onCreate

username = (EditText) findViewById(R.id.editText_username);
password = (EditText) findViewById(R.id.editText_password);
login = (Button) findViewById(R.id.button_login);
checkBox = (CheckBox)findViewById(R.id.checkBox1);
login.setOnClickListener(this);

login_pref = getSharedPreferences("loginPrefs", MODE_PRIVATE);
loginPrefsEditor = login_pref.edit();
saveLogin = login_pref.getBoolean("saveLogin", false);
if (saveLogin == true) {
        username.setText(login_pref.getString("username", ""));
        password.setText(login_pref.getString("password", ""));
        checkBox.setChecked(true);
}

2013年4月25日 星期四

PandaBoard driver install

PandaBoard Driver Install

find sdk\extras\google\usb_driver\android_winusb.inf
open it and
add:

;OMAP-3/4 
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_D002&REV_0216 
%CompositeAdbInterface% = USB_Install, USB\VID_0451&PID_D102&MI_01 
%CompositeAdbInterface% = USB_Install, USB\VID_0451&PID_D106&MI_02 
%CompositeAdbInterface% = USB_Install, USB\VID_0451&PID_D107&MI_03 
%SingleAdbInterface% = USB_Install, USB\VID_0451&PID_FFFFE 
%CompositeAdbInterface% = USB_Install, USB\VID_0451&PID_FFFE&MI_01

in [Google.NTx86]


( PandaBoard 硬體識別碼)

設定好之後, 再更新驅動程式 from sdk\extras\google\usb_driver folder
便可以順利安裝

2013年4月18日 星期四

[Android] NFC API application

如何註冊我的APP是NFC程式呢?


1. 首先要先開起 AndroidManifest.xml

<activity android:configchanges="locale" android:label="@string/app_name" android:name=".MyNfc" android:screenorientation="portrait">
    <intent-filter>
        <action android:name="android.intent.action.MAIN">
        <category android:name="android.intent.category.LAUNCHER">
    </category></action>
</intent-filter>

    <intent-filter>
            <action android:name="android.nfc.action.TAG_DISCOVERED">              
    </action>
   </intent-filter>        
    <intent-filter>
            <action android:name="android.nfc.action.TECH_DISCOVERED">                              
    </action></intent-filter>
    <meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter.xml">              
</meta-data>
</activity>