Friday, February 3, 2017

Getting rid of the "Don't cover the orange area..." notification


I often got irritated with this message especially when nothing was covering the top part of the screen

To get rid of this notification, one needs to disable the prevent pocket dial feature as shown below

Step 1: Go to "Settings"
Step 2: Go to "Lock screen and Password"
Step 3: Disable "Pocket mode" option (last item on the list - pic below)

Comment if this helped you. :)



Wednesday, February 1, 2017

How to set width of EditText in android

I wanted to create an EditText box of specific width in Android (160 characters - the standard SMS size)

The best approach I found is to create a hint message of required characters
Set hint message as EditText hint with 0% opacity as hint color. So that it is invisible. :)

Example : To create an edit text of 160 characters I created a hint message of 160 characters

Layout.xml
<EditText    android:layout_width="wrap_content"    android:layout_height="wrap_content"   
 android:gravity="top"    android:id="@+id/input"    android:hint="@string/hint_message"   
 android:textColorHint="#00FFFFFF"/>


Strings.xml
<string name="hint_message">Enter message here.............................................................................................................................................</string>
Note: Setting maxLength attribute of EditText will only decide the number of characters the user can input. It does not have any effect on physical width of EditText
Do comment if this helped you. Happy coding! :)