Saturday, 2 September 2017

Loading properties from config file

While loading properties from config file we face folder path issue. I have written very simple helper class which will load config files from base path and jars location, enabling same code to run in IDE and also in standalone deployments.

Saturday, 13 May 2017

REST service using Embedded Jetty Server and Jersey ServletContainer

I wanted to developed embedded solution that provides REST service without using external container like JBoss.
This can be done using Jetty Server, Jersey ServletContainer and simple maven project.
Code as below

Full source code

Friday, 12 May 2017

Saving instance state of the Fragment while screen rotation

To give seamless experience to user, it important to keep user in same state of operation. For example if user is typing something in EditText and rotates device, text entered by user should be kept.

When device rotates activity gets recreated forcing Fragment to recreate.
Here we can maintain state of fragment so that after rotation fragment can restore data using saved instance state.

Full source code