Android :: Current Orientation Of Device / Slider Position
Feb 5, 2009How do i find the current orientation of the phone (portrait or landscape) How do i find the slider position?
View 2 RepliesHow do i find the current orientation of the phone (portrait or landscape) How do i find the slider position?
View 2 RepliesCan anybody tell me how to get the current position of the index while reading the binary file from DataInputStream? I have seen a mark() method but one is Boolean type and the other is void. I need to read the indexes on separate locations to use them again.
View 1 Replies View RelatedI want to insert a constant string into an EditText by the press of a button. The string should be inserted at the current position in the EditText.
If I use EditText.append the text gets inserted at the end of the EditText.
How can I do that? I couldn't find a suitable method.
I am wondering if we can change orientation just by sensing the layout position, port or land;without flip like iphone does.
View 4 Replies View RelatedI simply want to do code...
The problem is - getRequestedOrientation always returns -1. Any suggestions?
how do you actually get the co-ordinates ofyour position in java? I thought I had it figured out but i seemto be getting a nullpointerException so it must not be getting anything.
Code:
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double lati = location.getLatitude();
double longi = location.getLongitude();
GeoPoint me = new GeoPoint((int)(lati*1E6), (int) (longi*1E6));
How do I map the device Y axis to the screen Y axis?I can't figure this out.I'm the developer of Tricorder, and I'm trying to make it so that the accelerometer and magnetometer indicators I draw always point in the right direction.On the G1 phone with the slider closed, all is well.But when I open the slider, I end up showing that gravity is pulling me to the left (if the phone is held with the display vertical).So, I know that the device, and hence sensor, Y axis is always in the direction of the earpiece; and the screen Y axis changes when I open the slider.And I know that I can use remapCoordinateSystem() to change the device axes to match the screen axes.But where do I find out what the device's orientation is?In other words, how do I compute the correct values for the X and Y parameters to remapCoordinateSystem()?
Configuration.orientation seems quite useless.Suppose it is set to LANDSCAPE.What does this mean?Does it mean a device which is "naturally" portrait (i.e. the sensor Y axis points to the narrow end), and which has been turned into landscape mode?If so, which way was it turned?Or does it mean a device which is naturally landscape?In other words, LANDSCAPE could mean that the screen axis is off from the sensor axis by +90, 0, OR -90 degrees.Not much help.So how do I do this?Obviously I want my app to work on all devices, not just the G1 phone.
I'm currently developing an app for Android which uses google map service. Because users will be able to see thousands of markers I would like to load only those which are currently within the map bounds (i.e. when user look at specific map tile). I know how to do it with javascript/html. However, Android doesn't seem to provide any similar methods such as containsLatLng(latlng) or getBounds (I only found getLatitudeSpan and getLongitudeSpan, but don't know how can I use them in order to achieve the similar effect). Can anyone give me some hint on that?
View 4 Replies View RelatedMy phone is opening in my jacket pocket. Anyone else have this problem? I can hold the back and give the phone a MILD shake and the slider completely opens. Also if I push on the Magnifying Glass while the phone is closed, the phone has quite a bit of downward travel, but the other three corners dont...this happening to anyone else?
View 2 Replies View RelatedIn my actual project I need to draw a MapView with a given running/walking/cycling path on top of it. I don't need the current position so I added an overlay just for the path (no MyLocationOverlay). The path is painted but I don't see the Map in the emulator - only the grey tiles. The apiKey is set in the layout (MapView) and INTERNET permission is set in the Manifest. So I'm wondering if I need more. Is it the emulator simply not working well (I do have 3G and 2 bars in the emulator) or do I need something else? Do I need to build an additional overlay or add additional permissions (xxxLOCATION) to the Manifest.
View 1 Replies View RelatedI 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 RelatedI have set my deveiec property to landscape in manifest file android:screenOrientation="landscape" No at runtime when I am trying to get the current orientaion of device using Configuration and ActivityInfo classes. Its always giving me landscape mode even my device is in portrait mode. Please suggest if you have any method which gives device orientation info at runtime.
View 2 Replies View RelatedHow does my android activity know (is there a callback) when there is a change in screen orientation?
View 1 Replies View RelatedHow can i get the default orientation of a Android device.DROID has portrait as the default orientation whereas many of the android tablets have landscape as the default orientation. I want to determine the default orientation of a android device through an OS call and this orientation should be independent of the device position/ rotation.I will be of great help if somebody can suggest a mechanism to achieve the same.
View 11 Replies View RelatedI know this has been discussed over and over now but I just got it workign and it works perfectly on the emulator when I mock the location with long and lat however, I am still getting NULL in the location when I run the code on my phone.
here's the main code...
How we get the current language in device
View 3 Replies View RelatedIs there a way to get the current battery status of the device (battery level and if the battery is currently charging). The only way I found so far is by using a Broadcast receiver to "listen" for battery status changes. Is there a way to get the battery status using a direct API call? I my case, I would like to check if the battery has sufficient charge (or is being currently charged) before starting the download of some (potentially large) files.
View 2 Replies View Relatedis it possible to manually rotate the screen or fix the current screen orientation (with a key/button)? because it really annoys me having taken portrait pictures that cannot be viewed (with the media gallery application) in a portrait fashion on the milestone. this is because it always rotates the portrait picture back to landscape when rotating the milestone from landscape to portrait. right now there is no way of properly viewing portrait pictures on the milestone other than tilting your head (holding the milestone landscape and tilting your head along).this cannot be the way it was intended to be, right? or do I have to get a different viewing software which allows you to choose screen orientation? is there such an app?
View 1 Replies View RelatedI know there is the Date() class built into the API, but line of code actually grabs the time of day?
View 3 Replies View RelatedI am new android development. My new requirement is location details. I need to find, device current location in the form of latitude and longitude.
View 3 Replies View RelatedInvoked device native player to play audio file, it opens android native player on top of the application but when selecting to back out or return to the application, device automatically stops playing the current media.
Sample code:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"audio/*");
startActivity(intent);
How can I implement so that Device should continue to play audio in the background when selecting to back out or return to the application
I'm working on a project to display a route in a MapView based on current location from GPS Provider. I'm able to draw the path between two points but the problem starts when the location changes to a new point causing the draw path to erase. Basically my Location Listener saves the current Geopoint and sets the new Geopoint location and after that it starts the overlay to draw a path based on those two points. I think an option could be saving the coordinates to a database and then pulling the information from there to draw the path.
private class MyLocationListener implements LocationListener {
public void onLocationChanged(Location location) {
Toast.makeText(getBaseContext(), "Tracking device..",
Toast.LENGTH_SHORT).show();
[code]....
I have been thinking of extracting my current ROM and make a flashable .zip out of it. Is there a way to do this? Does RUU.exe work on a non-HTC device? My device is a XOLO Q1000.
View 7 Replies View RelatedWhen one wants to publish his App on the Android Market he can upload up to two screenshots of his app. I would like to take these screenshots with my current device (Motorola Droid) that I'm using to test the application.
There are some Apps on the Android Market that allow you to take screenshots, but you have to root your phone, which I dont want to. There are related topics within stackoverflow where people want to take screenshots out of there code (here). However I just want to take screenshots of my running app with the current device, which is connected via USB to my computer; I'm developing via Eclipse, so there should be a way to tell your running device that it should take a screenshot via the sdk, right?
On my htc i was looking through display, i see g sensor calibration and i perform this calibration and after i do so the screen seems to have a delay when switch from the horizontal position to the vertical position. its weird because when i switch to the phone horizontally it switch normally and responds fast. but when i switch back to vertically it takes almost 7 seconds to actually switch back, sometimes it switch within 2 or 3 secs but never as quick as switching horizontally.
MQuote:
Originally Posted by Rigmaster
Make sure you have the latest updates, which impact speed on the device in some unpredictable and unexpected ways. During system updates, your Evo may reboot and will take the g-sensor changes as last calibrated.
If you're already updated, shut down and repower (soft reboot) should do the trick. I actually updated my phone and after it started to do this. I restarted the phone plenty of times i even took the battery out for 30 seconds. It only does it when im texting on the browser, basically everything but the camera. He camera screen rotation is perfect. I even rooted the phone but i havent figured out how to use the root to fix the problem. Should i do a firmware update? Because i just did the htc software update.
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?
The default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.
You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options
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 RelatedI 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.
I want my preference menu to have something to change the duration of a vibration.There is not an slider tag for prefs.xml, so which is the best way to do this?
View 1 Replies View Related