Showing posts from November, 2014

How can I sync data between a webserver and an android app?

Syncing data between your webserver and an android app requires a couple of different components on your android device. Persistent Storage: This is how your phone actually stores the data it receives from the webserver. One possible method for accomplishing this is writing your own custom ContentProvider backed by a Sqlite database. A decent tutorial for a content provider can be found here: defines a consistent interface to interact with your stored data. It could also allow other applications to interact with your data if you wanted. Behind your ContentProvider could be a Sqlite database, a Cache, or any arbitrary storage mechanism. While I would certainly recommend using a ContentProvider with a Sqlite database you could use any java based storage mechanism you wanted. Data Interchange Format: This is the format you use to send the data between your webserver and your android app. The…

How to avoid Java Code in JSP Files?

The use of scriptlets (those <% %> things) in JSP is indeed highly discouraged since the birth of taglibs (like JSTL) and EL (Expression Language, those ${} things) over a decade ago. The major disadvantages of scriptlets are: Reusability: you can't reuse scriptlets.Replaceability: you can't make scriptlets abstract.OO-ability: you can't make use of inheritance/composition.Debuggability: if scriptlet throws an exception halfway, all you get is a blank page.Testability: scriptlets are not unit-testable.Maintainability: per saldo more time is needed to maintain mingled/cluttered/duplicated code logic.

Copy files and folders from Assets folder to memory card in android

Copy and paste the below methods in your Activity class code.
static String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); final static String TARGET_BASE_PATH = extStorageDirectory+"/My Demo Folder/"; private void copyFilesToSdCard() { copyFileOrDir(""); }