Category: Android

findViewById in a fragment

Not quite as simple as it would seem. You can't use onCreate() method because it is called before onViewCreate(). However, you can used onViewCreate, because you inflate your view: hence you have access to it:

Continue Reading

Speeding Up Gradle (just a little bit)

If you do any sort of Android Studio Development you might find these two lines quite useful. There is a noticeable speed up in building time.

Continue Reading

MVVM with Android - this is exciting!

This is one of the best things I've seen on Android in a long time: MVVM architecture. Of course, Android platform doesn't support it, but there is hope! RoboBinding. OK, the spec perhaps isn't the best, but the idea is great! Finally This is how simple it is with Android Studio:

Activity code:

Continue Reading

Defining your actions in XML makes your code that much cleaner

This is a nice hack when developing apps in Android (similar to JavaFX) - define the on click events in XML:

In the Activity, we can specify the method:

This is much cleaner than:

Continue Reading

Logging information in Android Apps

Being a bit of a reliability freak, I really enjoy knowing what's going on in my app. How it moves from one line of code to the next. Verbose The word "verbose" literally means more words than necessary. This mode usually show how the program's flow control.

Debug Debugging has the next level in

Continue Reading

Adding Info Dialog to Android App

This is how simple adding a dialogue is to Android:

Continue Reading

Adding background to a DrawingView in Android

Yesterday, I was attempting to add a background to my DrawingView - something which IMHO should be ridiculously simple. Yet, after trying to various combinations of Bitmap, Drawable even ImageView types, nothing worked. Although you can do it directly in the XML, I had my DrawingView defined in Java file rather than XML. In the

Continue Reading