Android: Prevent cut-copy-paste popup to be displayed

If you ever need to disable the popup for cut-copy-paste when you long tap a text from an edit text you can do this by using the code below:

Android Stop Edit Text From Gaining Focus When Activity Starts

In this tutorial I will show you how to make the edit text not gaining focus when the activity starts. Sometimes this auto-focus can be annoying because the keyboard shows up even if we do not want to write something into our edit text. But let’s see what should be done in order to get rid of this issue.

1. Into your project files search for the AndroidManifest.xml file.
2. Open the manifest and put the following code between the activity tag:

And that’s all. Now the keyboard should not open automatically when your activity starts.

Android Hide Soft Keyboard and Show Soft Keyoard

In this tutorial I will present you how to hide the android soft keyboard and how to show it too. You might need to hide the keyboard, if, for example, you will have to put a limit of characters that can be introduced into the EditText and want to hide the keyboard when  the number of characters had reached the limit (exactly this scenario I will present you in this tutorial). And also, you might need to make the soft keyboard to pop-up when….hmmm….I don’t know when … but surely you will need it someday 🙂 In this tutorial we will make the soft keyboard to show up when a button is clicked. So let’s start!

1. Create a new project and call your java class(the one that is generated by Eclipse or other IDE)“MyActivity”.
2. Go to res – layout – main.xml and create an EditText and a Button like in the code below:

3. Go to MyActivity class and introduce the following code:

NOTE: The first method for showing the keyboard is working only if a physical keyboard is disabled. So if you test it on your emulator you have to disable the physical keyboard like in the pictures below. And the second method is working even if a physical keyboard is enabled or not.

First go where you can edit the emulator. In Intellij, go to Tools – Android – AVD Manager and select your emulator and press the Edit button. 

After the window with the Edit AVD is opened, click on the “New” button and select from the list “Keyboard support”. Now, that you selected the keyboard support, you must change it’s value from “yes” to “no”. And this is how you can disable the QWERTY support.