Android :: Exiting From Xml.parse When Match Found
Aug 18, 2010
I'm using the Android SAX parser to search for entries in a rather large (6MB) XML file. I'm basically using a derivative of the code shown in listing 8 here. The question I have is how do I stop parsing once my match has been found? The code shown continues parsing through the end of the file but I want to stop before then. Is this possible or do I need to use something other than SAX
View 1 Replies
Apr 26, 2010
I have a weird issue. I receive the following error that causes a force-close:
CODE:...........
After clicking the Force Close button, the Activity is recreated and the parsing completes without a hitch. I'm using the following code snippet inside doInBackground of an AsyncTask:
CODE:.......................
Why would the Activity force-close and then run without any problems immediately after? Would a BufferedInputStream be any different? I'm baffled.
It turns out HttpURLConnection.getResponseCode() returns -1 every so often, so the InputStream probably isn't being correctly set.
View 5 Replies
View Related
Jul 29, 2009
I have an app that receives and stores SMS messages. The main use is to run in the background, although it does have a full GUI when running in the foreground. I'm using a notification with the FLAG_ONGOING_EVENT flag so users can tell the application is running, even if it's in the background. However, the user could easily close the app by viewing the main screen and clicking the back button. The notification icon goes away, but I would like to be able to warn the user that closing the app would prevent it from capturing the SMS messages. Is there any way to prompt the user if they really want to exit the application when they hit the back button, and prevent the exit if they say no? Or should I take a different approach? And a bonus question: is there a way of receiving an SMS message, but prevent it from passing on to, say, the Messenging app?
View 5 Replies
View Related
Oct 13, 2009
I find that when I am running 2 android devices connected to 1 linux machine, I find I can get ADB shell to exit abnormally. If I start a shell on Device 1, then on Device 2 start a shell and type reboot. Device 2 resets like expected, but the shell on device 1 will exit. I find that functionality of running controlling multiple devices with ADB very useful for testing. My question is can anyone reproduce this? Has this been fixed upstream? Is ADB planning on first class support for multiple devices, or was this an after thought feature? Any help debugging this, or possible just a little information in the right direction so I can make a patch myself.
View 5 Replies
View Related
Sep 4, 2009
I am experiencing a crash in my app when I quit (via the back button) out of my Activity. So far as I can tell this is happening in the Android codebase and not mine, but I'm not completely convinced of that.
AndroidRuntime E Uncaught handler: thread main exiting due to uncaught exception
AndroidRuntime E java.lang.RuntimeException: Unable to stop activity {MyApp/MyApp.MainActivity}: java.lang.NullPointerException
AndroidRuntime E at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3097)
AndroidRuntime E at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3159)
AndroidRuntime E at android.app.ActivityThread.access$2400(ActivityThread.java:112)
AndroidRuntime E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
AndroidRuntime E at android.os.Handler.dispatchMessage(Handler.java:99)
AndroidRuntime E at android.os.Looper.loop(Looper.java:123)
AndroidRuntime E at android.app.ActivityThread.main(ActivityThread.java:3948)
AndroidRuntime E at java.lang.reflect.Method.invokeNative(Native Method)
AndroidRuntime E at java.lang.reflect.Method.invoke(Method.java:521)
AndroidRuntime E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
AndroidRuntime E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
AndroidRuntime E at dalvik.system.NativeStart.main(Native Method)
AndroidRuntime E Caused by: java.lang.NullPointerException
AndroidRuntime E at android.app.Activity.performStop(Activity.java:3575)
AndroidRuntime E at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3092)
AndroidRuntime E ... 11 more
View 1 Replies
View Related
Jan 14, 2010
I am seeing a curious behaviour in my app. I have a widget that gets updated by a service every # hours, when the service finishes I stop it, using "stopService(new Intent(this, MyService.class));", the widget if pressed launches an Activity. Now it gets interesting, while im on the activity everyting works fine, then when I exit the app(by the back key or a button I designed which simply calls this.finish() ) the ActivityManager would tell me that my process has died, I do not see any error of any kind, just that the process has died.
Why I am seeing that message and what does it mean exactly? That is having a side effect on my service regarding static variables getting set to default. Could my code be the cause of this? Is there any way to know that your process has died? I have tested my app on a HTC Hero running 1.5, it always works well on the emulator and I never get that message. I know android kills processes to reclaim memory but Im always careful to close apps heavy on resources.
View 4 Replies
View Related
Nov 18, 2009
I would like to know how to execute code before exiting application. My application is composed of several activities. When the user starts the application (from the launcher menu or from a notification in the status bar), he goes in an InitActivity where I process some initializations. From user experience, application always restarts. One of these initializations is to init a network manager and start a thread that periodically sends a network request to notify a server that application is active.
I need to process some end operations, like stopping this thread when user quits application, for example by pressing the HOME key or BACK key when he's in the root activity. However, when the user press the HOME key, application is still running in background.
Q1 : is it possible to execute code when exiting application (I see the onTerminate() method of the class Application but it seems not to be always called)?
Q2 : Is it possible to force application exit (activity method finish () only destroy the current activity, not the application)?
Q3 : Is it possible to handle HOME key press (onKeyDown() is not called when this button is pushed)?
View 3 Replies
View Related
Jul 13, 2009
I have a service receiving and sending data to a server in separate threads each. The service lifecycle methods look like this:..................
View 3 Replies
View Related
Jun 20, 2010
I've been researching the OS a bit and I can't really tell what happens to programs when you hit the home button to leave them. Do they stay running in the background? After a little bit of time does the system close them out? What happens to them? I have a Sprint Evo and I don't see a way to close them out. I know that battery life can always be helped, and I would hate to leave them running all day just sucking the life out of the phone if they don't have to be.
View 18 Replies
View Related
Mar 5, 2009
Say a user runs my app from the HOME screen. The app has 3 tabs. Say he/she selectes a different tab, so he/she is in a different screen (same task). Now - if the user presses BACK - the device returns to the HOME screen. If the user launches my app again - the default tab is shown. BUT - if the user presses HOME - the device returns to the HOME screen (same). If the user launches my app again - the OTHER tab is shown.
I understand (sort of) the logic - BACK returns to previous app, popping my app from the history stack, so when launched again - it is started from scratch. But this is confusing my customers - they say it's a bug ! They dont understand the different between two keys doing the same thing as far as they see (returning to HOME). Moreover - I see a different behavior with the built-in DIALER app - I change tabs, press HOME, launch the app again - and it starts with the default tab.
View 11 Replies
View Related
Nov 4, 2010
I have a timer thread setup to play a loop using soundpool, but for some reason I cannot get _soundPool.stop(_playbackTimer); to stop the loop. even if I exit the application the loop keeps running. I have to physically power off the phone to get it to stop. am I missing something here? Does anyone have any experience with this? I have searched with no resolution. below is a snippet.
if(timeLeft>0 && timeLeft<20 && ticking == false){ _soundPool.play(_playbackTimer, 0.3f, 0.3f, 0, -1, 1); ticking=true; }
if(timeLeft==0 || timeLeft>20){ _soundPool.stop(_playbackTimer); ticking=false; }
View 2 Replies
View Related
Feb 9, 2010
With Android Eclair 2.1 on ARM-based target, we are executing Instrumentation test application from command line:
am instrument -e class android.app.foo. -w com.android.cts.foo.MyTestApp/android.test.InstrumentationTestRunner
Test application executes fine, showing result of the sub-tests in the MyTestApp. But, Application Manager is not exiting properly. This is observed from "ps" command output:
1114 0 52328 S app_process /system/bin com.android.commands.am.Am in....
Due to this issue, we are not able to execute the test applications in shell script.
View 3 Replies
View Related
Dec 30, 2009
Does anybody have any insight as to why a game appliction would restart when exiting with the back button. It does not automatically restart when using the Home button to exit and this only occurs one time (after the second attempt to exit with the back button, it exits cleanly). Also, I can reproduce this consistently on the Motorola Droid, but have not been able to reproduce on the G1 or the emulator running 2.0. I've tried changing the launchMode of my activities, but have not found something that works. These are my activities:
1. Splash Screen, Single Instance, Main/Launcher 2. Help, Single Instance 3. High Score, Single Top 4. Preferences, Single Top 5. Options, Single Top 6. Game, Single Top, with SurfaceView
The steps to reproduce the problem are: 1. User starts application, launching Splash Screen Activity 2. User starts game, launching Game Activity 3. Game Activity launches Options Activity (for result) 4. Game Activity restarts with result and game begins. 5. Pressing Back Button returns to Splash Screen Activity 6. Pressing Back Button again, briefly shows home screen, then relaunches Game Activity which starts Options Acitivity 7. Pressing Back Button again finally shows the home screen
View 2 Replies
View Related
Feb 18, 2009
the thread sleeped not killed and it wakes up after 10 sec and try to post message and it causes exception. is there any way to kill the threads those are in sleep mode while exiting the application?
View 5 Replies
View Related
Feb 7, 2014
I am trying to connect to a database, and I understand that it has to be outside of the main thread but i thought that this is what my code was doing...apparently not because i keep getting the error: android.os.NetworkOnMainThreadException.
package com.example.dbtesting;
import java.sql.*;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
[code]....
View 1 Replies
View Related
Jan 27, 2010
When typing on the keyboard, Android suggests words that match what's typed so far. Usually that's useful. But if I get to the end of the word and none of the suggestions match, it's quite annoying. Android has one matching word listed in red, and when I hit the space bar it auto-matches to the red word. If I'm typing a name or an abbreviation, I have to backspace to undo the match.Is there a better way to make Android not take the match?
View 7 Replies
View Related
Apr 17, 2010
I have a few separate applications which are all launched purely through a main application.I am wondering if I'd be able to use intents to retrieve a list of all the sub-applications which match some discovery intent. The main application currently needs to know what Intents to use to START these sub-applications, but is there a way to use intents to see if other Activities on the device match a set of intent-filters?
View 1 Replies
View Related
Oct 6, 2010
This is my code:
CODE:...........
The items in the ListView comes from an AsyncTask. When the AsyncTask is running I want it to stop adding non-matching items. For now, if it had loaded 5 items and I search with a specified String, then when the AsyncTask continues loading items it adds automatically Orders to the ListView, even if there isn't a match.
View 1 Replies
View Related
Sep 5, 2010
Do I need to implement a custom thumb Drawable?
View 1 Replies
View Related
Sep 3, 2010
Is there any place where I can get AVD files to match various models of phone?
View 3 Replies
View Related
May 9, 2010
I have midnight bowling installed, and when I play it works, but when I stop (press home button) I get the game sound after a while, so it is still running in the background. There is no exit button in this game, so how do I stop it then? cause it's eating my battery alive :-)
View 3 Replies
View Related
May 13, 2010
After wasting over an hour trying to update to 2.1, I've given up on trying to get the drivers to work, but now my phone is stuck in Download Mode. Is there a way to get out of this, and turn my phone back on, so I can use it for now, before taking it to the Sprint store tomorrow to have them do the update?
View 2 Replies
View Related
Jul 4, 2010
I've notice recently my Hero has been acting up, almost as if it is rebooting. However, I don't believe it is a full reboo, i.e. no sprint logo during boot. Only occurs when exiting out from the internet browser. As soon as you hit the home screen to exit, the phone returns to the white htc load page. It appears like it is the full reboot but it does not move next to the Sprint/Now pages. Next the desktop appears but it is grayed out (i.e. my desktop still shows but grayed out, no icons or widgets showen) and the spinning loading icon shows up. Once it finishes loading things appear back to normal. Almost makes me wonder if this reboot is more like sense rebooting and not the entire phone/system. Not sure if this is possible but I want to get anyone's thoughts and if anyone else had expirenced this.
View 12 Replies
View Related
Jun 29, 2010
How does the Moto Droid X match up to the Archos 5 running Android? I've got the Droid and the Archos 5. But bought the Archos mainly as a mp3 player and book reader. My Droid is a great mp3 player but every time it is in my pocket the slider moves and I have to get it out slide the lock and hit play again. Very annoying. Also you get all the notices, such as emails, texts, calendar reminders, etc making thier alarms through the songs. This is why I searched out Archos as a media player. But it really isn't pocketable.
You can but it is large. The Droid X is larger then Droid (4.3 vs 3.7) but still a little smaller than Archos 5". I've done so much research for the last 2 weeks, I'm going silly trying to remember everything and what's what. So has anyone checked both these out and think they are pretty much the same thing only a little smaller screen? Just curious as I'm leaning towards returning Archos and going with Droid X. Hopefully at some time they will make an app that will shut off everything but phone calls while music player is playing.
View 1 Replies
View Related
Sep 13, 2010
I have a Motorola Droid running Android version 2.2. Every so often I will receive email on my Droid from a POP3 account where the subject line does not match the body of the e-mail. For example I will receive on my Droid an e-mail from Amazon confirming order shipment but the body of the e-mail will be an advertisement from Hertz, HP, etc. The Amazon e-mail body is not shown. If I look in Gmail online it is fine so this so this is only on the Droid.
View 4 Replies
View Related
Dec 11, 2009
Is it possible to style a single, say, TextView in Android with multiple alternating styles, colors, and sizes? Think inline HTML or CSS but in the Android world. As an extreme, to demonstrate the point, let's say I wanted to have a word "CIRCUS" with each letter a being different color. Do I have to create 6 TextViews for this or can this be done in one?
View 1 Replies
View Related
Mar 10, 2010
I am testing my multiplayer game by running several instances of the emulator (which is, sadly, extremely slow and dis-satisfying). I depend on a little trick using currentTimeMillis() to keep a synchronized clock between the players (but NOT the absolute value of currentTimeMillis() since no two phones are probably set exactly the same)Anyway, I *do* naively assume that two emulators, running on the same PC would return near identical values for calls to currentTimeMillis(), and what I find is that they start off the same, but pull rapidly apart.Which makes me think the underlying implementation of currentTimeMillis() in the emulator is not at all based on the host PC's calendar, and rquires the emulator to get enough Windows compute cycles to be anything close to accurate. (and one emulator is always running at a lower priority to the other, depending on which one is on top)
If this is just an artifact of the emulator, then I can deal with it, but if it implies I have a fundamental misunderstanding of currentTimeMillis(), then that would be something i need to deal with. Part two of the question is: any way I can speed up the emulator? When I run two, are they sharing one of my cores? Can I split them onto separate cores?
View 10 Replies
View Related
Jul 6, 2010
When you have a list activity and in onListItemClick() you need to obtain the selected item and then match it against various options, what is the efficient way to do it? switch case cannot be used since I want to match Strings. Is a very long if-else if ladder the only way to do it?
Basically the question is how to do something that normally would be done in switch statement with Strings.
View 3 Replies
View Related
Nov 28, 2010
I have the following issue. I am starting a recognizer intent activity in order to detect speech using the "startActivityForResult" method. I have also an "onActivityResult" method listening for results from the recognizer activity. It works and it detects my speech. The problem is that it is only called when everything is ok or when i cancel the operation, but it is not called if it doesn't find a matching text "RecognizerIntent.RESULT_NO_MATCH" or in the rest of wrong cases "RecognizerIntent.RESULT_........" What is happening? Application is Android 2.1 and I have tested on a Android 2.2 device.
View 1 Replies
View Related
May 16, 2010
In an Android manifest, how can I use a negative match in the android:pathPattern? I'd like to use a pathPattern that matches on all URLs except for a specific hostname, if it's possible.
View 1 Replies
View Related