Way to Serialization Proxy Pattern

The serialization API provides mechanism for encoding Java objects to byte streams. These bytes may be stored or sended between different virtual machines and reconstructed back to the objects (deserialization). Java provides two interfaces for this purpose Serializable and Externalizable but it is not enough.

Continue reading

Advertisements

Modify UI Outside of Activity in Android

There are exists many ways how to change user interface in Android outside of Activity (commonly from running background asynchronous task or service). I am sure that everybody hit this problem at development because we want often time separate logic of computation with logic of UI. It can be confusing find the right way or at least the best practice after research. The simplest solution is send activity object to the other class. We can make appropriate changes on activity object in this class. Unfortunately, it is not good practice. We should not make changes on view objects outside of Activity. Passing Activity to other classes may cause memory leaks.

Continue reading

Ionic and Custom Android Cordova Plugin

The ionic is hybrid framework for writing mobile applications. It is based on well known motto “write once, run anywhere”. However, there is a need for interaction front-end with native device functionality, naturally (camera, sensors, NFC readers etc. ). For this purpose is here Cordova, which connect native code with JavaScript through plugins. There are many existing plugins which we can simply use, but we look at it how to create own custom plugin targeted to the android devices and how to use it.

Continue reading