» android の記事

~ android disable back button in activity ~

connie 2015.11.03 | android | | No Comments

commnet all the things in
public void onBackPressed(){

}

~ android studio include library ~

connie 2015.10.30 | android | | No Comments

add new andorid library
Gradle
build.gradle(module:app)

compile project(':libraryname');

 

sync

~ remove action Items ~

connie 2015.10.23 | android | | No Comments

QQ截圖20151023114542

res/menu/main_activity_actions.xml

del <item> tag

~ 鎖定android 顯示畫面 ~

connie 2015.10.13 | android | | No Comments

Inside activity tag
android:screenOrientation="portrait"
if you want VERTICAL fixed orientation

android:screenOrientation="landscape" if you want HORIZONTAL fixed orientation

~ encrypt and Decrypt the sqlite ~

connie 2015.07.15 | android | | No Comments

encrypt the DB

sqlcipher plaintext.db
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey';
sqlite> SELECT sqlcipher_export('encrypted');
sqlite> DETACH DATABASE encrypted;

========
TEST DB

hexdump -C plaintext.db
hexdump -C encrypted.db

decrypt the DB

$ ./sqlcipher encrypted.db
sqlite> PRAGMA key = 'testkey';
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';  — empty key will disable encryption
sqlite> SELECT sqlcipher_export('plaintext');
sqlite> DETACH DATABASE plaintext;

To Solve the problem 

Go to 

/Users/username/Library/Preferences/ 

del 

com.BlueStacks.AppPlayer.Guid.plist
com.BlueStacks.AppPlayer.plist 

 

必需東西

  1. Root機(笑,未root 可以再見了
  2. Android Terminal Emulator , 即putty
  3. Hacker's Keyboard , 感覺好小小既keyboard skin,最小你會講小左好多粗口:)
  4. Complete Linux Installer , linux container
  5. Astro File , android file system

 安裝晒以上東東後,開啟 Complete Linux Installer 

去install guides 到choose 你要安裝既OS 到,尼到會用ubuntu 12.04 尼做example

Screenshot_2013-04-01-19-47-49

Page 1 主要係叫你開USB debugging mode , 同夠位donwload ubuntu OS images

Screenshot_2013-04-01-19-47-58

之後Page2 donwload image 

Screenshot_2013-04-01-19-48-01

之後有3個size可以 download , 睇餸食飯。

Screenshot_2013-04-01-19-52-28

sourceforge 係幾好,用4G download 都好快完成, (小妹係唔係就係另mobile network 塞車的兇手,喂

Screenshot_2013-04-01-19-52-31

download 完成後就解壓,內有2個file , 一個係img , 一個係md5

Astro File check 一下md5 有無問題,按實>properties>MD5 checksum

之後將img放到你想放既位置。

完成後回到Complete Linux Installer , 去launch

SETTINGS>Edit 變更images link

save> Start Linux

開了後會自動跳到Android Terminal Emulator,問你開唔開ssh, vnc, y晒佢你就有好日子過

之後save ,一切都變回你懂的東西,update 一野

apt-get upgrade && update

install LAMP

apt-get install apache2 mysql-server php5

Screenshot_2013-04-01-19-23-02

完成

   

Apache cordova 前身係phonega, 用來將HTML5 + jQuery web apps 變成native apps 用的

本文將記錄如何setting 及製作native android apps

[1]initiation

[1]ADT bundle for windows

先到http://developer.android.com/sdk/index.html

ADT bundle for windows or MAC, 已經包括了Eclipse 同android sdk , download 爆開佢就完成。

double Click 就可以用。

[2]apache cordova

是次主角, 先到http://phonegap.com/download/ ,下載後爆開佢備用

[2]Create project

-入到Eclipse , create new porject, FIle>new Android Application Project

01

-Application Name 最好upper case

02

-Next

03

-Next

04

-Next

05

-Next

06

-Finish

[3]Copy File to the Project

去返之前爆開個file 個folder , phonegap-2.3.0\lib\android

  1. 將cordova-2.3.0.jar 抄去eclipse project 既/libs 內
  2. Create a new folder in eclipse project 的assets,named "www",  再將cordova-2.3.0.js 抄去eclipse project 既/assets/www 內

07

-之後右Click /libs/cordova-2.3.0.jar , 將這個library 加入去尼個project 到 Build Path>Add to Buld Path

08

-之後將所有webapps file 抄去 assets/www 內,注意不可以有server side script(php/asp/jsp) , 只support js , html

[4]Edit src/MainActivity

  1. 先加入此句 import org.apache.cordova.DroidGap;
  2. 刪除這句import android.app.Activity;
  3. public class MainActivity extends Activity { 改成 public class MainActivity extends DroidGap {
  4. protected void onCreate(Bundle savedInstanceState) { 改成 public void onCreate(Bundle savedInstanceState) {
  5. setContentView(R.layout.activity_main); 改成 super.loadUrl("file:///android_asset/www/examples/01-default.html");

This is before

09

This is After

10 

-通常會係super.loadUrl("fileL///android_asset/www/index.html")

[5]edit rights for apps

最後修改apps之權限

-到eclipse project 既androidManifest.xml 右click >open with > text editor

11

[A]搵以下的code

android:versionCode="1"
android:versionName="1.0" >

加入以下的code

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

[B]再找以下的code

android:name="hk.connie.webapps.MainActivity"
android:label="@string/app_name" >

改成

android:name="hk.connie.webapps.MainActivity"
android:label="@string/app_name" 
android:configChanges="orientation|keyboardHidden">

完成

 

~ Samsung Galaxy Note 2 LTE ROOT機 方法 ~

connie 2012.12.24 | android | | No Comments

在DropBox 下載以下file
[android/root_app]
-Odin v3.07
-CWM Recovery 6.0.1.5
-CF-Auto-Root-t0lte-t0ltexx-gtn7105.zip
-N7105ZHALJ4_N7105ZZHALJ4_TGY.zip
-Triangle Away 2.37

root機方法如下:
1]請到手機內設定 > 開發人員選項 > USB偵錯打勾
2]手機關機
3]同時長按手機的三個按鍵 音量鍵下+HOME+電源鍵[Vol down + Home + Power] 進入模式,在按音量鍵上進入到download模式
4]電腦端打開odin
5]在PDA欄瀏覽已下載的ROOT檔案CF-Auto-Root-t0lte-t0ltexx-gtn7105.zip
6]USB 接入電腦, 當手機和電腦連線後ID : COM 出現COM PORT
7]按START 開始
8]當ROOT成功後, ODIN 畫面的ID:COM 上面會顯示 PASS , 手機便自動重啟開機.
9]ROOT 完成 !

還原root方法:
1]下載 [root] Triangle Away 2.37
2]開啟 [root] Triangle Away 選擇 Rest flash counter 出現視窗按下 continue
3]畫面如果黑色不要緊 等到出現官方的字樣就好
4]出現了超大黃色三角圖案 請按下音量鍵上即可
5]重新開機之後 請關閉手機
6]使用過編號8方法請往下步驟開始 請關閉手機
7]同時長按手機的三個按鍵 音量鍵下+HOME+電源鍵[Vol down + Home + Power] 進入注意模式,在按音量鍵上進入到download模式
8]電腦端打開odin
9]在PDA欄瀏覽已下載的官方ROM官方版本

~ root 機後去日本Google Play Store ~

connie 2012.12.23 | android | | No Comments

先到DropBox下載
/android/[IMPORTANT_APP]
-MarketEnabler_v3113.apk

1]到 Custom 輸入: 44010(模擬為 NTT 的 sim 咭)
2]之後按home制不放,強制關閉google play
3]setting->Application manager->ALL->Google Play Store
4]Clear cache Clear data

回復就restore到
45400(1010)
3HK(45403)
repeat clear cache 動作

| HOME |