Bottom layout below ScrollView Or ListView moving up along with Soft keyboard

Hi Guys,

When you have a layout at bottom of the screen, below a ScrollView/ListView. If you have EditText to edit data,  when Softkeyboard pops up, the bottom layout moves up along with SoftKeyboard. And at times, it’s not require the bottom layout to moves up with Soft Keyboard.

bottom layout

To handle this, you just need to set this attribute to ScrollView Or ListView, keeps the layout at the bottom


Solves the issue.

Cheers. 🙂

Apply ColorStateList for TextView to show when click on it

Using ColorStateList for Textiew we can display colours when click on it.

When we need to display a text as a link, and clicked on the text starts another activity or do some action. It looks good if we display text color states, so User can know text is clicked. Here is how we can do it…

Create file in res/drawable/text_selector_red_black.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">
    <item android:state_focused="true" android:state_pressed="false" android:color="@color/black" />
    <item android:state_focused="true" android:state_pressed="true" android:color="@color/black" />
    <item android:state_focused="false" android:state_pressed="true" android:color="@color/black" />
    <item android:color="@color/red" />

and in color.xml file add these colors


Then use apply textColor property for TextView as “@drawable/text_selector_red_black” in design window. Or you can apply in coding as below


Hope this helps. 🙂

Themes not applying to ListView items Android

I applied themes for an app, Its worked fine for all screens except few screen which are having ListView custom items. Here is the cropped image of a ListView item row showing theme not apply to it



Here is the solution for it, I implemented a custom ArrayAdapter class and i call that class like this

CustomListAdapter adapter = new CustomListAdapter(getApplicationContext(), R.layout.listitem);

after so much search, I find the issue is with above line at


. See this link to know few more details.

So, I changed it to like this

CustomListAdapter adapter = new CustomListAdapter(ActivityName.this, R.layout.listitem);

Fixes the issue.. after that theme working fine with ListView item. and It shows like this below


Hope It helps somebody out there 🙂

How to send zip file as attach in email client

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/";

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Person Details");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(STORAGE_ZIP_FILE));

But, I see runtime error as it displayed a toast message saying this

Read access denied. The selected file cannot be read.


I see the fix for it is replace Uri.parse with Uri.fromFile as per this link

File zipfile=new File(STORAGE_ZIP_FILE);
Intent sendIntent = new Intent(Intent.ACTION_SEND);
 sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Person Details");
 sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(zipfile));

It solved the issue. As you see i used text/html mime type as setType, but as per this link here. I see we can also use “multipart/x-zip” which seems meaningful and it’s works fine too.

Hope it helps somebody….


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

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, which i used to call in Main class. And solution for it is remove that inner class code and Create new file with that ClassName. And use this newly created class in Main class. Fixes the issue.

I see tip of information here

Hope it helps somebody.

Graphical Layout is blank and Eclipse reports rendering library more recent than your version of ADT plug-in

After installing a new Android SDK, I see Eclipse Graphical Layout is blank, rather showing the rendering of the layout.
And in Design window, it displays this message:

This version of the rendering library is more recent than your version of ADT plug-in.
 Please update ADT plug-in.

Work around for this is simply

Change android version as shown below
Graphical Layout

here i find this tip.

Hope it helps somebody…

Set ImageView width and height programmatically?

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 Hamburger button icons

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.

ic_hamburger_hdpi ic_hamburger_mdpi ic_hamburger_xhdpi Hamburger

After sometime later, I found an useful romannurik link. You may use this link for creating different set of Clip arts. You can see lot of pre-loaded clip arts available to use.

Hope this helps somebody.

Thank you.

How to get rid of “No grammar constraints (DTD or XML schema) detected for the document.” warning message

To get rid of “No grammar constraints (DTD or XML schema) detected for the document.” warning message

In Eclipse,

Window menu->

Go to the Preferences window, then XML ->

XML Files ->


Then in the Validating files section of the preferences panel on the right,

choose Ignore in the drop down box for the “No grammar specified” preference.

No grammar constraints

You may need to close the file and then reopen it to make the warning go away.

credits to Marc Bernstein, here is ref link

hope it helps somebody