Tuesday 14 May 2013

Silly Mistakes

In this post i am going to write silly mistakes i use to make when  was novice to android .... keep in mind following point to avoid silly mistakes .

1) Always give height and width to every view Or element you write in xml file.

Example :
              incorrect :
                    <TextView
                           android:id="@+id/imeitext"
                           android:textColor="#5c5c5c"
                           android:text="@string/text" />

         
              correct :
                   <TextView
                           android:id="@+id/imeitext"

                           android:layout_height="wrap_content"
                           android:layout_width="wrap_content"
                           android:textColor="#5c5c5c"
                           android:text="@string/text" />



2) When ever you use layout for different devices like layout-ldpi,layout-hdpi, etc. never  forget to include xml which is used to for designing purpose of activity in all the folders.
if you forget then it will give error that no id found for the devices which ever fall in category in which you forgot to include xml file.

Example:

you have folders like layout-hdpi and layout-ldpi you have xml file in layout-hdpi and not in layout-ldpi then when every you deploy you application in the devices fall under ldpi category will prompt an error until you include the xml file in layout-ldpi folder.

No comments:

Post a Comment