Posts

Showing posts from 2014

New App - Gamory

Image
Hi All, I've just released a brand new game to the google play store, GET IT AT GOOGLE PLAY It's a memory game, mostly for children but i believe that adult will find it entertaining as well. The game took about a week to develop (most time was devoted to adjusting resources and dimens to all screen sizes) , this has become really tedious but that's the game and if we want to be able to deliver a comprehensive experience to all the users. In the coming days/weeks i'll point out some code I've used in the app, please stay tuned. In the meantime, please take a minute to download the app and use it, let your children and your children's friends play with the app on a phone, a tablet or even a phablet. I'll be happy to get feedback, either for design or performance. GET IT AT GOOGLE PLAY Thanks

Observers and Observables in Android

Within the android framework there’s a somewhat vague usage of the MVC pattern. We can see it happening with Activities, Adapters of all kinds and in fragments as well. But there’s a hidden gem within the java.util package which can be used very easily as the grounds for a publisher subscriber needed scenarios : java.util.Observer, java.util.Observable. The approach is quite easy to grasp and is identical to the usage in other platforms and programming languages. The Observer announces that he wishes to subscribe to events and the publisher holds a list of subscribers which he can notify on data being changed with a simple callback. In this very simple example, there’s an activity which contains a TextView which is updated by values. The Activity implements the Observer interface, which forces it to implement the update(Observable observable, Object data){} which will be invoked by the publisher, the parameters are the reference to the publisher and the data that is being published....

Bullets List in Android?

  A much needed, sometimes hidden in the framework, and mimicked with unnecessary WebViews and sort of inner HTML injections to xml resources – a bullet list is much easier to implement then you would expect. When taking the easy solution – using WebViews , you are making the UI hierarchy much heavier then it should be, and when your UI is already rich with layouts and widgets, it seems bad to overload it with heavy WebViews. The Android.text framework gives us – the developers an easy to use API to build special text spans, in the next code snippet we’ll see how a bullet list can be implemented: let’s say we have a simple TextView which we need to hold a text with a bullet at the left hand of it: TextView mTv = (TextView)findViewById(R.id.tv_1); CharSequence cs = getText(R.String.sample_text); SpannableString ss = new SpannableString(cs); ss.setSpan(new BulletSpan(15), 0, cs.length(), 0); mTv.setText(ss);   Explanation: 1. Get a hook on a TextView 2. Construct ...