This question already has answers here:
How to close/hide the Android soft keyboard programmatically?
(126 answers)
Closed 8 years ago.
I am programming for a Pidion device that is running Android 2.3.7 (Gingerbread). The Pidion comes with a built in keyboard and I would like to disable the softkeyboard from opening.
What is the best way to disable softkeyboard?
try this:
((EditText) findViewById(R.id.editTextReference)).setInputType(InputType.TYPE_NULL);
inside Activity you can do this:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
or inside Fragment you can just use
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
Related
This question already has answers here:
Android getResources().getDrawable() deprecated API 22
(16 answers)
Closed 4 years ago.
This is the line in question. I have it the same way the textbook lists it, but am having issues converting the line to ContextCombat since getDrawable() has been deprecated.
buttonItem.setImageDrawable(getResources().getDrawable(painting.getId()));
You can try using ContextCompat.getDrawable(getActivity(), R.drawable.name);. This will return a styled Drawable as instructed by your Activity's theme. Your code would be more or less as shown below:
buttonItem.setImageDrawable(ContextCompat.getDrawable(getActivity(), painting.getId()));
NOTE: I'm assuming that painting.getId() returns the resource id for the image you want to set as your button's drawable. Also, if you are doing this inside an Activity, you should use the keyword this instead of getActvity().
This question already has answers here:
Set Animated .GIF As Background Android
(3 answers)
Closed 4 years ago.
I would like to know how to put a gif in a Button's background on Android.
I already found out how to put a gif in an image view but I can't find any answer for my problem.
Buttons do not support gifs as a background resource.
Why does it has to be a button?
Just use an Image-View and react to an onClick event.
This question already has answers here:
Disabling the fullscreen editing view for soft keyboard input in landscape?
(11 answers)
Closed 7 years ago.
I launch an AlertDialog in Android with an EditText field. When I use portrait orientation runs fine, but when I change to landscape the keyboard hides my alert. How I can I solve this?
In landscape, some android devices will cause the keyboard to fullscreen when the focus is on an editable feature of the layout (in your case, EditText).
You can flag the EditText to not fullscreen the keyboard in landscape in two ways:
XML: android:imeOptions="flagNoExtractUi"
Code: myEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Why is there no isFocused() in GWT?
Hi guys is possible check if a specific object has focus ? My problem in my web app is determine which object has focus when i press tab button, for each focus i need to do a specific action. thx
This is already addressed here - Why is there no isFocused() in GWT?
Please use the stackvoverflow search!!!!
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I interact with the Lockscreen layout to display text into it, like this app:
I want to show some text to the Android lock screen same as like 'I Like It' android app has implemented. You can see the app on Google play from https://play.google.com/store/apps/details?id=com.ilikeit.main
Not documented, but this will work ;-)
String message = "This is a test";
Settings.System.putString(context.getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED, message);