Android LinearLayout Programmatically Set Vertical or Horizontal

In Android you might want to set the orientation programmatically in Java for a LinearLayout. You do like this: LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); // or horizontal like this layout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.HORIZONTAL also got the integer value 0 and Vertical got 1. Further take a look at LinearLayout | Android Developers

Android Change Project Build Target

If you have started the project build target on a lower API like 7 and want to change this to the API 15. Right-click the project and select “Properties”, then choice the “Android” from the menu. You can now select the target version and then select Apply or OK. If this does not work try

Read More

Android Fill_Parent is deprecated

When in Eclipse developing Android going from different API you run into function that has been deprecated. In this case it was from API 8 with Params giving this warning: “The field ViewGroup.LayoutParams.FILL_PARENT is deprecated” “public static final int FILL_PARENT Since: API Level 1 Special value for the height or width requested by a View.

Read More

Android URLEncoder warning

When developing Android and going up in API level you’ll run into this warning when using URLEncoder.encode(String s). You should use the URLEncoder.encode(String s, String CharsetName) instead. The warning: “The method encode(String) from the type URLEncoder is deprecated” Set the CharsetName to “UTF-8” Info: “public static String encode (String s) Since: API Level 1 This method

Read More

How To Check The Weekday In Android

If you want to check for a specific day in the week use the Calendar.Day_of_Week. Calendar rightNow = Calendar.getInstance(); if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY){    //do some stuff here } RightNow is todays date. Then it check if the date is a friday.

Android Listview With Rounded Corners

To create a listview with rounded corners create a shape in xml. Create roundedcorner.xml in the res/drawable <?xml version=”1.0″ encoding=”UTF-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” > <gradient android:angle=”90″ android:endColor=”#C0C0C0″ android:startColor=”#808080″ /> <corners android:bottomLeftRadius=”7dp” android:bottomRightRadius=”7dp” android:topLeftRadius=”7dp” android:topRightRadius=”7dp” /> <stroke android:width=”1px” android:color=”#000000″ /> </shape> You can create a gradient, how much each corner radius should be and a stroke.

Read More

Ubuntu Problem Running Bluray .mkv Files Smooth

Depending on drivers in Linux distribution like Ubuntu, mkv files might not be running smooth. Install the nvidia/ATI drivers via system > administration > hardware drivers Install the libvdpau1 package via synaptic package manager or open a terminal and type or Code: sudo apt-get install libvdpau1 install smplayer (a nice frontend for mplayer) via synaptic or

Read More