Titanium Textfield on TableView not getting focused - android

I am having few text fields inside the table view, while clicking on the text fields it is not getting focused(in Android platform). I have seen some questions regarding the same issue, but those suggestions not worked for me. I am using Titanium 1.7.5, Android 2.2

I resolved this problem in Android to set the Edit Text Property:
android:imeOptions="actionSearch"
If it is not working on Mobile Device, I have another solution for it:
android:imeOptions="actionNext"
android:selectAllOnFocus="true"

I had the same issue, and some steps you should keep in mind:
Don't add a focus event to the field, this will overwrite the build-in one
Add the event singletap and fire the focus event on that field
mytextfield.addEventListener('singletap',function(){ mytextfield.focus(); });
This should do the trick, at least, it did for me.

textfields did not act identically on every device while gaining the focus. you should have a look at the softKeyboardOnFocus-property. it can have the following value:
Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS
Titanium.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS
Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
maybe it helps to set the property to SOFT_KEYBOARD_SHOW_ON_FOCUS. this requests to show soft keyboard on focus. keep in mind that android can override this.

Related

Android Edit Text Cursor Doesn't Appear

in my app I disabled the keyboard (I use now my custom keyboard) using this code:
editText.setInputType(InputType.TYPE_NULL);
Now, my problem is that the text cursor does not appear anymore in the edit text. What should I do? Any suggestion would be very appreciated.
There is an Issue opened in bug tracker Issue opened in bug tracker for this.
One of the users suggests the approach which works on "most" devices.
Briefly, all you have to do is call:
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
for your EditText view (after you called editText.setInputType(InputType.TYPE_NULL);).
You should probably also set:
editText.setTextIsSelectable(true);
in order for text to be selectable (though in does not seem to work properly with Samsung Galaxy SIII). This method is only available starting from HONEYCOMB (api11) so keep that in mind when developing for older Android versions.
Also it is stated that your EditText should not be the first view to receive focus when activity starts (if it is - just requestFocus() from another view). Though I (personally) have not experienced any problems with this.
Rather than just using a custom view for your custom keyboard, why not implement a full-fledged IME? That will solve your cursor problem, and even make your keyboard available outside your app (if you want).
This answer has a couple useful links if you want to do that:
How to develop a soft keyboard for Android?
I really wouldn't suggest this. Writing a good full fledged IME is really hard. In addition, users come to expect functionality from their keyboard (auto-correct, Swyping, next word prediction, the ability to change languages) that you won't have unless you spend months on the keyboard itself. Any app that wouldn't allow me to use Swype would immediately be removed (bias note: I worked on Swype android).
But if you want to integrate fully with the OS as a keyboard, you're going to have to write an InputMethodService. Your keyboard would then be selectable by the user in the keyboard select menu, and usable for any app. That's the only way to get full OS integration, otherwise you'll need to really start from scratch- writing your own EditView. Have fun with that, getting one that looks nice is decidedly non-trivial.
Also, setting input type null won't disable most keyboards. It just puts them into dumb mode and turns off things like prediction.
I tried the below answer and it worked, but take care that
1) EditText must not be focused on initialization
2) when your orientation changes while the user's focus is on the editText, the stock keyboard pops up, which is another "solvable" problem.
This was mentioned in a previous answer but take care that you MUST make sure your editText element do not get focus on instantiation:
https://code.google.com/p/android/issues/detail?id=27609#c7
#7 nyphb...#gmail.com
I have finally found a (for me) working solution to this.
First part (in onCreate):
mText.setInputType(InputType.TYPE_NULL);
if (android.os.Build.VERSION.SDK_INT >= 11 /*android.os.Build.VERSION_CODES.HONEYCOMB*/) {
// this fakes the TextView (which actually handles cursor drawing)
// into drawing the cursor even though you've disabled soft input
// with TYPE_NULL
mText.setRawInputType(InputType.TYPE_CLASS_TEXT);
}
In addition, android:textIsSelectable needs to be set to true (or set in onCreate) and the EditText must not be focused on initialization. If your EditText is the first focusable View (which it was in my case), you can work around this by putting this just above it:
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" >
<requestFocus />
</LinearLayout>

phonegap android edittext is hidden behind virtual keyboard

I am developing an android phonegap app. i created a popup using HTML, which contains two edit fields for "username" and "password". when these fields receives focus, the soft keyboard appears and hides immediately. Can anybody say why it behaves like this.
Thanks in advance
it must be losing focus right after too for some other reason I would suspect.
Try to add android:windowSoftInputMode="adjustResize" on your Android manifest file.That worked for me.
It's a late answer but will be helpful for someone else.

How to disable Android Soft Keyboard for a particular activity?

I have an activity with one EditText where I need to input numbers only.
Now, I have defined the Input Type for my EditText to be number only and have drawn up a pretty keypad for my user to use, however I also need to make sure the soft keyboard doesn't pop up for my user when they click on the EditText.
I have tried hiding the keyboard through the manifest by adding
android:windowSoftInputMode="stateAlwaysHidden"
in my Manifest for the particular activity, but this doesn't work for me because as soon as the user clicks on the EditText the keyboard appears again.
I've tried doing the same programmatically like so
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
but that doesn't work either. Keyboard appears when the user clicks on the EditText.
The only thing that worked was setting InputType to null for the EditText like so:
EditText.setInputType(InputType.TYPE_NULL);
but I cannot use this because it will allow users who have a keyboard attached to their device to input letters and other symbols in the EditText field, while I want everyone to specifically use only the keypad to enter data in the field.
I should also mention that I am currently testing my app under android 2.1, but I would like my solution to work across all versions. Any help would be appreciated. Thanks in advance.
Just thought it might be possible to extend EditText and handle the access to the softkeyboard through there and came across this question which has a very elegant solution to my problem.
Just followed the steps and this handled the softkeyboard perfectly for me. Hope it helps others that come across this issue.
In Whichever Edittext you need to disable the soft keyboard, add attribute in xml of that edit text.
<EditText android:id=".."
..
android:focusable="false" />
It will stop the execution of soft keyboard.
Use the android:windowSoftInputMode="stateHidden" in your activity in manifest file. This will work. Don't use the android:focusable="false" for EditText unless if you are not willing to input the text. If you want to give input then remove that property for the edittext in the layout file.
You can try this. It is working for me:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
If you are using for example ViewGroup it allows you to block the soft keyboard using this method:
view.setDescendantFocusability(view.FOCUS_BLOCK_DESCENDANTS);
Thanks to this the view will get focus before any of its descendants.
you can use This Code:
<EditText
.
.
android:enabled="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="numberPassword" />

How do I get the done button to appear on the soft keyboard?

So, I do not see a done button on the soft-keyboard. There is the standard enter key, but from my reading I am lead to believe that there could be/should be a done button (when working with an AutoCompleteTextView at least. I have tried adding the following line to my xml, but to no avail:
android:imeActionLabel="Done"
I know Im missing something pretty huge, what is it?
The answer was to include
android:singleLine="true"
in the xml for the AutoCompleteTextView. This switches the enter key for next if there are multiple edittexts (and done for the last one), or for done if there is only one edittext.
Have a look at this question:
Disable Next button

edittext not showing the typed text in android

In my android application i am using a simple login page.
The issue is that when testing in android htc wildfire,the user could not see the text typed till he press back or done
I would like the user to view his text while typing itself.
'
Could anyone please let me know how to resolve this?
Please share your valuable suggestions.
Thanks in advance :)
Looks like your problem is this:
When user clicks in the EditText to type, the keyboard pops up and hides the EditText, thus the user can't see what he's typing
For this, you can put that EditText into a ScrollView so that when keyboard pops-up, Android scrolls the EditText up. This way,the user can see what he's typing.
Well I don't know whether it will help you or not. but am sharing because some other may be benifited. I got the same issue in my Kindle tablet.
And I have solved this just by adding the simple attribute to the edittext.
<EditText
.........
android:textCursorDrawable="#drawable/Black"
/>
And its done. Now it will show each character you types.
If it helps you, I will suggest you to write the above attribute everytime you declare an edittext, even though this issue doesn't occur.

Categories

Resources