Android :: SensorManager.registerListener Gives Unexpected Results

Nov 30, 2009

I'm registering a sensor listener with this line of code.

mSensorManager.registerListener(this,mSensorManager.getDefaultSensor (Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);

The rate is set to SENSOR_DELAY_FASTEST with the expectation that I would receive events roughly every 20-30ms. It turns out that I receive events only every 200-220ms (just now, my event code simply logcats the system time).

No matter which rate I use, SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or SENSOR_DELAY_FASTEST, I get the same result?

Android :: SensorManager.registerListener gives unexpected results


Android :: SensorManager.registerListener Wants A SensorListener Despite Its Depreciation

Jan 21, 2010

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

So the SensorManager.registerListener is where I'm having the issue. Eclipse insists on a SensorListener, and then proceeds to whine when I pass it one because SensorListener is depreciated.

View 1 Replies View Related

Android :: RegisterListener And Battery Life

Apr 30, 2010

In reviewing this post http://stackoverflow.com/questions/2317428/android-i-want-to-shake-it, the highest rated answer says you should unregister and reregister the listener for the accelerometer onStop and onResume to conserve battery life.

My question is how do we know which listeners we need to stop/resume to minimize our applications footprint on battery life? Things like do OnClickListener, TextWatcher() etc - do they need to be changed?

and if anyone knows, what about adMob's SimpleAdListener?

I sort of assumed that the UI listeners don't consume battery if the Activity doesn't have focus. As for the SimpleAdListener I have no idea....

View 1 Replies View Related

Android :: SensorManager Stop Working After Sometimes / Fix It?

Aug 8, 2010

In my game i use SensorListener for CAR movement according to phone tilting but stop responding after some time. my code is...

View 4 Replies View Related

Android : Why Does Sensor Manager.registerListener Require A Handler

Oct 4, 2010

(sensor Manager is a SensorManager) I'm trying to implement an orientation listener for my program. I declare the listener as a SensorEventListener. The API says I need to pass registerListener a SensorEventListener, Sensor, rate, and handler. What is the handler for?

Also, when I mouse over the error, it insists I use the deprecated version of the method for a SensorListener instead of a SensorEventListener. And this deprecated version doesn't require a handler. Anyone know why?

View 1 Replies View Related

Android :: SensorManager Strange Behaviour Of GetOrientation

Jul 7, 2010

I need to retrieve the orientation of my phone. At the moment i wrote this :

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

This code allows me to get the orientation of the phone if i leave the phone on a flat surface and i rotate it over the surface.

What i did not understand is why if i move the phone upwards the value of this.actual_orientation[0] ,which is the rotation on the zed axis as described [here][1], the value increases although there was no rotation.

Did someone know what happens?

Another strange thing..

I tried my application in the office at work and it had the strange behaviour i described before..
I tried in the same office(same situation) a compass app that i took from the market and it has the same behaviour of mine..when i moved the phone upwards the value changed consistently..
I tried in the same office(same situation) the i-phone compass and it didn't have that strange behaviour!

Then when i arrived at home i tried both, my application and the compass app of my android phone, and they worked!even if i move upwards the phone the value are stable...

View 1 Replies View Related

Android : Calculate Temperature Of Phone Based SensorManager?

Nov 27, 2009

I want to determine temperature of my phone based SensorManager?

In Sensor we have a SENOR_TEMPERATURE! How i can use it?

View 3 Replies View Related

Android :: Unexpected End Of Document Exception

Nov 21, 2010

I'm getting a "SAXParseException: Unexpected end of document" error when trying to parse an xml document on android. The document in question is from the google weather api, but it seems to throw the same error regardless of the xml file in question (as long as the xml is valid) so I suspect it's a problem with my approach, rather than the xml. This is being done as a learning exercise, so I've probably (hopefully) overlooked something obvious. I've run the xml through an online validator, and it comes back as being well formed. (Can't tell me if it's valid as I don't have a DTD, but I dont think I need the DTD to parse the xml). This is the code that I'm using to try and parse the file:

private void refreshForecast() URL url;
try { url = new URL( "http://192.168.1.66:8000/google4.xml");
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
InputStream in = httpConnection.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
// falls over here parsing the xml.Document dom = db.parse(in);
} } catch (ManyExceptions e) { ....
} A cutdown version of the xml that produces the error is:

<?xml version="1.0"?>
<xml_api_reply version="1">
<weather>
<forecast_information>
<city>Hamilton</city>
</forecast_information>
</weather>
</xml_api_reply>

The stacktrace is:
11-20 06:17:24.416: WARN/System.err(406): org.xml.sax.SAXParseException: Unexpected end of document
11-20 06:17:24.416: WARN/System.err(406): at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:131)
11-20 06:17:24.416: WARN/System.err(406): at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:110)
11-20 06:17:24.426: WARN/System.err(406): at com.dave.nzweather.WeatherApp.refreshForecast(WeatherApp.java:159)
11-20 06:17:24.426: WARN/System.err(406): at com.dave.nzweather.WeatherApp.onCreate(WeatherApp.java:100)
11-20 06:17:24.426: WARN/System.err(406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-20 06:17:24.438: WARN/System.err(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-20 06:17:24.438: WARN/System.err(406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-20 06:17:24.446: WARN/System.err(406): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-20 06:17:24.446: WARN/System.err(406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-20 06:17:24.456: WARN/System.err(406): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 06:17:24.456: WARN/System.err(406): at android.os.Looper.loop(Looper.java:123)
11-20 06:17:24.456: WARN/System.err(406): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-20 06:17:24.466: WARN/System.err(406): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 06:17:24.466: WARN/System.err(406): at java.lang.reflect.Method.invoke(Method.java:521)
11-20 06:17:24.466: WARN/System.err(406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-20 06:17:24.476: WARN/System.err(406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-20 06:17:24.476: WARN/System.err(406): at dalvik.system.NativeStart.main(Native Method)
11-20 06:17:24.486: WARN/ROGER(406): org.xml.sax.SAXParseException: Unexpected end of document

In the interest of brevity, I've not included the original xml, but it's just the standard weather xml from googles feed. I've also tried a few completely different xml files, (including the sample from http://www.ibm.com/developerworks/xml/library/x-android/) and they all give the same error. (They also all validate as well formed when I run them through an online xml validator). This makes me think that it's not a problem with the xml, but rather with how I'm trying to feed it into the parser.

View 2 Replies View Related

Android :: Checkbox In List Being Checked Unexpected

Feb 16, 2010

I have list of checkboxes in list binded by Custom simpleCurserAdapter. in my Custom simpleCurserAdapter ive override the newview and binview with my modifications. ive managed somehow to do multichoice.. wierd thing after i delete any item from my list , the first item's checkbox is being checked all of a sudden.. how does that happen? how can i solve it?

code: my curser SimpleCursorAdapter class:

CODE:......

I couldnt find another way of doing this, but this is how i set listeners to my checkboxses

CODE:.....

Now this is code part from the ListActivity class which desbribes the button which deleting the checked Box items

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

View 3 Replies View Related

Android :: Astrid Warning - Prevent Unexpected Erase?

Feb 12, 2010

Got a Samsung Moment a couple of weeks ago. Last night starting using Astrid (Task/ToDo app), which came pre-installed on my phone. When I launched Astrid for the first time, I got a warning message -- something about making sure Sprint Update or Sprint Updater doesn't kill Astrid, or ruin it, or something. Clearly, I didn't understand the message. But I clicked "Okay" anyway, and started using Astrid. But I'm worried that a Sprint Update could erase all my Astrid data -- my To Do's. I'm reluctant to create many Astrid tasks until I know how to prevent them from being unexpectedly erased. My questions: Can anyone explain the situation to me? (e.g., I have no idea who/when/how/where/what Sprint updates). Can anyone explain what I need to do to prevent the catastrophe about which Astrid was warning me?

View 1 Replies View Related

Android :: How To Debug Unexpected Exceptions (source Not Found)

Feb 9, 2010

I am pretty new to Android, the thing that bugs me the most about the IDE is that I am not able to get any information about an unexpected exception when it gets thrown, I can put a try catch block around identified code that generates it, but in many cases it takes time to find the line of code that generates the exception. is there any other way I can get the exception information? in JDT when an unexpected exception is thrown the call stack displays the exception class name. but in ADT this doesn't work.

View 13 Replies View Related

Android :: Unexpected Visual Element In Simple Tab Layout

Jun 19, 2010

The screen shot below is of a simplified version of the application from the Tab Layout tutorial. You can see a black horizontal line below the tabs. Why is it there and how can I remove it?

View 2 Replies View Related

Android :: Handle Unexpected Internet Disconnect While Downloading Data

Mar 31, 2010

I have here a function that downloads data from a remote server to file. I am still not confident with my code. My question is, what if while reading the stream and saving the data to a file and suddenly I was disconnected in the internet, will these catch exceptions below can really catch that kind of incident? If not, can you suggest how to handle this kind of incident?

I call this function in a thread so that the UI won't be blocked.

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

View 1 Replies View Related

Android :: RelativeLayout Fill_parent Unexpected Behavior In A ListView With Varying Row Heights

Apr 29, 2010

I'm currently working on a small update to a project and I'm having an issue with Relative_Layout and fill_parent in a list view. I'm trying to insert a divider between two sections in each row, much like the divider in the call log of the default dialer. I checked out the Android source code to see how they did it, but I encountered a problem when replicating their solution.

To start, here is my row item layout:

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

The issue I'm facing is that each row has a thumbnail of varying height (ImageView01). If I set the RelativeLayout's layout_height property to fill_parent, the divider does not scale vertically to fill the row (it just remains a 1px dot). If I set layout_height to "?android:attr/listPreferredItemHeight", the divider fills the row, but the thumbnails shrink. I've done some debugging in the getView() method of the adapter, and it seems that the divider's height is not being set properly once the row has it's proper height.

Here is a portion of the getView() method:

CODE:.........

The rest of the method simply sets the appropriate text and images for the row.

Also, I create the inflater object in the adapter's constructor with: inflater = LayoutInflater.from(context);

Am I missing something essential? Or does fill_parent just not work with dynamic heights?

View 1 Replies View Related

Android : Child Activity Exit By Unexpected Exception - OnActivityResult - Is Not Called

Jun 23, 2010

I have faced with issue about startActivityForResult() and onActivityResult(). If child activity started by the startActivityForResult() exit by unexpected exception the onActivityResult() is not called and I have no any ideas how can I handle this to get application working in a fail-safe manner ?

When my code runs child activity with startActivityForResult() it awaits until onActivityResult() will be invoked to get working further, but onActivityResult() is not calling and my code is "hang- up" (logically).

So the question is how can I handle all possible ways the child activity is finished (normally and by unexpected exception) to get fail-safe code ?

I have check the documentation for this issue but have found nothing relating issue.

View 4 Replies View Related

Android :: Unexpected Extra Byte Occurring In Binary Logcat Entry Stream

Nov 19, 2010

I've been implementing a logcat reader in java which uses the binary output of logcat (-B switch) rather than the text based formats. My code works for many of the entries, but frequently the binary log entries have an extra byte inserted which I can't account for, making the payload the wrong size.

From looking at various bits of the c++ code for both the logcat program itself and the logging apis, the binary format seems to be:

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

Payload section of the header is (payloadlength bytes total):

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

This file defines the struct: http://www.google.com/codesearch/p?hl=en#2wSbThBwwIw/include/cutils/l...

The extra byte I'm seeing occours after the nanosecond timestamp and before the log priority of the payload. e.g. Here is a hex dump of one of the log entries with the phantom byte:

The byte (in this instance) is 0x1D at offset 0x14 0000:

CODE:.......

The extra byte shifts the payload by 1, so the payload length becomes incorrect. I can't see where this byte is coming from.

I also tried the LogReceiver class in ddmlib, but that also fails to handle extra byte and produces garbage after it hits an entry with the extra byte: [url]

Here is a quick python script which demonstrates the problem. It reads and prints binary log entries in the expected format. It will raise an exception when it encounters an entry with an unexpected byte: [url]

The logcat program itself successfully reinterprets the binary format without jumping through any hoops, so I can only guess it's some kind of struct alignment artifact. Anyone encountered this or got any idea why the extra byte is appearing?

View 2 Replies View Related

Android :: Davlik Bug - UNEXPECTED TOP-LEVEL EXCEPTION: Java.lang.IllegalArgumentExcep­tion

May 10, 2009

I am attempting to integrate some previous libraries that we have within my new android project.

I have made several attempts including:

Importing the code as sub-projects (that are built using the android.jar)

Importing the code as jar files (from the built code)

Adding the files directly as part of my project

Reordering the dependencies

However for each one of these scenarios I keep getting the following exception thrown by the davlik compiler.

It is always picking the first class in the package (ie if I remove that class, it picks the next and so on).

It would appear to me that this is a compiler bug - somehow it's getting it's dependencies in a twist.

Anyone else experienced this? And/or have any ideas on how to get around this one?

UNEXPECTED TOP-LEVEL EXCEPTION:

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

View 3 Replies View Related

General :: External Memory Unexpected Remove?

Mar 19, 2013

My memory card is always unexpectlly removed when my device is idle, so I have to wait my gallery recreate thumbnail if I want to use it

View 4 Replies View Related

2.1 Update :: Unexpected Jump From Timescape To Home Screen

Nov 29, 2010

I updated my X10i to 2.1 on Orange and am noticing that there's a problem with my Timescape (great app btw) where the phone suddenly goes from Timescape spline to the Home Screen without me touching anything. The phone seems much slower now in loading some apps - one main example is the text/mms messaging app.

View 5 Replies View Related

General :: Unexpected Status Message (Automatic Backup)

Dec 7, 2012

I got a surprise status notification today about completed automated backup. I see this message for he first time. Where it came from, as there was no activity attached to the notification.

I do my own backups and have the standard sync and backups disabled, and I have not installed anything particularly weird or non-market since the last time I reflashed the device. To the best of my knowledge nothing but my own backup does backups.

Which app may be responsible for it? I am quite uneasy having apps that backup who knows what who knows where.

Pic of the said notification attached: [URL] ......

The device is a rooted Nexus 7 with stock JB 4.2

View 1 Replies View Related

Sony Ericsson Xperia X10 : Update Service - Unexpected Error

Oct 20, 2010

I just bought Xperia10 mini yesterday and download the Pc companion and installed it ! when I connect my phone to that it says there is another better softwaredriver for phone when I try to update it starts and download the driver then almost at the end it gets error and says it couldnt be installed cuz of issues?

Then I installed Update service I get this :

http://img341.imageshack.us/img341/8500/sattan.jpg

The wireless is good and working after I try update service I get unxpected error and it resets my wireless

I have Windows 7 64BIT

View 3 Replies View Related

Android :: Unexpected Resume Of Package Name Error In Android

Apr 9, 2010

If changing the orientation of my phone or the emulator I get the following output in LogCat:

04-09 11:55:26.290: INFO/WindowManager(52): Setting rotation to 1, animFlags=0
04-09 11:55:26.300: INFO/ActivityManager(52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/1 nav=3/1 orien=2 layout=18}
04-09 11:55:26.460: INFO/UsageStats(52): Unexpected resume of client while already resumed in client
04-09 11:55:26.579: INFO/SearchPosition(807): Activity is paused
04-09 11:55:26.689: INFO/SearchPosition(807): Activity is resuming

SearchPosition is the activity that is displayed. Activity is paused is written in the onPause Method and Activity is resuming in the onResume method of the activity. I googled a little bit for the error message but I don't fully understand the meaning of it. I think it could mean that the old Activity is not properly destroyed after changing the screen orientation. Is this correct? If yes what causes the error? If this is not correct? What is the meaning of this output?

View 1 Replies View Related

Android : "Unexpected Resume Of <packagename> While Already Resumed" Message?

Oct 3, 2010

Several of my Android applications show the following type message in the logcat output:

I/UsageStats( 59): Unexpected resume of com.totsp.test while already resumed in com.totsp.test

In this case I created the default Hello World app by letting the ADT tool generate it, and it still gets this message. I am not doing anything special in onCreate and don't even have any other methods defined.

I realize this is an INFO level message, and it doesn't appear to hurt anything, but I was curious what was going on so I made a test application that keeps track of the onResume invocations. It is indeed re-resuming when this occurs. I'm wondering why this this occurs? While I haven't noticed a problem (other than these annoying log messages), it seems like it could be using more resources than necessary to do all this stuff an extra time.

I have searched and read a similar question here on SO, and the answer there seems dubious to me: http://stackoverflow.com/questions/2606470/unexpected-resume-of-package-name-while-already-resumed-in-package-name-erro. Specifically, no, you don't want to use android:configChanges="orientation" because that is just subverting the orientation tear down/resume, rather than fixing it. Even the documentation notes "this attribute should be avoided and used only as a last-resort" (http://developer.android.com/intl/de/guide/topics/manifest/activity-element.html#config).

Also I have seen thread in the Android dev group where Mr. Murphy says the "unexpected resume" is "benign": http://groups.google.com/group/android-developers/browse_thread/thread/567410dbfcc163c2.

I'll dig into the source when I get a chance, but I figured I would first just ask the all-knowing hivemind and see if someone already knows: why does this occur, and is it truly benign?

View 1 Replies View Related

Android :: Get Web Results From HttpClient?

Jun 19, 2010

For example: Say I searched something on the Walmart homepage. Like this. How would I retrieve the information from the first product listed. Information like product name, price, details, rating, model. And how would I search in the box.

The only way it seems like to me is to replace http://www.walmart.com/search/search-ng.do?

search_constraint=0&ic=48_0&search_query=someProduct&Find.x=0&Find.y=0&Find=Find.

Then replace someProduct with the seach and call it in an HttpClient.

View 1 Replies View Related

Android :: Parsing Kml And Null Results

Sep 7, 2010

I changed test.kml to test.xml.

When i tried this XmlResourceParser x = this.getResources().getXml(R.xml.test);

It returns null.

What am i missing?

Below is the kml.

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

View 2 Replies View Related

Android :: Backflip Testing Results

Apr 1, 2010

I got my app to install on the Backflip and started testing it. On the emulator everything appeared ok but on the Backflip there are a few notable differences.

I have edittext boxes which on the emulator automatically vary in size to accommodate the text. The text is a number, the max being two digits, i.e., 1-99. On the Backflip the edit boxes seem to be a fixed width and that width is larger than needed. Consequently some of the edittext boxes go past the end of the screen and can't be used or seen. This doesn't happen on the emulator.

I also have spinners. One set of spinners is created using android.R.layout.simple_spinner_dropdown_item populated by an array from array.xml. These spinners have the radio button showing and they work on both the emulator and the Backflip displaying a white background with black text.

The other spinner is created using int layoutID = android.R.layout.simple_spinner_item and is populated with strings from the database using an ArrayAdapter. This spinner displays ok on the emulator with a white background with black text. On the Backflip however, it displays the white background but with white text making the list essentially impossible to see. The list is populated because when I press on an item the background color changes to red, the text is white, and the program works ok.

My question is: Are these discrepancies peculiar to the Backflip or am I doing something wrong in the code? I'd hate to think all devices come with peculiarities that require workarounds. Hopefully I'm doing something wrong and hope someone can point out what it is. I'll post any code someone wants to see but right now I don't know what to post. Thanks.

I should add that when I use android.R.layout.simple_spinner_dropdown_item for the other spinner the text shows up ok but I now have the radio buttons which I don't want.

View 1 Replies View Related

Android :: When We See Results For ADC2 First Round?

Oct 21, 2009

Do you have any idea when we see the results for ADC2 first round? The official google log said that in several days we are able to continue with ADC2 phase 2 judging. 15 days has past since then and now news about the start of second round. Has someone any idea about this?

View 2 Replies View Related

Android : Couldn't Find Any Results / How To Get?

Nov 10, 2009

I did a search around but couldn't find any results which is surprising. Or it could be me just not searching correctly. Is there an App that allows me to blog via Blogger?

View 2 Replies View Related

Android :: Results From Alert Dialog Inline

Oct 10, 2010

Is there a way to get alert dialog results inline (like you can with most dialogs)? I want to determine what to do next inwith a dialog, but I can't figure out how to get the results back in the same method that I create the dialog from thus allowing me to continue in my logic flow.

void doStuff() { dlg = CreateDialog() dlg.show(); // shows the dialog and doesn't return till the dialog is dismissed

if dlg.getResults() == this) { doThis(); } else { doThat(); }

}

View 4 Replies View Related

Android :: Geocoder Not Returning Results In 1.5 Preview

Apr 16, 2009

I do not get any results from the Geocoder in the 1.5 preview release. Any information on this? In the maps application it works but my calls simply return an empty list (no exception, all permissions I know of (in this case only Internet) are set.

View 7 Replies View Related







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