If you play around with height and width for a android device you often need to convert between real pixel (px) and device indipenden pixel (dp, dip). The following methods are a easy solution to convert between px to dp private float px2Dp(float px, Context ctx) { return px / ctx.getResources().getDisplayMetrics().density; } private float dp2Px(float ..

Read more

In some cases it makes sense to disable automatic wordpress updates. For example if you want to have a special release of a running wordpress installation to check plugins or themes with this release. Or if are not ready to update to the latest version of wordpress or you want to update manualy…. The wordpress ..

Read more

Short answer Yes Long answer Shared Preference are saved in the file system of your device, and the Shared Preferences Mode defines whether other applications have the right to read or write the Shared Preferences or not. Android SharedPreferences with mode “MODE_PRIVATE”, “MODE_WORLD_READABLE” and “MODE_WORLD_WRITABLE” are possible in android. MODE_PRIVATE This is the default mode, ..

Read more

If you open a URLConnection with the Hypertext Transfer Protocol, the Object of URLConnection that is returned from openConnection is a HttpURLConnection. This class defines a method, which is able to access the status code of the http response. To get the status of your http reesponse, it is necessary to cast the URLConnection Object ..

Read more

Sometimes it can happen, that the app has to prevent android from taking a screenshot of the app. This can make sense if the app is being pushed into the background and/or for security reasons. So use FLAG_SECURE: getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); This line secures against manual screenshots and automatic screenshots from the ICS recent-tasks history. You ..

Read more

If you want to try downloading something unless you have wifi. You can use the following code snippet to be able to check if wifi is enabled. You will be able to use the ConnectivityManager to get the state of the Wifi adapter. From there you can check if it is connected or even available. ConnectivityManager ..

Read more

A dialog can have a custom layout with buttons, text views, list, images, checkboxes, etc. You can create a layout for your dialog and show the dialog with the following simple method. The showDialog method can be a part of your activity class. In that case you don’t need to explicitly declare the context as ..

Read more

To reverse engineere the oracle database, you can use the Oracle data dictionary like follows. — Get table information from oracle DB select T.* from USER_TABLES T; — Get column information from oracle DB select C.* from USER_TAB_COLUMNS C; — Get constraint information from oracle DB SELECT cons.constraint_type, cols.table_name, cols.column_name, cols.position, cons.status, cons.owner FROM all_constraints ..

Read more

With the getAll function of sharedPreferences it is possible to save the shared preferences to a file. The following code example is probably the easyest way to do it. With the saveSharedPreferences method you can save all shared preferences a file to the root of your sdcard. Make sure your App has the following permission. ..

Read more