Posts

Showing posts from April, 2011

Android Custom List View Creation

import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; public class MyActivity extends Activity { public ArrayList<String> oneList = new ArrayList<String>(); public ArrayList<String> twoList = new ArrayList<String>(); private oneAdapter oneAdapter; private ListView oneListView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.yourXml); } @Override protected void onResume() { super.onResume(); setContentView(R.layout.yourXml); listCreation(); oneListView = (ListView) findViewById(R.id.list_medic

SwapNumbersWithoutThirdVariable - JAVA

public class SwapNumbersWithoutThirdVariable { public static void main(String[] args) { int num1 = 10; int num2 = 20; System.out.println("Before Swapping"); System.out.println("Value of num1 is :" + num1); System.out.println("Value of num2 is :" +num2); //add both the numbers and assign it to first num1 = num1 + num2; num2 = num1 - num2; num1 = num1 - num2; System.out.println("After Swapping"); System.out.println("Value of num1 is :" + num1); System.out.println("Value of num2 is :" +num2); } }

What is .shtml?

SHTML  stands for Server-parsed HyperText Markup Language. It is a file extension identifying a particular type of HyperText Markup Language (HTML) file. Basic HTML files usually provide the text and formatting for web pages.  SHTML  files generally perform the same function, but they also allow the use of simple server commands.

Android Screen sizes and folder struture

Image
Low density Small screens QVGA 240x320 res/layout-small-ldpi res/layout-small-land-ldpi Low density Normal screens WVGA400 240x400 (x432) res/layout-ldpi res/layout-land-ldpi Medium density Normal screens HVGA 320x480 res/layout-mdpi res/layout-land-mdpi Medium density Large screens HVGA 320x480 res/layout-large-mdpi res/layout-large-land-mdpi High density Normal screens WVGA800 480x800 (x854) res/layout-hdpi res/layout-land-hdpi Xoom (medium density large but 1280x800 res) res/layout-xlarge res/layout-xlarge-land

Android layout border with rounded corners

Create the file layout_border.xml in your drawables directory and put in the following content. layout_border.xml <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF"/> <stroke android:width="3dip" android:color="#B1BCBE" /> <corners android:radius="10dip"/> <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> </shape> Implementation you have to call the above xml in your border property of your (Relative or Linear or etc.,) layout: android:background="@drawable/layout_border"