Android :: How To Set Dialog Orientation?

Jul 28, 2009

My underlying actitvity is set to landscape orientation, but when I show the dialog, I'd like it to be in portrait (vertical) orientation.I set the orientation in my layout to be vertical but that didn't help. The Dialog class doesn't have a method for such a thing.

Android :: How to Set Dialog Orientation?


Android :: Orientation Change - Dialog Above Activity With Fixed Orientation

May 14, 2009

I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.

Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).

After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?

View 3 Replies View Related

Android :: Progress Dialog And Orientation Changed

Jul 28, 2010

I'm facing some problems with the progress dialogs. I use a managed progress dialog to show the user that an operation is being carried out with the following code written in the onCreateDialog(int id) function.When the operation completes I call dismissDialog(PROGRESS_DIALOG). The problem is that if I rotate the phone while the progress dialog is displayed then when the operation completes the dismiss call has no effect and the progress remains showing. And this I cannot understand why.

View 1 Replies View Related

Android :: Dialog Is Leaked On Orientation Change

Jun 23, 2010

built a simple app that displays an alertDialog with two buttons.The problem is it's not getting dismissed when i change orientation. After change i get a leak warning on debugger and the dialog appears twice(pressing back hides the first dialog, only a second back dismisses it completely).

View 7 Replies View Related

Android :: What's Best Way To Handle An Task Progress Dialog On Orientation Change?

May 27, 2009

I have an app that communicates with a server.While it is communicating, it shows a progress dialog.The way this actually works is that I have a class that I call my Network Gateway.Each method takes a Handler as a callback so that the gateway can send back the response as a bundle when it has finished. Right now when someone changes orientation while a network operation is occuring, the activity doesn't know that a thread is running the network code and then the callback might be invalid.What's the right way to do this? I want to make it so that after the orientation switch, the activity can check something to see if a network operation is running and if so, display the progress dialog again and wait for the callback, or set itself as the callback handler now, invalidating the old one.My first guess is that this is exactly the kind of thing services were designed for, but I'd like specifics if anyone can supply them.

View 25 Replies View Related

Android :: Background Task / Progress Dialog / Orientation Change / Any 100% Working Solution?

Sep 29, 2010

I download some data from internet in background thread (I use AsyncTask) and display a progress dialog while downlaoding. Orientation changes, Activity is restarted and then my AsyncTask is completed.I want to dismiss the progess dialog and start a new Activity. But calling dismissDialog sometimes throws an exception (probably because the Activity was destroyed and new Activity hasn't been started yet).What is the best way to handle this kind of problem (updating UI from background thread that works even if user changes orientation)? Did someone from Google provide some "official solution"?

View 1 Replies View Related

Android :: How To Handle Screen Orientation Change / When Progress Dialog And Background Thread Active?

Jul 10, 2009

My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler.This all works fine, except when screen orientation changes while the dialog is up (and the background thread is going). At this point the app either crashes, or deadlocks, or gets into a weird stage where the app does not work at all until all the threads have been killed.How can I handle the screen orientation change gracefully?

View 9 Replies View Related

Android :: Android Custom Dialog Leak On Orientation Change

Aug 9, 2010

I have a custom dialog box that asks for user input. Relevant code below:...............

View 2 Replies View Related

Android :: Android - Dealing With Dialog On Screen Orientation Change

Jun 10, 2010

I am overriding the onCreateDialog and onPrepareDialog methods or the Dialog class. I have followed the example from Reto Meier's Professional Android Application Development book, Chapter 5 to pull some XML data and then use a dialog to display the info. I have basically followed it exactly but changed the variables to suit my own XML schema as follows:.................

View 3 Replies View Related

Android :: Prevent Dialog Closed / Remain Dialog When Button Is Clicked

Apr 12, 2010

I have a dialog with edittext for input. when i click yes button on dialog, it will validate the input and then close dialog. However, if the input is wrong, i want to remain in the same dialog. every time no matter what input it is, the dialog always automatically close when i click button. How can i disable this. By the way, i use PositiveButton and NegativeButton for the button on dialog

View 2 Replies View Related

Android :: Can Force A Specific Layout Orientation - But Have An Opposite Keyboard Orientation Android

Aug 19, 2010

I understand how to force a specific orientation per activity in the android manifest. I would like to know if it is possible to allow the keyboard to change orientation even though the activity(the layout really) must remain unchanged.

View 1 Replies View Related

Android :: How To Repeat Login Dialog And Progress Dialog?

Jan 25, 2010

I am having a problem about repeating Login dialog (an AlertDialog) and progress dialog, coordinating with http thread. I suppose repetitive Login dialog (if fail, continue) handling should be common and straightforward. I guess my approach must be wrong somewhere. I already spent 2 days on this and am desperate. So please help. User starts the app, the main activity starts.Show a login dialog (generated by the main thread, i.e. from on Create. The main thread then starts a wait_thread, which will wait for http to return data and check the data and decide what to do.After user input username/password and press login, a progress dialog starts.The progress dialog starts an http_thread to talk to the server and get replies. Once done, it will notify the waiting thread.If the user type in the right username password first time, the code works fine.But it always fail for 2nd time Login, i.e. When first login fail(wrong username/ password),the wait_thread will generate 2nd Login dialog to let user repeat the login process. But after user hit the login on this 2nd Login dialog, the system always crashes.

View 3 Replies View Related

Android :: Custom Dialog By Extends Dialog Or AlertDialog

Dec 29, 2009

I want to make a custom Dialog,because i donot like it"s style,i want get a rounded rectangle rather than rectangle . i know to implement it by theme in Manifest.xml . for example :the code
at activity write:

CODE:............

My question is how to implement this Similar result by extends dialog or alertDialog.

View 1 Replies View Related

Android :: ListView Opening Dialog (or Alert Dialog)

Aug 13, 2010

I'm trying to get my list view to open up an alert dialog to display information when a person clicks on a selection. I have been trying several different things on the Google Developers website that have to do with this but have yet to come up with a result. Here is my code. package table.periodic;

import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener;...........

View 1 Replies View Related

Android :: Using Orientation Sensor To Get 360° Orientation

Jul 17, 2009

I have a problem with working with the ORIENTATION values of the SensorManager. I would like to have some kind of 360°-value which directly shows me if the phone is in normal portrait (0°), landscape, portrait turned around (180°) or anything in between. So I could have, for example, an arrow that points to the floor (like gravity would do with a plummet) all the time, no matter how I tilt (sidewards) the phone. I thought this would be easy, but I'm pretty confused at the moment.

First of all, the X value of the orientation-array seems to correspondent with how I turn the phone, BUT: if it's completely uprightly standing, this value is about 60° ... why not 0° (or 90°, 180°, 270°), as I would expect?

Second: The value resets if I turn the phone and Android automatically changes screen orientation. So both in Portrait and in Landscape mode it will be sth. like 60° when the phone is in a 0° angel in real world. I set "android:screenOrientation" to "landscape" but this doesn't help anything :/

I want the app NOT to change orientation when I turn the phone, but I want it to get a continuous orientation value when I tilt the phone.

View 4 Replies View Related

Android :: Creating An Alert Dialog In Dialog

Apr 14, 2010

how to create an Alert dialog in a dialog? is it possible to create? My requirement is to show mulitple dialogs simultaneously. I tried creating with the following code snippet onClick of a Button in the first Dialog and got an "BadToken" exception from WindowManager: "Unable to add window -- token null is not for an application"

AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle("Test Title"); builder.setOnCancelListener(new Dialog.OnCancelListener() { public void onCancel(DialogInterface dialog) { dismiss(); } });

View 4 Replies View Related

Android :: Showing Dialog After Another Dialog Hangs

Sep 2, 2010

I have a really weird problem, which I am unable to debug so far. thing is. my app needs to download something to work. So in the beginning of the onCreate() method, I check if that something is already downloaded. If not, I pop a dialog up asking the user to download it.My dialog is shown and I am clicking, so aManager.install() is called. I am passing the context because that aManager.install() pops up a ProgressDialog to show downloading progress and spawns a new thread in which everything is downloaded. So obviously before creating my dialog I make a Handler to receive the response from that aManager.install(). And the response MAY vary, because for example the internet connection isn't available (Exception raised and catched and listener called with different code).Now, when that happens (Exception) I would like to call another dialog saying "something went wrong, would you like to retry?" so another call to showDialog(DIALOG_REINSTALL) (this time with another code).thing is the showDialog() gets called (I can verify this by logging) but the dialogs doesn't show up. Instead my application JUST HANGS Does someone have a clue why it's doing this? No exception raised, absolutely nothing from logcat, I can't tell WHERE it's hanging...just see that the method is called and the dialog should be displayed.

View 2 Replies View Related

Android :: Replace Facebook Dialog With Custom Dialog In Android

Sep 23, 2010

I am trying to run example of facebook android sdk , in that i have run stream example to fetch the
data from facebook. Now hen ever i click on "fconnect" button to log in into facebook i am getting following dialog box. so is it possible to replace this dialog box with following to make it simple ?

View 1 Replies View Related

Android :: Android Positioning Progress Dialog Or Custom Progress Dialog

Feb 24, 2010

I don't know how to position the progress dialog(the one with the rotating image). When my application starts its display an full screen image and a progress dialog box. I need to moved the progress dialog box a little lower.

View 1 Replies View Related

Android :: Set Screen Orientation Of A Tab

Mar 18, 2009

I would a Tab (in a TabHost) to have a Landscape orientation while the activity with the TabHost is in Portrait orientation, is that possible (if so how)? I tried setting the orientation of the Activity displayed in the tab in the Manifest but it didn't work.

View 7 Replies View Related

Android :: Orientation Changes And Layout

Apr 14, 2010

I figured that I can have custom layout for each orientation just by making two folders layout-port and layout-land. So I put different views in these folders. Worked well.

Now, I have a webview in my activity and it reloads whenever there is any change in orientation. So to prevent that I put android:configChanges="orientation" in my manifest file.

After putting this the reloading stopped but the contents in the layout-port started getting selected for landscape mode as well.

View 6 Replies View Related

Android :: Orientation Changes For Layouts

Oct 16, 2009

i have a layout folder with 2 layouts. layout1 and layout2 i have another folder layout-land that has layout1 in it. i would like to be able to get to all the layouts so i could create a set of layout like this: {layout1, layout2, layout1(from layout-land folder)}is there any way i can use the existing android mechanisim to do that? if not, what would be the impact of creating my own definition of the layout folder (for example to have under the layout folder layout1, layout2 and layout_land1 and have my code do getOrientation to diffrentiate whcih one should be presented).

View 9 Replies View Related

Android :: App Widget And Orientation Changes

Sep 1, 2009

I've built an app widget a fairly simple one that draws an image inside a frame. (If that sounds familiar, that's because it's very similar to the built-in one, but it's a start to something else.)The RemoteView consists of little more than a FrameView and an ImageView. I have a second FrameView that may display or not depending on some certain state awareness.The Image updates on an Alarm schedule rather than the built-in mechanism so the user can adjust this value after installation. The image is set on the RemoteView using a drawable ID from included resources in the package. They've been resized to approximately a quarter of the screen size, but might still be scaled a little by the ImageView.All of this has been working fine. There is one issue that I've been unable to diagnose even the root of the problem.

After an orientation change when the home screen redraws, the ImageView doesn't always draw. The rest of the RemoteView does draw just as it was set during the most recent Update.The mystery is that the ImageView does, in fact, draw if the Alarm is currently set. If it's not currently set, it doesn't draw. Nothing else seems to affect whether it draws or not. It doesn't matter if the widget process is running or not, either (killing it via DDMS and then rotating has the same effect).This occurs in the emulator as well as the G1. During a rotate, the widget gets no update event at all.I could set it to listen for configuration changed broadcasts, but since it works in one of the cases, I suspect something else is going on and that's just an unnecessary piece of duct tape.

View 12 Replies View Related

Android :: Orientation And Webview

Jun 15, 2010

I have a webview and I am using android:configChanges="orientation" to restrain the webview from reloading everytime the orientation changes.I also have two different folders layout-port and layout-land to define the layouts for different orientations.If I use android:configChanges="orientation" then the above two folders are ignored. Can I have both working at the same time?

View 6 Replies View Related

Android :: Handling Orientation Changes Yourself

Jun 3, 2010

From the documentation regarding the android:configChanges='orientation' attribute of the activity tag in the manifest:

Using this attribute should be avoided and used only as a last-resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.

Why does it say this?

In the case of threads and networking requests via a service API library, a request could be made with a reference to the original Activity, and then an orientation change could occur, leaving the thread pointing to the old Activity.

While this can be fixed, it's tedious and ugly compared to just handling the configuration changes yourself.

Why should it be avoided?

I guess I should also ask: would this be an acceptable reason for doing the orientation configuration changes yourself?

View 2 Replies View Related

Android :: Getting Orientation Of Device

Dec 18, 2009

I have a camera preview activity, which is forced to stay in landscape mode.Is there a way I can tell the current orientation of the phone (not the screen orientation).Basically I want to know if the user is holding the phone in portrait mode, or in landscape mode, so I can rotate the output captured bitmap correctly (right now it just always outputs in landscape mode).

View 1 Replies View Related

Android : Receiving Orientation Changes

Sep 22, 2009

I've got an activity which is always configured to be displayed in portrait mode (with android:screenOrientation="portrait"). I don't want it destroyed when an orientation change happens, so I have android:configChanges="orientation" for it.

However, it *does* needs to be aware of orientation changes, so I can update the content. Unfortunately it would appear that while I am being sent configuration change events, the orientation in the configuration claims it's always in portrait mode, presumably because that's what the activity is set to.

How can I have my activity be permanently in portrait mode and *also* receive the correct orientation change events as the phone is rotated?

View 3 Replies View Related

Android App And Screen Orientation

Jan 19, 2012

I was wondering if there was any java code that will allow you to make sure each window in your app stays in portrait despite the user flipping the phone to landscape. I already tried inserting android:screenOrientation="portrait" into both my android manifest and into every single XML file I had but unfortunately only some stayed in portrait and others still flipped to landscape.

View 3 Replies View Related

Android :: Resize Based On Orientation.

Feb 12, 2009

I need to have my view resize itself based on the orientation. After extensive googling (maybe i was using the wrong terms) I could find nothing telling me how to detect when the orientation was changed. Here is my layout file: how do I have it automatically resize itself? I want each item (the EditText and the WebView) to fill half the screen (not counting the title/notification bars). I set the height to absolute and not wrap_content because wrap_content defaults to 1 line for EditText and nothing for WebView. and fill_parent has the EditText on top of the WebView.

View 9 Replies View Related

Android :: How To Handle Activity When Orientation Changes?

Aug 9, 2010

I am writing an activity, that loads data from a server and displays it as a list using ArrayAdapter. For that I'm showing a progress dialog i.e loading, while it loads all data from the server. Then i dismiss the dialog in a handler. My problem is that when ever i change the orientation, the progress dialog is again shown, which is not needed, because all the data is displayed already?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved