Sunday 31 October 2010

Android: Menu button click event

If you want to do smth after hardware MENU button clicks, not default menu creation but something slightly different.The easiest way is to capture the onKeyDown event for the menu button click

Sunday 17 October 2010

Android: Center position of the button (fill_parent, wrap_content)

<Button android:id="@+id/btClick" android:gravity="center_vertical|center_horizontal"
android:layout_gravity="center_vertical|center_horizontal|center" 
android:layout_height="wrap_content" 
android:layout_width="100px" 
android:text=""/>


android:layout_width="fill_parent" - object have width like parent
android:layout_height="wrap_content" - parent height wants to be just big enough to enclose its content

Monday 4 October 2010

Android: Native icons how to use

 In your android phone are many beautiful icons.Here is the list:http://developer.android.com/reference/android/R.drawable.html and here is more http://developer.android.com/design/downloads/index.html


To use: 
  • in recourses  android:icon="@android:drawable/<name of your element>"
  • in java code android.R.drawable.<name of your element>
But be aware:

Warning: Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable).

Rather, you are adviced to make a local copy

Android: Unparsed aapt error

This error appears when you change smth in xml and it changes in recourses not correctly( may be it's bug)
Solution: go in Eclipse to Project>clean it will load last successful build, Good Luck!)