Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Saturday, February 26, 2011

Android App: ECDroid 安卓英漢字典

係Android,大多字典都是需要利用online resource,所以手機必須有上網服務先可以使用,例如google translate..但對於一些沒有申請流動上網,只是有家中wifi,那就是很不方便!但是,其實Android上地有一些離線的字典軟件,例如colordict,它採用了stardict的字典檔,所以字庫龐大..但是它的缺點是格式不太整齊,這個原因是stardict本身的字典褲只是純文字,所以顯示出來也不太美觀,如果不理外觀,用來作字典是可以的

於是找找其他字典,發現有一個新出,由香港人開發的字典,但它的格式很整齊,也很美觀,速度也不錯,更適合離線使用,它就是ECDroid 安卓英漢字典。它的網址是http://ecdroid.no-ip.org 它的字庫高達 110,000 個,而且有離線發音功能,雖然是Android 的TTS,但也足夠有餘。作者還提供不同的安裝包,方便不同程度的使用者使用。唯一美中不足是不能在Market 下載。原因是作者想看看巿場環境,如果大家覺得好用滿意,請支持一下。但ECDroid 是我目前覺得最好用的一個字典軟件



 

Tuesday, October 19, 2010

Check internet connection in Android

Sometimes, apps need internet access to get content from other remote resources. However, you also need to take care the case when there is no internet access. You can't assume users always has internet access. To check whether a mobile has internet or not, you can use the following code:

public boolean isOnline() {
ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
boolean connected = (conMgr.getActiveNetworkInfo() != null &&
conMgr.getActiveNetworkInfo().isAvailable() &&
conMgr.getActiveNetworkInfo().isConnected())
return connected;
}


Also, you need to add permission to the app so that it can access network status.



Note: In emulator, you can press F8 to toggle the internet access.

Remove extra space on the right in the WebView

WebView is a very important element in Android. In mobile, people like to scroll everything such as contact list, email, webpage. However, didn't you realize that the scrolling is only in the vertical direction? This makes the user interface more friendly.

In WebView, you can scroll a webpage horizontally and vertically, but it is better to fix the horizontal bar by adjust the size of the contents so that the contents don't expand the View. I did that but I found there is some extra spaces in the WebView to make view scrollable horizontally. First, I think it is related to CSS and margin, so I add

* {margin:0px; padding: 0px;}

But it doesn't work. Finally, I realize that is the problem of the vertical scroll that occupies some spaces. To solve this problem, you can set the scrollbar style to display the scrollbars inside the content area.
webview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);