Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Wednesday, July 4, 2012

一個給懷孕媽媽的App

經過一個母親節後,突然想寫一個App,就是懷孕媽媽飲食禁忌。身邊的朋友一個又一個已成媽媽,但除了十月懷胎既辛苦,就是成日怕食錯野,影響BB

這個小工具,只是搜集網上部份資料,而做成。
正確與否,請大家自行分析。

如果有任何資料提供,歡迎電郵給我。

就此送這工具給偉大的媽媽,希望對你們有用。

Android app on Google Play



(很高興有電視機會揀我這個App做它們其中一個軟件,不過未有時間把新App上架~)

Thursday, May 24, 2012

計下自已的貓幾多歲


近來開了一個google play 戶口,想分享既小工具特別多。

今次寫了一個計貓年齡的App, 用來計下貓相對於人既年齡。我的貓已經九十歲了。

方間有d類似既計算軟件... 不過計到我隻貓有百幾歲..,好難接受~  所以幾經辛苦搵到個好d既 formula,來計下貓的年齡,希望大家鐘意,有興趣可以下載試試

Android app on Google Play



Wednesday, February 1, 2012

decomple apk

其實有d朋友都問過我有關Android Decompile apk method.


其實deompiler apk有很多工具,在這使用的是 apktool

下載apktool1.4.3.tar.bz2,及apktool-install-windows-r04-brut1.tar.bz2

解開後,把三個檔案 aapt.exe, apktool.bat 和 apktool.jar 放在同一個資料夾下
進入Command mode

反組譯 APK
#apktool d file.apk

Friday, January 6, 2012

Add Internal Memory for my Androidpad M7+

 My android pad "M7" only has 2GB internet memory.

I decided to upgrade it to be 8GB tonight.

Haha, i have opened the back of it.  And replaced the 8GB SD Card. Saving my about HKD 600.



then It is very smooth now ^_^

Enjoy it.

Monday, January 2, 2012

Exit/Back Key for Android Development

在使用 Android 時,不小心按到 Back 鍵而離開應用程式,
應該要有個提示讓使用者知道是否要離開

只要 Override Activity 的 onKeyDown 事件,加上提示的程式即可

常用的方法有二個

1. 使用 Toast 提示,在一定的時間內按二次 Back 鍵

private long exitTime = 0;

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_BACK
        && event.getAction() == KeyEvent.ACTION_DOWN){
        if((System.currentTimeMillis()-exitTime) > 2000){
            Toast.makeText(getContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
            exitTime = System.currentTimeMillis();
        } else {
            finish();
            System.exit(0);
        }
        return true;
    }
return super.onKeyDown(keyCode, event);
}


2. 使用 AlertDialog ,讓使用者自行決定

new AlertDialog.Builder( getContext)
    .setIcon(R.drawable.icon_info).setTitle("  ")
    .setMessage("確定要離開應用程式嗎?")
    .setNegativeButton("取消", new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    }).setNeutralButton("確定", new OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
            finish();
            System.exit(0);
        }
    }
).create().show();

Sunday, January 1, 2012

A Visual Guide to Android GUI Widgets



To make your life as a Java Android cell phone programmer/ui designer easier.

For rapid development of your user interfaces try DroidDraw
AnalogClock

<AnalogClock
id="@+id/clock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Button

<Button id ="@+id/button1"
 android:text="Label"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
/>
<Button id ="@+id/button2"
 android:text="Label"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:typeface="serif"
/>
<Button id ="@+id/button3"
 android:text="Label"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:textStyle="bold_italic"
/>
CheckBox

<CheckBox id="@+id/plain_cb"
 android:text="Plain"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
/>
<CheckBox id="@+id/serif_cb"
 android:text="Serif"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:typeface="serif"
/>
<CheckBox id="@+id/bold_cb"
 android:text="Bold"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textStyle="bold"
/>
<CheckBox id ="@+id/italic_cb"
 android:text="Italic"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textStyle="italic"
/>
DatePicker

<DatePicker
 android:layout_width="wrap_content"
 android:layout_height="wrap_content" >
...
// Required Java init code:
DatePicker dp = 
     (DatePicker)this.findViewById(R.id.widget27);
// for example init to 1/27/2008, no callback 
dp.init(2008, 0, 27, Calendar.SUNDAY, null);  
...
DigitalClock

<DigitalClock id="@+id/digitalclock"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
EditText

<EditText id ="@+id/edittext1"
 android:text="EditText 1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
/>
<EditText id ="@+id/button2"
 android:text="(206)555-1212"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:typeface="serif"
 android:phoneNumber="true"
/>
<EditText id ="@+id/password"
 android:text="SuperSecret"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textStyle="bold_italic"
 android:password="true"
/>
Gallery

<Gallery
  id="@+id/gallery"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
ImageButton

<ImageButton id="@+id/imagebutton"
  android:src="@drawable/brush"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
ImageView

<ImageView id="@+id/imagebutton"
  android:src="@drawable/brush"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
ProgressBar

<ProgressBar id="@+id/progress"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
RadioButton

<RadioGroup
id="@+id/widget1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
>
<RadioButton
id="@+id/widget2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Plain"
android:checked="false"
android:layout_gravity="left"
android:layout_weight="0"
>
</RadioButton>
<RadioButton
id="@+id/widget3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Serif"
android:checked="true"
android:layout_gravity="left"
android:layout_weight="0"
android:typeface="serif"
>
</RadioButton>
<RadioButton
id="@+id/widget25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bold"
android:checked="false"
android:layout_weight="0"
android:layout_gravity="left"
android:textStyle="bold"
>
</RadioButton>
<RadioButton
id="@+id/widget24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bold & Italic"
android:checked="false"
android:layout_weight="0"
android:layout_gravity="left"
android:textStyle="bold_italic"
>
</RadioButton>
</RadioGroup>
Spinner

<Spinner
 id="@+id/widget1"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:drawSelectorOnTop="false"/>
TextView

<TextView id="@+id/plain"
 android:text="Plain"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
/>
<TextView id="@+id/serif"
 android:text="Serif"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:typeface="serif"
/>
<TextView id="@+id/bold"
 android:text="Bold"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textStyle="bold"
/>
<TextView id ="@+id/italic"
 android:text="Italic"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textStyle="italic"
/>
TimePicker

<TimePicker
 id="@+id/widget3"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"/>