Let's say I have a basic widget with a button. When i click on this button I would like to display a input dialogue window, still on top of the home screen, where upon entering some value and clicking submit I will see the home screen again.
What I do now is to start an activity with a dialogue which is placed on top of the main activity in my application. Perhaps there is just a simple flag to hide the main activity?
Thankful for any help.
To answer my question, this is what needed to be put in the manifest for my dialog activity.
<activity android:name=".InputDialog"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true">
</activity>
Related
I want to make an activity that when called appears as a small popup on top of any current app (or home screen) kinda like google assistant usually does when called. It is intended to ask for a fingerprint input for 3 seconds or hide if user touches outside its window.
Google assistant is service not any popup activity.
you can do popup activity but, it will only work for when app in foreground like google assistant need background service.
you can use theme
android:theme="#android:style/Theme.Holo.Light.Dialog.MinWidth" for activity make like pop dialog. for this theme require activity instead of appcompatactivity.
if you want exclude from recent use in manifest android:excludeFromRecents="true"
<activity
android:name=".ActivityName"
android:excludeFromRecents="true"
android:label="#string/app_name" />
I have a ListActivity act as dialog. It's fine. when i select item click show another listactivity as dialog. But i want to show second listactivity as pop up window based activity. Already i have set manifest file android:theme="#android:style/Theme.Dialog". Two list activity show but pop up windows not indicate specific item. is it possible we can do? Already have this question in stackoverflow. I know some code are missed. what are the steps. pls help me. Advanced thanks,
Android activity can create as dialog and. activity can run single screen only. multiple activity run on fragment only. you can't make popup window as a activity.
Set below property in manifest for the activity which you want to be open as dialog:
<activity android:theme="#android:style/Theme.Dialog" />
I'm trying to make a page in Android, that the keyboard is always display, even when the user is pressing the back button (in that case I would like the app to go back to the last page).
For example: The page that Facebook did when you are writing a post in there app.
Thanks!
Add android:windowSoftInputMode="stateAlwaysVisible" to your activity in the AndroidManifest.xml file:
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="stateAlwaysVisible" />
In my application I have an activity that has an edittext in it, when the activity launches the edit text automatically is given a selected state and the keyboard appears immediately, the problem here is when this happens other parts of the activity the user sees become hidden, what I would like is that when the activity starts there is no focus on the edittext so that user can view other elements on the page and then decide if they would like to select the edittext and launch the keyboard, any help would go a long way thanks!
use android:windowSoftInputMode="stateHidden" in your manifest.xml file as
<activity android:name=".YourActivity" android:label="" android:theme="#android:style/Theme.NoTitleBar" android:windowSoftInputMode="stateHidden"/>
hope this help
I figured it out, you actually have to go into the manifest file and place android:windowSoftInputMode="stateHidden" in the activity tag for the activity you dont want the keyboard to automatically show up on, took some extensive searching but found it!
friends,
i have a EditText on simple activity with a button.
when every i move from one activity to this acivity focus is automatically set to EditText and keyboard appears in phone.
i dont want to open keyboard untill i click on editText.
can any one guide me what should i do?
any help would be appriciated.
You can use the following line of code to make sure the keyboard doesn't pop up when the activity starts and only pops up when a user clicks into an EditText
Place it in the onCreate method of your activity
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
EditText.setInputType(InputType.TYPE_NULL);
You can also pass the same thing in AndroidMenifest file for that particular activity like:
<activity
android:name="Activity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
This will also work for you :)