九月 27, 2015
» How to detect foreground process name in Android with Lollipop

(Katwijk.Holland)

Android 一直改版,原本可以用的功能,因為安全性,因為有的 app 會亂搞,所以把許多流程和功能不是改得變複雜,就是直接拿掉了。

原本一個很單純的抓取前景正在執行的程式名稱的功能,也變得愈來愈複雜。之前只需要抓一下getRunningTasks() 就可以找到想要的結果,但是現在得要為 application 加上新的 permission PACKAGE_USAGE_STATS,然後還要要求使用者進到 Settings > Security > User Apps with access to usage data , 勾選該 application 後才可以。

這種小功能還需要使用者大費周章的做一堆事,實在是很麻煩。

下面的程式碼,是透過 user stats去取得這資料。另外,如果使用者還沒有在 Settings 中勾選 app 的話,出來的 runningTask 會是空的,這時應該要用程式碼中最下面的 startActivity 去把設定的畫面叫起來,叫使用者打勾。使用者不打勾,你還是抓不到資料的。



一月 13, 2015
» Material Design(物質設計)是什麼?

物質設計(Material Design)

「物質設計」有人翻作材質設計,但我很容易把「材質」聯想到3D遊戲的材質貼圖去,這跟 Material Design 所想要表達的意涵差了十萬八千里。而從相關的英文詞彙聯想,「Material Girl」或譯為拜金女孩或物質女孩,那種對於追求「摸的到的實際東西」有所迷戀的意涵,似乎與 「Material Design」的內在涵義更為貼近,所以我更願意稱之為「物質設計」。

註:官方後來定名為「實感設計」。

物質設計(Material Design)是什麼?

簡而言之,Material Design(物質設計)是 Google 公佈的一套同時適用於Android、iOS、Web 等各種平台,同時能適用於手機、平板、電視、電腦螢幕等不同裝置的跨平台/裝置的設計規則(仍需為各裝置設計,但鼓勵共用更多相同元素)。

讀者也可以透過觀看 Google I/O 2014 - Keynote(從14:18分開始,由 Matias Duarte 介紹 Material Design)https://www.youtube.com/watch?v=wtLJPvx7-ys  可以得到對於 Material Design 最精巧的介紹。

我不是設計師,僅從開發者角度分享一些個人想法,如果還有興趣請繼續看下去。


從擬物化、扁平化、到物質化的 App 設計

自從 2007 年 iOS 重新發明手機之後,「擬物」化(Skeuomorphism)一直是 iOS App 的設計原則。「擬物」化的設計,讓新接觸「智慧手機」、「智慧平板」的使用者得以沿用過去實物的使用經驗,愉悅地使用新的數位化工具。

但是這幾年智慧手機/平板實在太成功,軟體App 漸漸吞噬了實體世界的各種工具,造成原本「擬物」所參照的物品已紛紛變成老古董,要年輕人畫出電話的形狀,可能畫的卻是手機的模樣...總而言之,許多擬物的參照物已經漸漸被時間淘汰了。

微軟的設計師們很早看出這個趨勢,在2010年推出的 Window Phone 中使用了極端「扁平」化(Flat)的設計風格。
經過幾年來的大膽嘗試,最後也由市占極高的 iOS/Android 定調了使用者界面「扁平」化的發展潮流。「扁平」化的設計,讓使用者得以減少在使用 App 過程中,辨識「擬物」化界面所產生的認知疲勞。

不管是「擬物」化或者「扁平」化,在每個平台的設計指南中,都明確指出設計的App要提供最佳的使用者經驗,必須要符合該平台的風格。iOS還分別為手機與平板提供不同的設計指南,並指出手機與平板是不同的設備,App設計必須要符合該設備的使用情境。

其實平台們的意思很簡單:現在開發者必需要對應每個平台,針對平台不同的風格提出相符的設計。對於同平台的不同裝置,也請分開處理。

於是現在開發者(或提出 Material Design 的 Google,別忘了他們得支援多少種平台與裝置)要面對的,是針對不同裝置、多重平台開發設計 App 時所需面對的各種問題。

「物質設計」(Material Design)就是 Google 整理出的新跨平台、跨裝置適用 (For every screen, and for all devices) 的設計指南。並將首先套用到 Android 的最新版本「L」上。


物質化的 App 設計

「物質設計」是以「扁平」化的 App 設計為基礎,加上紙質分層的概念(即以「Google Now」為代表的卡片式設計),整理出字體、色彩、圖標等設計模式,並加入佈局(Layout)、圖像,與動畫效果(effect)等設計模式。紙質分層與「動畫效果」產生出的設計模式,就我所知,是在之前的各種介面設計中所未特別強調的。

想進一步了解Material Design上的動畫效果,可由 Google I/O 2014 - Keynote(從18.25分開始,由 Matias Duarte 介紹 Material Design Animation)https://www.youtube.com/watch?v=wtLJPvx7-ys  查看。

物質設計(Material Design)工具

看完這些大片的色彩、轉場、動畫效果,不知道身為開發者的你臉綠不綠,反正我綠了。 這樣該如何應用於 app 開發哩? 整個開發成本還了得?

還好 Google 還提供了一些配套工具(但卻不是出現在 Android L)。

(未完待續)

參考資料


八月 24, 2014
» 一個 WebApp,各自表述

前陣子寫了一篇「像原生應用程式一樣的 WebApp?趕快學起來!」,稍微提到現在 WebApp 在桌面和移動端上已經可以像一般應用程式一樣安裝、移除、離線使用。

再進一步觀之,webapp 至今尚未有統一的標準,但Adobe、Google、Mozilla已分別為此推出 Cordova (PhoneGap)、Chrome Apps、WebApp等多種方式來達成此目標。


Cordova (PhoneGap)

Cordova 其實是在各個智慧手機平台上實作共用的Native Adapter,透過 Javascript Interface 來存取設備功能。所以得以使用同一套 web API,而能在不同的平台上執行。

因此 Cordova App 在各平台上執行的效果取決於該平台的 WebView 支援程度。所幸近期兩大 OS 的 WebView 都已隨自家瀏覽器更新,在新版 OS 上 Webapp 的效能已漸漸不再是太大的問題。


Chrome Apps

Chrome Apps 可以在 Chrome 桌面瀏覽器上執行,並提供修改版的 Cordova,Chrome App 可以使用相同的 API 移植到 Android App 上。

近期 Chrome 也進一步釋出 Chrome Dev Editor 與 App Dev Tool,提供在瀏覽器上即可編輯網頁App 與即時在 Android 手機上預覽的功能。


Mozilla Webapp

Mozilla Webapp 可以在「像原生應用程式一樣的 WebApp?趕快學起來!」這篇中找到比較詳細的解釋。

開發工具的部分,近期 Mozilla 亦將 WebIDE 整合進瀏覽器中。除HTML/JS/CSS編輯器外,也附帶Firefox OS 模擬器與 adb 工具,所以在桌面安裝了 Firefox 後可直接在 Firefox 中開發 Web app。開發的 Web app 除了在瀏覽器或模擬器中測試外,亦可以直接傳送到 Firefox OS裝置或 Android 裝置(需要裝 Firefox for Android)上測試。


以上三者之間各自有些異同之處,但並非不可調和。Cordova 已正式支援輸出 Firefox OS webApp,Chrome App 與 Mozilla Webapp 也已共用大部份的 manifest 格式。Chrome Apps 也透過修改 Cordova,來讓 Chrome Apps 的特有 web API能運行在 Android 手機上。


若想開始嘗試寫 Webapp,我寫的 Webapplate 除了可以幫你處理掉開新專案、封裝App、整合測試框架、程式碼風格檢查等問題,也已經同時支援 Mozilla WebApp 、 Chrome Apps,可以參考看看。


七月 22, 2014
» AutoScreenOnOff 再升級

(Dansui.Taiwan)

前幾天花了半天加入 app 黑名單的功能後,評價還不錯,至少止血了。今天趁著明天颱風要來早點回家,花了一個多小時,把一個單純的 screen off widget 給加了進去。

花的時間比預料的快很多,因為本來在 notification 的互動中就已經有這個 intent 和處理邏輯在了,今天只是照著原本的 widget 再生一個出來,然後設定個 pendingIntent 給它,就收工了。

另外,還隨手將 changelog 的輸出方式改了一下,改成每個版本都會是一個新的 string ,如果其他語言沒有翻譯的話,那自然會抓到預設英文的版本,省下我每次升級都要把同樣的字串貼到每個語系的changelog_html中。

六月 22, 2014
» 如何讓 Android 中的 Activity 不要顯示任何畫面

(ShinShan.Dream Lake.Taipei)

北部難得可以找到人少一點的景點。
之前來路跑竟然沒有看到。

*****
最近又在寫小 app,但總是在畫面上卡關,一直無法很順利的進行。
今天早上起床,順手又改了幾個自己在使用上覺得不夠方便的地方,
然後,就是這麼自然地,在網路上逛到了如何解決自己試了很久都沒成功的功能。

根據 app 的需求,我在 AndroidManifest.xml 中透過 intent filter來接收某些事件。當事件發生時,被叫起的 Activity 其實並不需要顯示畫面,我只是要將事件再傳給 Servic,讓 Service 把事情處理掉。但是卻老是卡在 Activity 或多或少會秀一下白畫面,或黑畫面,或是閃一下,才會乖乖的不見。即使在 onCreate() 中呼叫了 finish()也解決不了這個問題。

今天在網路上找到的解法,很簡單。只需要設定一個 theme 就好了。雖然這方法自己也試過,但應該是少了些什麼其他的設定吧。好吧,答案就是:

            android:theme="@android:style/Theme.NoDisplay"

REF:
http://stackoverflow.com/questions/4551868/how-to-completely-get-rid-of-an-activitys-gui-avoid-a-black-screen



五月 25, 2014
» Sqlite Commands in Terminal

(Shimen.Taiwan)

Recently, I need to use sqlite commands to check data for my android app. Thanks to the rooted android ROM, the shell environment is much useful than before. It's possible to use Tab key to auto complete filenames and directories, and I can use sqlite3 command directly in adb shell. It saved time from pulling the database file out back and forth.

However, it's been quite a while that I almost forgot how to deal with a sqlite database. The following link is a handy Url to help me on this:

http://www.sqlite.org/cli.html

To name a few:
.mode  // select different modes, eg, list, line, column
select * from tbl1; // select all from table tbl1
 



三月 19, 2014
» Android Wear 周邊



Android Wear不是作業系統, 基本上是拿來開發Android周邊所使用的協定。它是把原本需要拿出手機查訊息,變成透過 Notification API傳給手錶。透過 Google Now 手錶可以收到
推播來的相關訊息或透過語音辨識來控制手機應用做事情。

因為 Android Wear + Google Now 帶來的便利性,Google可以再進一步加強圍繞著Play Service/Google Now的生態圈。

十月 29, 2013
» 那些 2013 年發佈的 OS

原來就預期今年會有很多OS出現,但沒想到有那麼多。
來簡單整理一下列個表。如果有漏掉的,請路過的讀者幫忙提醒吧。

後面括號(Mod)表示是 Android 的衍生版本。月份是大概印象,與實際日期可能有出入。

這些 OS 其中當然有些只是拿來賺眼球,還沒有實際出貨計劃的OS。
不過廠商群雄並起逐鹿的感覺,當可確認現在已進入後PC時代無疑。

3月

OUYA (Mod)
遊戲機與自有市集

Smartisn OS (錘子OS, Mod)



BlackBerry 10 OS
已出兩隻手機

5月

Android 4.3 + Google Services
各種跨版本可用的 Google 服務,扁平化與卡片式設計
現有設備升級, n台新機

Chrome OS
Pixel筆電與Chrome box

7月

FirefoxOS 1.0.1
ZTE open, TCL One touch Fire


Ubuntu Phone
相似的概念性界面還有 for Tablet, for Android, for TV... 


9月
CyanogenMod (Mod)
宣布公司化

Sailfish OS


iOS7
iOS 五年來最大的改版
現有設備升級, iPhone 5s, 5c


SteamOS
客廳與遊戲用 OS

10 月

FirefoxOS 1.1


Ali OS (阿里OS) 可定製手機

11 月

Tizen 平板


Android 4.4 KitKat


七月 29, 2013
» How to build your own 'repo' to Manage project with multiple git repositories



'repo' is a good tool to manage project with multiple git repositories. Its developed to serve the need to manage Android Open Source Project (AOSP), which counts on bunch of open source projects. Then the 'repo' tool is used for chromium and chromium OS (known as open source version of Chrome browser and Chrome OS). Now Mozilla Boot-to-Gecko (B2G, known as Firefox OS) also adpot the 'repo' tool to manage multiple git repositories.

For a short time of experiment, I find its pretty simple to setup your own 'repo' that can help you manage multiple git repositories. Here is my findings.

To install 'repo' command, you can refer to Installing repo.

Make your own repo

All you have to do is:

1. setup an accessible git repository
2. Put a 'default.xml' file in it
3. Use 'repo init' command to access this  git repository.

Done!

Here is the default.xml sample, there are three main tags:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- define hosts -->
<remote name="b2g" fetch="https://github.com/mozilla-b2g/"/>
<!-- default settings -->
<default sync-j="4"/> <!-- projects -->
<project remote="b2g" revision="refs/heads/master" name="gaia" path="."/>
</manifest>
Look at the 'project' tag. It describes that we'd like to sync the 'gaia' repository's 'master' branch from remote 'b2g' host.

Explaination

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
...
</manifest>
The 'default.xml' syntax is wrapped by 'manifest' tag.
It contains three parts of definition:

Hosts

<remote name="b2g" fetch="https://github.com/mozilla-b2g/"/>
'remote' tag is used to define the hosts that we'd like to use in projects.
Note that it's not the actual git URL, but where the git hosted on.
We can specify the actual git URL in 'project' tag.

Projects

<project remote="b2g" revision="refs/heads/master" name="gaia" path="."/>

The file describes that we'll like to sync the 'gaia' repository's 'master' branch from remote 'b2g' host.

The 'revision' path is defined within the original .git folder. To switch to branch like "v1.0.1", we could change  "refs/heads/master" to "refs/heads/v1.0.1".
It's almost the same as we have to do with git command. 

By the way, default.xml itself is in a git repository, so you can specify versions by branch or whatever you like.

Defaults
<default sync-j="4"/>
In default tag we can specify the default values in project tag. ex: revisions, default repositories..., etc.
'sync-j' means with this setting, 'repo' command will download 4 resources at the same time.

The usage 

Create a folder, switch in it, and run the following command:

$ repo init -u https://<your own git URL>.git
Then, fetch the resources with command

$ repo sync
To fetch a branch, run command
 
$ repo init -u https://<your own git URL>.git -b <branch>

Read Git and repo cheatsheet for more details about how git and repo tool work together.  

Sample

Here is a working sample that able you to sync Mozilla Gaia repositorie, and automatically put vendor customization folder into its 'distribution/' sub-folder to ease the customization work.

https://github.com/gasolin/gaia-custom-repo

Update at 7/29:

A workable process elaboration in slide format http://gasolin.github.io/gaia-repo/

六月 10, 2013
» 在Lime HD中快速啟動語音輸入法

(富貴角.Taiwan)

剛剛試了一下谷歌的語音輸入,覺得有些時候應該蠻實用的。所以打算幫它在Lime HD中加個快速切換的功能。在Lime HD中原本就有開啟Google語音輸入法的方式,只是我覺得有點太麻煩了。原本的方式是:
1. 長按左下方的設定鈕,這時會跳出一個對話視窗,可以設定輸入簡繁中文的切換,分割鍵盤等一些選擇。畫面最下方則是切換成語音輸入法。

通常會想用語音輸入的時機,都是在手不方便慢慢點螢幕的時候,所以,操作步驟愈多,就愈麻煩。原本我是打算在長按(中/En)按鈕時,直接啟動語音輸入。目前這個按鈕的長按並沒有預設的作用,所以很適合。

可惜的是,我不知道怎麼debug InputMethodService,所以沒有辦法短時間內看清楚在LIMEService中的長按功能,是怎麼前後串起來的。一直找不到好的interception point。

無意中卻發現了,原來Lime有針對輸入的整個面版實作swipe的key listener!!做為一個多年的Lime HD愛用者,竟然不知道有這麼一回事。看了原始碼後,它的目前對應功能是:
滑上:開啟設定對話窗(跟長按設定按鈕一樣)
滑下:關閉輸入法
滑左:模擬刪除鍵
滑右:送出目前選擇的候選字

既然設定對話窗已經可以很方便地長按設定鍵來開啟,我把"滑上"給改成呼叫Google語音輸入法。程式碼很簡單,在LIMEService中的swipeUp(),把原本的code換成StartVoiceInput()就可以了。

六月 7, 2013
» Adding macros in Android Studio (Intellij) -- take Adding Javadoc comment for example

(Geneve.Swiss) Climbing is pleasant, but it leads you to better views.

 Some shortcuts can be integrated into ideaVIM, but some are more complicated and need other tricks to make it more handy. One of the technique is to use macros. As Mac's Automator, you can ask Intellij or Android Studio to record your actions, and make it available as a keyboard shortcut.

For example, if you want to add javadoc comment to a funtion, you need to move to the first line of a certain function, and type in /**. After pressing Enter, it will generate javadoc template for that specific function. Though it's already very convenient, it still takes time if you're not quite familiar with how to move the cursor to the first line of the function.

So, to add javadoc comment from anywhere in codes, you can record a macro to move to the first line of the func, and type /** , and Enter for you. Here's the actions:
  1. Start recording a a macro in Edit - Macros - Start Macro Recording
    1. Press Down
    2. Press Ctrl + Up
    3. Press ⌘ + Left
    4. Write /**
    5. Press Enter
  2. Stop the macro recording in Edit - Macros - Stop Macro Recording
  3. Give it a cool name
And then you can add a keyboard shortcut for this macro in Keymapping in Preferences.

REF:
http://tobiassodergren.blogspot.tw/2012/05/adding-javadoc-to-method-in-intellij.html

六月 6, 2013
» Some hacking articles about IdeaVIM under Intellij

 (Leiden.Netherlands)

IdeaVIM is a vim-like input plugin for intellij IDE, good for text editing but not so powerful if you want to use it for other IDE tasks, for example accessing menu actions by defining keyboard shortcuts.

Fortunately, someone in Japan branched the source codes on GitHub, and wrote some tweaks to make it possible to configure all kinds of Intellij menu items to keyboard shortcuts as you wish in a config file.

Tried downloading the modified codes and built it in Intellij; installed the plugin in my Android Studio environment. Working like a charm~

my settings in _ideavim.groovy


REF:
http://d.hatena.ne.jp/masanobuimai/20120720/1342764219
http://d.hatena.ne.jp/masanobuimai/20080323#1206277040


六月 4, 2013
» How to make testing work under Android Studio

(Geneve.Swiss)

It's such a pain to look for solutions for tasks on Android Studio. When can it be mature enough and more well documented for developers?

I would like to write some test cases for my small app, but I couldn't find a way for adding test cases into Android Studio project and have it run successfully.

After wandering around on the internet for a long time, eventually I found a link that did helped me out (see reference below). As Google I/O 2013 video said, a new android build system made of gradle is released, which will be more flexible, more powerful, more etc, etc. However, currently, it 's not well integrated into Android Studio. Some modification in Android Studio won't be directly reflected in gradle build scripts. Well... then, how do I know when I should modify build scripts my self? And to write it by myself, I have to learn groovy first, because that's the language Gradle used to write its build configuration files. How could I master these things in a short time...

Anyway, the solution for my pain point above is to modify build.gradle under the root directory of app project, and make sure all the instrument source folders are well set up. Now I can use cradle to run test cases and generate report files. However, I can't make it work in Android Studio still. orz...


REF:
http://blog.crowdint.com/2013/05/24/android-builds-on-travis-ci-with-gradle.html

六月 1, 2013
» Gradle build error in comman line for Android Studio app projects

I saw someone met the same problem on StackOverflow. Fortunately,  I found out how to make it work. So leave some notes here:
1. upgrade Gradle version to 1.6
2. Afterward, running "gradle build --stacktrace", you will see that ANDROID_HOME environment variable is required to be set up.
3. on Mac, add following line to your ~/.bash_profile
export ANDROID_HOME="/Applications/Android Studio.app/sdk/"

Now it should work like a charm!

五月 28, 2013
» OrientationEventListener on Android to get current rotation degree

(Central Park.New York)

Strangely, it's not possible to get current rotation angle in android directly, except for getting the fixed 4 rotation modes: 0, 90, 180, 270. In order to get precise rotation degrees instead of rotation modes, OrientationEventListener can be used. Once it's implemented, you can get the rotation degree in onOrientationChanged(). It's a lot easier than manipulating values from all the sensors like gyroscope, accelerator, etc.

REF:
http://android-er.blogspot.tw/2010/08/orientationeventlistener-detect.html





五月 24, 2013
» Tips for using AdMod module in Android Studio

(Geneva.Swiss)
It's pain in the ass to use Android Studio now, since it's just published, which implies bugs appear every now and then, and you're not sure it's due to your misunderstanding of this IDE, or it's really an issue. In addition, it's  relatively hard to find How-to answers comparing to ADT plugin with Eclipse.

While trying to set up AdMob module in my project on Android Studio, it took me some time to fix some external library import errors that should be clearly mentioned in online AdMob doc, or even better, just integrate it into "Android Studio".  Isn't Android Studio meant to make Android developers' life easier?

Problem 1: Add com.google.ads.AdView element  in my layout xml as doc says, but it generates compilation error.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
             
android:orientation="vertical"
             
android:layout_width="fill_parent"
             
android:layout_height="fill_parent">
 
<com.google.ads.AdView android:id="@+id/adView"
                         
android:layout_width="wrap_content"
                         
android:layout_height="wrap_content"
                         
ads:adUnitId="MY_AD_UNIT_ID"
                         
ads:adSize="BANNER"
                         
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
                         
ads:loadAdOnCreate="true"/>
</LinearLayout>
Anser: Pay attention!! You also have to add the red line attributes to the container layout!! It's not clearly mentioned in document. What I just did in adding com.google.ads.AdView component. Obviously, it told me that it can't compile.

Question 2: Don't know how to add the AdMob library to my project in Android Studio. The AdMob doc only has flows for eclipse. I always meet "NoClassDefFoundError" during runtime. This took me most time to wandering on the internet, looking for a right answer.

Answer: it's a bit tedious. Please just check detail information in reference link below. In brief:
1. Put the jar into the libs folder
2. Right click it and hit 'Add as library'
3. Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean (I'm on Mac OS X, the command might be different on your system)

Question 3: sometimes, even questions above are all fixed, you still can't get the AdMob View. Why? You have to declare a specific Activity for it including configChanges. This is mentioned in Introduction, but ... I just have ignored it, since who would have thought that creating a View in my own activity needs to declare a specific Activity for it?

    <activity android:name="com.google.ads.AdActivity"
             
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
 

REF:
Add a jar library








五月 20, 2013
» Enhance Reading Experience for Android Dev website


Recently I spend most of my time reviewing documents on google's android official site. It annoys me that the left side of the screen is always occupied by the content index; however, I just need to change articles once in a while by using it. It makes me feel bad that one third of the screen is wasted. In addition, it also distracts me while I was reading.

As a consequence, I searched internet to see if there's any extension, plugin, or script to help me hide the navigation panel when I want to do so. Out of luck, no. Maybe it's too tiny to have someone work on it.

Therefore, I decided to write one by myself, after reading a book about jQuery. My choice is to write a userscript for greasemonkey, which is supported on Chrome now as well. The logic is very simple and the lines of codes are few, although it still took me sometime to find right APIs to implement this feature.

Here's the screenshots:

The userscript is uploaded to following site:
http://userscripts.org/scripts/show/167980

五月 15, 2013
» Eclipse/Java code completion not working with Android development

(GreatWall.Beijin.China)

While watching some video tutorials about android development, I found that the lecturer can call out the class completion helper dialog during typing class names. However, I only have the function/variable autocompletion feature after typing a . after a class name in my eclipse. Without entering the class name correctly, I can not get any help from eclipse, which is quite strange comparing to what I've seen for others.

Well, it seems that many people encountered the same problem as I did. This is being discussed on various posts. One way to make it work is to check the "Java Proposal" in Eclipse's Preferences > Java > Editor > Content Assist > Advanced'.

But for me, it seems that something's wrong with my workspace configurations too. The answer from hoipolloi in following reference post helped me to fix this issue. Here's his suggestion:
  • Quit Eclipse
  • Go to workspace/.metadata/.plugins/org.eclipse.jdt.core
  • Remove *.index and savedIndexNames.txt
  • Restart Eclipse and search Ctrl+T for the offending type. The indexes will be rebuilt.

REF:
http://stackoverflow.com/questions/908489/eclipse-java-code-completion-not-working

五月 12, 2013
» Android書範例更新放到Github

離上一版Android書的更新已經過一年多了,終於在最近改版的工作告一段落。
再過一陣子,就可以看到新版本上市了。

這次的所有範例改放到 Github 上。可以前往 https://github.com/gasolin/androidbmi5th/ 下載。

Github 使用 git 作為版本控制系統,並提供很方便使用的網頁介面。

例如我使用分支(branch)來管理不同章節的範例程式碼。要在github上查看不同章節的程式碼,只要點選Github左上角的分枝選單,選取對應的章節,即可查看範例程式碼。

選取對應的章節,查看範例程式碼

此外,也可以透過左上角的「zip」按鈕,下載對應的章節範例程式碼。


若想透過 git 命令下載,可以使用如

git clone https://github.com/gasolin/androidbmi5th.git -b CH36 CH36

命令來取得對應章節的範例程式碼。


本書提供的範例無授權問題,可自由用於各種場合。 若對範例有疑問,可以直接在 github 專案的 Issues 中提問。


從更新的範例中可以看到,第五版本終於做到全書只有「一個」 BMI 範例(包含配對的測試範例)。圍繞著設計BMI應用程式的過程,介紹各種Android系統的運作與常用功能。我覺得新的改版對第一次入門的讀者來說,學習的過程應該更有樂趣。

四月 18, 2013
» vrapper

最近常遇到 limeHD 選字不對的問題。不知道能不能加個小方法,讓它可以按著使用者的意思,針對某種打法,強制某個字是自己要的第一候選字呢?所以去抓了limeHD的程式碼,想要來研究研究一下。

為了要在eclipse上順暢地閱讀程式碼,先裝上了仿vi的plugin--vrapper。官網在此:
http://vrapper.sourceforge.net/home/

biggo.com.tw

A Django site.