Android

Get a Dialog style activity window to fill the screen-Android

Posted on

Applying Dialog Style to Activity Generally when we set Activity theme as dialog style, <activity android:label=”@string/app_name” android:name=”.DialogActivity” android:theme=”@android:style/Theme.Dialog” /> <activity/> its just display at the center of the screen, with specific width and height set in the XML Layout file or as per the Content. as shown below. At times you may want to display […]

Inspiring Quotes

Quotes by Famous personalities

Posted on

Quotes by Famous personalities Here are some of the Quotes by Famous personalities Believing everybody is dangerous; believing nobody is very dangerous – ABRAHAM LINCOLN If you start judging people you will be having no time to love them – MOTHER TERESA In a day, when you don’t come across any problems – you can […]

Android

Validate a URL / Website name in EditText in Android?

Posted on

Validate a URL / Website To validate URL/ Website name entered in a EditText, this following works fine… private boolean isValidUrl(String url) { Pattern p = Patterns.WEB_URL; Matcher m = p.matcher(url.toLowerCase()); if(m.matches()) return true; else return false; } URL should be in lowercase to validate correctly. Here is ref link. Hope this helps somebody… Cheers…

Android

Set space between columns and rows for GridView

Posted on

At times you may need to set Space between columns and rows for in GridView. Set following attributes of GridView To set space between rows android:verticalSpacing=”2dp” To set space between columns android:horizontalSpacing=”2dp” Sample screeshot.. Cheers.. You may be also interested in Simple Weekview calendar implemented using GridView ScrollView auto scroll to show content in app […]

Android

Avoid DatePickerDialog calls onDateSet two times

Posted on

DatePickerDialog While working with DatePickerDialog, I see an issue when setting a date and click done button. Its calling onDateSet method two times. here is a simple solution for it. DatePicker parameter object has a method called isShown(). Place method statements in the if condition of isShown(), which avoids calling onDateSet method statements two times. @Override […]