Tag Archives: Android

A smattering of focus on View

Before coming with focus, let’s go through 2 scenarios :

– There’re some EditTexts on screen, the first is focused. When user press NEXT button on soft keyboard, the pointer will move to next one with order from left to right, top to bottom. So what should we do when need to change the default focus movement order on Android?

– When user focus on an EditText, platfrom makes it hightlight and shows soft keyboard up. And the question is how do we customize action happen when one view get focus ?

In my two cents, these’re the most common necessary knowledge when we work with focus  on Android.

A view indicate its readiness to take focus through isFocusable() function. However we can change this attribute by call function setFocusable(boolean). Beside we also can specify view can take focus on touch mode or not through function setFocusableInTouchMode(boolean). After make view focusable, we can customize focus movement or action when focus happends. Continue reading

Singleton pattern

Sometimes we need only one instance of a class in whole system, and “Singleton” was born.

Singleton is the simplest pattern in the design pattern world. It invokes only one class which is responsible to instantite itself, to make sure no more than one instance of it was created. This class is used for centralized management of resources and provides global access point to itself. Continue reading

Working with WebView in Android

Basiclly, Webview is a View that displays web pages. It uses the Webkit rendering engine to display web pages, and includes methods to navigate forword, backword throught a history, zoom in and out, search texts, … It also provide mechanims that allows us interact with web content, and maybe receive event and sent command to javascript insdie page. Continue reading