Category : Uncategorized

Is it possible to create a Android activity without UI? Yes it is. Android provides a theme for this requirement. Add the following line to your AndroidManifest.xml and call finish() at the end of the Activity’s onCreate() method. android:theme=”@android:style/Theme.NoDisplay” Theme_NoDisplay public static final class android.R.style – Added in API level 3 int Theme_NoDisplay Default theme ..

Read more

With API Level 14 – Android 4.0, there is a Method in Application which is called onTrimMemory. The onTrimMemory is executed by the system with different levels ( TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_UI_HIDDEN, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, or TRIM_MEMORY_RUNNING_MODERATE). The interesting level is “TRIM_MEMORY_UI_HIDDEN”. This level can be used to know that the app is going to background. ..

Read more

Not a snippet, but a needed Information when using Microsoft Android Calc How to Format cells in Excel for Android. (Sceenshot made on a german device) Some more informations are available in the video at https://support.office.com/en-us/article/Video-Getting-started-with-Excel-for-Android-tablet-c5d5c135-0bc1-4aea-9b54-95a518dd0c11. Excel for Android is very similar to Microsoft Excel for Windows. But some differences can confuse sometimes. The short ..

Read more

A pl/sql script to recompile all invalid objects in oracle. Simple but powerfull. DECLARE obj_name_ User_Objects.object_name%TYPE; obj_type_ User_Objects.object_type%TYPE; str_run_ VARCHAR2(200); cid_ INTEGER; ret_ INTEGER; CURSOR Invalid_Objects_ IS SELECT object_name, object_type FROM user_objects WHERE status = ‘INVALID’ ORDER BY object_type ASC; BEGIN FOR Get_Rec_ IN Invalid_Objects_ LOOP BEGIN obj_name_ := Get_Rec_.object_name; obj_type_ := Get_Rec_.object_type; IF (obj_type_ ..

Read more

If you want to sort any ArrayList in java, you need to make sure, your objects in the arrylist are comparable. This is done by using implements Comparable and implementing the abstract method compareTo (T cmp). For example if you want to sort some highscores you can do it like this. public class Highscore implements ..

Read more

To execute a shell command from your android app you can grab the standard input of the su process just launched by Runtime.getRuntime().exec(“su”) and write down the command there, otherwise you are running the commands with the current UID. With the following code you can excute the screenrecord command to grab your screen to a ..

Read more

If you want to develop an Android app to turn on/off GPS you can use the following code snippets. // turn on gps public void turnGPSOn() { Intent intent = new Intent(“android.location.GPS_ENABLED_CHANGE”); intent.putExtra(“enabled”, true); this.ctx.sendBroadcast(intent); String provider = Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(!provider.contains(“gps”)){ //if gps is disabled final Intent poke = new Intent(); poke.setClassName(“com.android.settings”, “com.android.settings.widget.SettingsAppWidgetProvider”); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse(“3”)); ..

Read more

Mobile devices have virtual keyboards. There is only limited space on the display to show the keyboard, so it will be helpful to the user to see only the needed keys. Using the right input type will dramatically improve the mobile experience. There are many different input types available for html pages. Here are my ..

Read more