Category: Java

How to get rid of the AppMenu

Now Google recently gave some suggestions on how to get rid of the AppMenu since the next Google IO device will not have a hardware menu button. There are not bad suggestions. But, I think we can do it in a new and cool neat way that Google ha not considered.

Jon Deutsch of theVerge has suggested a corner to center swipe to navigate all the 5 home screens but he had some details backwards. Use Case:

1. On any screen corner to center swipe takes you to the next screen if not already at that screen. Use a small triangle at corner to indicate which screen user is at.

2. To go to the home-screen, ie dash board start screen is a center tap.

Thus, I guess I have one more project to upload to github and write a coding article about this weekend and put on The only disadvantage I see is its greatest feature in that you can only have five screens. Also somehow we want to scale it so that if someone is on table that they do not have to swipe clear from the corner to center to get that navigation to work.

A new way to Log

We have all seen this:

Log.d(tag, myClass.getSimpleName() + ":" + msg, tr);
Log.d(tag, obj.getClass().getSimpleName() + ":" + msg);

With it always on the programmer to write the extra log details per class they want to log. what if we did not have to? What if in a class we have this instead:


//in our method we want to log
// or
OurLogger.i(“tag” “message”);

and we get something like this:

08-01 10:38:56.446: INFO/MyTAG(100): [MyPackage.Name][MyClassName][Method][122]
08-01 10:38;57.447: INFO/MyTag(100): [MyPackage.Name][MyClassName][Method][12]

You will notice that I will be getting a stack trace back with all my packages, classes, and methods labeled and even line numbers. Now some things,this is only for those who use instrumented testing. How did I do it? The article at my gh-pages is coming, you should probably bookmark that site.. Fro those that cannot wait, obviously I am using Stack Trace.

But, I am using some new tricks that are somewhat non obvious. But the main thing I have reduced my coding log statements to something extremely simple that is configurable to give me enough details when I want it with no increase in coding log statements to get that detail, ie I hacked the Logging. Neat huh?


Error in LruCache

First up, we have somewhat an error of omission. Basically hasKey method is missing:

public synchronized boolean hasKey(K key) {
return map.containsKey(key);

Yeah we kind of need that little method.

Second things that is missing, when they re-factored LruCache I think they forgot the original reason why someone thought using weak-reference might be a good idea. We have two magical things to tell the GC what items not to do GC on right away, Soft Reference and Weak Reference.

Soft Reference is the stronger of the two and should be used when cache Drawables or anything else that has an activity context. David Wu coded a LruSoftcache with that in mind.  The key question now is do we really need ot keep a LruCache using Weak References around. The only use case I can think of is if you are downloading images for your application,large ones, and want the GC to operate on them sooner than a Soft Reference might allow. Also I can think of some game object pool cache use cases as well.

What is nice about the Android platform is that you can browse the git commits and get some historical idea of the re-factoring of a class which gives you clues on to what to track down and analyze. Its not like 1995 with java coming out where you had a black bock box and had to guess.

Here is what I know thus far.  the features/far-reaching changes pushed back from ICS will appear in Android 5. Android 5 will be demoed at Google IO in the spring just as parts of ICS was demoed last year at Google IO. expected release of Android 5 than would be late summer to late fall. Or Android 5 and Android-5 Motorola Mobility devices may be given away at the Google IO.

At this point I have some good guesses at the features/changes, but they are only guesses and you should not rely upon them. However, its probably a good guess that that the enterprise features will be re-factored for improvement and that we will see another UI over-haul. Will we see a Google Chrome clone with Silk-Browser cloud pre-processing like KindleFire? Do not know, but it could be a possibility.

Apparently, when someone handed out brains they left out the group called recruiters. Thus, so lets try this again.

I run a business where I develop android applications. That kind of means that I do not want to work as an employee for your client, oh dim witted recruiters. I have found in programming since I was 8 years old that the best choice of project managers and opportunities is when I have full control lover those choices instead of someone else rather than trusted those choices to someone who is domain knowledge removed from those choices such as a recruiter.

Do not take it upon yourself to email me after I have said no with rude comments and snide commentary as it is not in my interest to care where your next sale comes from or even if you get one, just accept that you did not access the situation correctly when you read my linkedin profile and saw that I operate a business.

For those that access the situation correctly,  things are required for me to talk to you via email and those are:

1. A project description

2. A budget range

3. An understanding that all freelance developers charge for their time and work and ask for advances on project costs.

4. If continuing project from a previous develoepr, the source code. And do not forget to send the NDA I signed back to me with your signature, I should not have to remind you a five-year-old-child about that either.

If I do not have those things than I cannot continue the conversation with you as much as I might like to talk to you I have things that have to be coded and built just as you in your professional time have to manage your business and thus I am very sure that if you want anyone to respect your time than you will respect mine.

And, last I only allow myself to be entered on developer lists that businesses keep because they out-source projects if the business understands that to get that right they have to at least buy me one meal.

New Bug Tool from SonyEricsson

SonyEricsson has a new tool out that puts the bug report the android handset produces in searchable html form and they have open-sourced it.

So those Agile Android Articles

At some point last year I stated that I wanted to teach android differently. Some of that is that you should start teaching certain things sooner such as Agile. Thus, recently I re-did the design of my gh-pages website. Not only is it now view-able on mobile but also I am starting to put up long articles there, such as the Contrarian View, DeviceID. Believe it or not a lot of assumptions about using ANDROID_ID and or deviceID are somewhat wrong and ill-advised, you probably should read the article.

For example, ANDROID_ID is null for Kindlefire, along with deviceID if its a WIFI only device and yo guys know hat googleTVs do not have deviceIDs, right? THe article offers new solution and the code to implement that solution.

As I go along during the year I will be filling out the article list with articles on agile.As a side note the trick of pinning the 2nd navigation bar upon scrolling is in the application.js and you can clone my github repo to get it along with a recent copy of twitterbootstrap2.0.

From time to time I get requests to ‘rescue’ a gig because some developer is leaving the  project. Which is fine,it happens but if I was leaving the project my last act wold be recommending a developer to take my place. But, in most cases its the middle company or end client makig the request.

But, that is not really the problem. Its a level of expertise used before not matching what could be implemented to save the end -client costs n the long-term while delivering a high quality look-and-fell mobile android application. For example, its common for me to use at least one class that is compiled to the highest device-target out in the android market simply because I am wrapping classes to target common UI features/functionality. In other word part-of-the-fell of that UI.

The other aspect is right now to avoid constantly updating an UI per OS release that comes down to end-user devices for apps that are distribute internally in a company you have to target  that compatibility library. Not only do you have to target it but you have to modify or customize it. Its real damn easy to see or analyze and determine fi some developer is not doing that even if you are only exposed to the project manager conversation.

By me asking for source-code and getting said source-code the project manager is communicating to me that they understand that I am reviewing(interviewing) them and they accept that I may make suggestions to improve their project situation and that the project manager understands that I will find out real quick if any miss-representations of the project quality/progress are being made and thus there is less risk of a project manager making material miss-representations.

Is it really that hard for a potential project manager not to understand that they are in-fact being interviewed if a project is loosing a developer?

ContrarianView, DeviceID

A new coding article is up called, Contrarian View, DeviceID And it even has sample code, but no pizza..sorry. In android development we often want to compute a deviceID to use in debugging not only from developers but also from end users and this article explains the choices and suggest a more correct choice.

Agile Android Dev in Anger

Some of you saw my AndrodCMWrench project go up yesterday, including a project dos site for the project. Do you realize that was just few hours to generate the website and complete ant script tool?

One of the problems every firm faces is that its the perceived notion that obtaining an android developer at premium prices means a slow development cycle. Google and OHA was kind enough already to make a choice of Java for Android Application Development which serves to somewhat halve the development time when com pared to a non-VM language such as Objective-C.Should we not take it rest of the way?

Imagine this,a complex android application getting down to its core features and a fast prototype in a week to two week period.  So, what are the areas left to improve/

Libraries can be heavily used to reduce development time. Not just one the application side as you can create jars that are used on the Android Instrumented Test Project side. It is also the tool-integration side.

If you look at source of my gh-pages branch of AndoirCMWrench you will notice that I did not use Github’s Jekyll. Why? Because I do not have an IDE Jekyll plugin so go with something that I have a plugin for. In the Android Application Development context since I have a nice plugin to make shortcuts of my ant targets, I can develop a nice tool that fires off execution of the MonkeyRunner scripts to run not only TDD/BDD unit tests but also regression testing right from the IDE.

This is what agile is, analyzing  your development work-flow to get better feedback and in shorter time periods to improve the stability and quality of what is produced.

There is a clown of a-Chicago firm(cough 4tegroup, cough quite spamming me folks) that thinks knowing how to write a Continuous Integration build script is agile, the only problem with that is that no-one in android development writes continuous integration scripts due to the differences between CI plugins and what we need to inject in certain ant stuff on how the android sdk tools operate. We tend to write a full ant build scrip  that integrates with the android sdk tools and our code metrics and than just have the CI server be pointed to run that instead.

So do not be that clown-of-Chicago firm be curious about your developer work-flow, the libraries you use, the tools you use,etc. And if you do not have time and want to borrow my tools and libraries, than just make sure that you follow my github account.