Android

Invalid request. Missing the ‘origin’ parameter. Google Map directions request URL error

Posted on

Google Map Direction request API changed It seems Google Map Direction request API changed, which is used to get polyline points to draw drive path. Previously, I implemented drawing driving path on Map using below directions request. And this link worked perfectly, I used to get all the waypoints information, with it. https://maps.googleapis.com/maps/api/directions/json? waypoints=optimize:true|52.28582710000001,-1.1141665|52.2777244,-1.1581097& sensor=false but […]

Android

Display Menu items in ActionBar when using Fragment

Posted on

Display Menu items in Fragment ActionBar When Implementing Fragment screen, If it require to display Menu Items only specific to that Fragment screen. If you just write the following code… @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu, inflater); menu.clear(); inflater.inflate(R.menu.done_actions_menu, menu); } /** * On selecting action bar icons […]

Android

Validation using default feature of EditText

Posted on

Default Validation EditText I found a good article here on how to use the default feature of EditText to show the error. While writing the validation on EditText on a button click event or TextChanged event instead of showing alert dialog if you want to show error we can use the default feature of EditText as EditText […]

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 […]

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 […]