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

Android

How to send zip file as attach in email client

Posted on

Hi Guys, When I’m trying to attach zip file to a mail composer. I tried following code //this is a String variable used for file path. String STORAGE_ZIP_FILE=Environment.getExternalStorageDirectory().getPath() + “/MyProj/test.zip”; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, “Person Details”); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(STORAGE_ZIP_FILE)); sendIntent.setType(“text/html”); startActivity(sendIntent); But, I see runtime error as it displayed a toast message saying this […]

Android

XStream ConversionException: Cannot construct it does not have a no-args constructor

Posted on

Hi Guys, While using XStream to parse XML in my app, I see app crash due to this parse issue as ConversionException Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct <ClassName> as it does not have a no-args constructor : Cannot construct <ClassName> as it does not have a no-args constructor I see the issue is due to inner class, […]

Android

Set ImageView width and height programmatically?

Posted on

To set ImageView width and height programmatically imageview.getLayoutParams().height = 20; here imageview is instance of ImageView. Important: If you’re setting the height after the layout has already been ‘laid out’, then make sure you call imageview.requestLayout() Here is the ref link, credits to Hakem Zaied Hope this helps.

Android

Android Hamburger button icons

Posted on

Hi Guys, I see in Facebook or LinkedIn app, these kind of images with three short horizontal lines at the right end to display side menu. When i search for these images, I found these are called as Hamburger images here. And thought to share these icons, to download. I created this icons using Android Asset Studio from this image. […]