Android :: PopupWindow Can't Be Dismissed When Press Back Key
Jun 4, 2010I've created a custom PopupWindow but when I press back button, the window doesn't dissapear.
View 3 RepliesI've created a custom PopupWindow but when I press back button, the window doesn't dissapear.
View 3 RepliesTrying to the do as the title describes with the following code, but it doesn't seem to work. It just does nothing once i have altered the keyCode. Do i have to do something to the event?
..............
i want to trigger the onKeyDown listener programmatically but don't know which method i should call? Does anyone know?
View 3 Replies View RelatedAre there api to support go to back Programmatically i.e same effect as the back button of the phone.
View 5 Replies View RelatedMy application uses GPS updates while it is running and I would like that to stop when the user back out of the app as I assume it will continue wasting a lot of battery power. I've tried intercepting the back button press but it doesn't seem to work. I'm not sure if this is because it's not executing the code or I'm using the wrong command.
CODE:.....................
The docs say "The onStart() and onStop() methods can be called multiple times, as the activity alternates between being visible and hidden to the user"When I press the back button an it will go back to the previous activity which totally covers the old one.What is going on here?
View 1 Replies View RelatedI am using ViewFlipper for my application. I trying to make it.when user pressed on escape (back) button, it would be back to parent Layout.
View 3 Replies View Relatedi have an app that haves a lot of activitys, all created with ONACTIVITYRESULT.which method is called when i press back key? i need to know it because i have to override/implement code on it
View 2 Replies View RelatedEssentially, what I'd like to do is to be able to press the 'back' button on my Hero to take a picture, rather than pressing the trackball.
View 2 Replies View RelatedSay you're surfing the web and are on a website like this forum. You then feel like checking a text message or making a call so you go ahead and do that.
How do you get back to the browser that is still running in the background and to the same website you were working on? I hope there's an easy answer and I'm just stupid.
I have installed Tasker and I'm new to using it. My favorite music player is Playerpro, but what I was wondering is what would i need to put in variables or actions, if I wanted to use the volume buttons to press skip or back while the screen is off and i'm using the app.I would use Gravity Box to do so but Cyanogen or any of its tweaks and mods are not compatible with the SM-G730v.
View 1 Replies View RelatedI recently upgraded my htc desire s to the official 3.5 sense version and them to the endymion rom and both have something quite annoying in all browsers I have tried (dolphin, stock and boat browsers).
What happens is pressing back sends me to the top of a web page, meaning I have to press back twice to get to the previous page. It's not a huge deal, just a minor annoyance.
There are many questions related to how to programatically show/hide the soft keyboard.
However, as we all know the android back button will cause the keyboard to be dismissed. Is there a way to prevent the user from dismissing the keyboard with a back button press?
I tried to capture the back button, but when the keyboard is displayed onKeyDown in my activity is not invoked when the back key is pressed and soft keyboard is visible.
What is the difference between a dialog being dismissed or canceled in Android?
View 1 Replies View RelatedWhen I press the back button all the way isnt it suppose to close the browser? The web browser still shows as a running app.
View 2 Replies View RelatedI have an Android Spinner and I'd like to get a callback when the user selects something from its popup dialog. It seems like
setOnItemClickListener() or setOnItemSelectedListener()
would be the right method to use, but neither get invoked when I select one of the items in the spinner. Is there a correct way to do this? Per commonsware's suggestion, I did the following, but my onItemSelected() method is never being called:
final Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter( new ArrayAdapter<SettingValue>(getContext(), android.R.layout.simple_list_item_1, android.R.id.text1, setting.getSettingValues() ) );
spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Log.d("BOOGA");
final SettingValue settingValue = (SettingValue)parent.getSelectedItem();
final Editor edit = getContext().getSharedPreferences( PREFS_CONTEXT_NAME, Context.MODE_PRIVATE).edit();
edit.putString(setting.name(), settingValue.name());
edit.commit();
} public void onNothingSelected(AdapterView<?> parent) { // do nothing
} } );
From the moment I received my HTC Hero from orange several weeks ago I noticed the when I press the back arrow button on the bottom right of the phone its clicks and creaks, dont think its the button itself but its the plastic battery case that makes the sound.
Does anyone else have this problem?
Look at my code.
- code -
private Handler handler = new Handler(); private ProgressDialog dialog;
final Runnable runInUIThread = new Runnable() { public void run() { dialog.dismiss();
} };
private void DoThis() {
dialog = new ProgressDialog(Main.this); dialog.setTitle("Title");
dialog.setMessage("Text"); dialog.show();
Thread newTask = new Thread() {
@Override public void run() { Looper.prepare(); DoThat();
handler.post(runInUIThread); Looper.loop();
); newTask.start(); } }
Is it possible to use test.setText("something") in this thread to update a Button text or TextView in the LinearLayout after the dialog is dismissed? I try cheating placing:
test.setVisibility(View.INVISIBLE);
test.setText("something");
test.setVisibility(View.VISIBLE);
after dialog.show();
It kind of updated the text when the dialog open. I want to do it after the dialog was dismissed. What is the correct way to implement this in my thread?
Whenever I am using any app and press the home button, the home screen blacks out for a few secs and it takes around 10 sec to get all the icons back and before I can start using my phone again. I am using a non rooted mytouch 3g.
This problem does not happen if I exit an app by pressing the back button. It becomes very annoying at times.
So i rooted with Droid Does rom, because i heard its nice and fast and what not. So basically the only problem i have with it is this.
When on a call, the proximity sensor doesnt work, so the screen goes black. And when i press the end call button to turn the screen back on it just ends the call. Is this normal? Or a known issue?
it just flips out goes up and down and the screen cant be touched untill i press the top button and it goes back to the screen lock, i have it rooted and running 2.2 im not all up on what this does should i just reset to og settings?
View 1 Replies View RelatedI have, for the time being, a custom view with a 9-patch image as a border.
That custom view is placed three times in a LinearLayout, so it looks like this:
+------------------------+
| CustomView |
+------------------------+
| CustomView |
+------------------------+
| CustomView |
+------------------------+
I have attached a click event listener to the View, so it is clickable. But then I click it, I cant see that I am clicking it - there is no change in color.
So, Im thought that I'd attach a "onPress" listener, and then change the background of the view but I couldnt find such a listener.
So, the question is - how do I create the behaviour on the View so I can see that it is being pressed? this is normally done in Android with a green background to indicate that it is now being pressed.
I intend to show this as a dropdown just below the button that drops this down.
View 2 Replies View RelatedI am having a similar issue while trying to use a GridView in a PopupWindow. On my Activity's onCreate method, I am inflating a gridview from xml as follows:
CODE:......................
I would like this GridView to popup on a button click. Also inside of my activity's onCreate,
I have:
CODE:............
On button click, I am throwing a ClassCastException from GridView.onMeasure(int, int).
http://img139.imageshack.us/img139/1203/devicei.png
I've seen this in a few apps, and i have expiremented with both PopupWindow, and AlertDialog and I was confused which this was.
I looked online and was not able to find a working example of the PopupWindow class. The code examples I found online either compile but do not work, or are using methods which have since been removed (such as Activity.getViewInflate()). Is there a simple working example that displays a PopupWindow?
View 3 Replies View RelatedI am trying to make a PopupWindow show straight away when an activity has started.
when calling public void showAtLocation (View parent, int gravity, int x, int y)
I get the exception ERROR/AndroidRuntime(2500): Caused by: android.view.WindowManager $BadTokenException: Unable to add window -- token null is not valid; is your activity running?
At the moment I am calling from onCreate, but when calling from onStart or onResume it still gives the same error.
The activity api says the activity is supposed to be running after onResume is called. Where is the best place to load up the PopupWindow if it needs to be done straight away?
At the moment It looks like Activity.onWindowFocusChanged() is the best place.
How can i put my PopupWindow to system desk or other app? how can i use this permission:INTERNAL_SYSTEM_WINDOW
View 2 Replies View RelatedI've experimented with a PopupWindow, but don't have a very good way of controlling its size. It only responds to absolute pixels.
View 3 Replies View RelatedI put an editText on a PopupWindow and it's not working. It acts like a disabled edit text, clicking on the edit text won't show the soft keyboard. How can I add an edit text on a popupWindow?
View 2 Replies View Related