Cannot solve android.view.ViewRoot$CalledFromWrongThreadException. Help needed? - android

after searching i've found that some phones (like the Galaxy s) are affected by a strange bug or whatever that cause this error:
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:2934)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:643)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511)
at android.view.View.invalidate(View.java:5279)
at android.webkit.WebView.selectionDone(WebView.java:4470)
at android.webkit.WebView.clearHelpers(WebView.java:1295)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
... 4 more
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:2934)
at android.view.ViewRoot.invalidateChild(ViewRoot.java:643)
at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:669)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511)
at android.view.View.invalidate(View.java:5279)
at android.webkit.WebView.selectionDone(WebView.java:4470)
at android.webkit.WebView.clearHelpers(WebView.java:1295)
at android.webkit.WebView.loadDataWithBaseURL(WebView.java:1714)
at c.a(Unknown Source)
at c.doInBackground(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
And this is the logcat if needed and from here it seems that is problem of the swipe function:
10-27 19:19:20.329 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:20.329 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:20.749 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:20.749 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:21.689 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:21.689 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:21.689 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down.
10-27 19:19:21.989 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:21.989 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:22.159 I/Ads ( 1125): Refreshing ad.
10-27 19:19:22.169 I/webclipboard( 1125): clipservice: android.sec.clipboard.ClipboardExManager#4051cb08
10-27 19:19:22.259 I/Ads ( 1125): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"preqs":15,"u_sd":1.0,"u_w":320,"slotname":"a14e098781b871d","msid":"***PACKEGE_NAME***","js":"afma-sdk-a-v4.0.4","isu":"F1B8EEEA64C5716BA996D22689C17557","format":"320x50_mb","net":"wi","app_name":"4.0.4.android.***PACKEGE_NAME***","hl":"pt","u_h":480,"u_so":"p","u_audio":1,"prl":792});</script></head><body></body></html>
10-27 19:19:22.449 I/InputReader( 166): dispatchTouch::touch event's action is 1
10-27 19:19:22.449 I/InputDispatcher( 166): Delivering touch to current input target: action: 1, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:22.449 W/webview ( 1125): Miss a drag as we are waiting for WebCore's response for touch down.
10-27 19:19:22.599 I/Ads ( 1125): Received ad url: <"url": "http://googleads.g.doubleclick.net:80/mads/gma?preqs=15&u_sd=1&u_w=320&slotname=a14e098781b871d&msid=***PACKEGE_NAME***&js=afma-sdk-a-v4.0.4&isu=F1B8EEEA64C5716BA996D22689C17557&format=320x50_mb&net=wi&app_name=4.0.4.android.***PACKEGE_NAME***&hl=pt&u_h=480&u_so=p&u_audio=1&prl=792&output=html&region=mobile_app&u_tz=240&ex=1&client_sdk=1&askip=0", "afmaNotifyDt": "null">
10-27 19:19:22.609 I/InputReader( 166): dispatchTouch::touch event's action is 0
10-27 19:19:22.609 I/InputDispatcher( 166): Delivering touch to current input target: action: 0, channel '4096f5c8 ***PACKEGE_NAME***/***PACKEGE_NAME***.Game (server)'
10-27 19:19:23.339 W/dalvikvm( 1125): threadid=11: thread exiting with uncaught exception (group=0x40018578)
10-27 19:19:23.339 E/ACRA ( 1125): ACRA caught a RuntimeException exception for ***PACKEGE_NAME***. Building report.
10-27 19:19:23.339 D/ACRA ( 1125): Retrieve application default SharedPreferences.
10-27 19:19:23.349 V/webview ( 1125): ZoomScale 3 mPreserveZoom: false
10-27 19:19:23.489 I/ACRA ( 1125): READ_LOGS granted! ACRA can include LogCat and DropBox data.
10-27 19:19:23.519 D/ACRA ( 1125): Retrieving logcat output...
The only thing that can cause this error is a Timer that i use in my application in the game Intent, i tried to set up a handler but i saw a lot of crash in my ACRA log.
This is the content of my intent, i hope that someone should help me :)
startB.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
startB.setEnabled(false);
partiColTempo(tempox);
}
});
}
private void displayText(final String text){
this.runOnUiThread(new Runnable(){
//#Override
public void run() {
tempo.setText(text);
if (text.equals("Finished")){
eseguiSuono();
assegnaPunti();
startB.setEnabled(true);
//elapsed=0;
tempo.setText("Waiting");
}
}});
}
private void partiColTempo(int tempox) {
TIMEOUT=tempox*1000;
Log.w("tempo timer", ""+tempox);
elapsed=INTERVAL;
TimerTask task=new TimerTask(){
#Override
public void run() {
elapsed+=INTERVAL;
if(elapsed>TIMEOUT){
this.cancel();
displayText("Finished");
return;
}
//if(some other conditions)
// this.cancel();
displayText(getString(R.string.tempo_rim)+" " + (TIMEOUT-elapsed) / 1000);
}
};
Timer timer = new Timer();
timer.scheduleAtFixedRate(task, INTERVAL, INTERVAL);
Is the problem there? Because i can't find other place when i call asynctask.

You are clearly doing something with UI (i.e. View-derived objects) from AsyncTask.doInBackground(). That's not allowed, only the UI thread can touch UI objects.
If you need to update UI from your background/AsyncTask as it's running, you must call publishProgress() which will cause onProgressUpdate to run on the UI thread. You can also implement onPostExecute() which will also run on the UI thread once the background thread has finished.

This scenario generally occurs when AsyncTask thread is working in the
background but in the meanwhile, the UI activity class is destroy. So
after completion of the AsyncTask when we try to perform some UI task,
the above Exception will thrown.

Related

ANR and Activity reported stop, but no longer stopping

I have this problem on some devices and on some occasions, and I can't reproduce it 100%. Sometimes when the user switches away from my activity they get this error: Activity reported stop, but no longer stopping: ActivityRecord and usually it's followed by an ANR like:
02-26 19:43:31.187 I/InputDispatcher( 1062): Application is not responding: Window{8f7e457 u0 gb.xxy.hr/gb.xxy.hr.player}. It has been 5000.8ms since event, 5000.6ms since wait started. Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 14. Wait queue head age: 6964.8ms.
02-26 19:43:31.208 I/WindowManager( 1062): Input event dispatching timed out sending to gb.xxy.hr/gb.xxy.hr.player. Reason: Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 14. Wait queue head age: 6964.8ms.
02-26 19:43:31.270 E/ActivityManager( 1062): ANR in gb.xxy.hr (gb.xxy.hr/.player)
02-26 19:43:31.270 E/ActivityManager( 1062): PID: 14732
02-26 19:43:31.270 E/ActivityManager( 1062): Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 14. Wait queue head age: 6964.8ms.)
02-26 19:43:31.270 E/ActivityManager( 1062): Load: 0.0 / 0.0 / 0.0
02-26 19:43:31.270 E/ActivityManager( 1062): CPU usage from 179169ms to 0ms ago (2019-02-26 19:40:32.074 to 2019-02-26 19:43:31.243):
My activity onstop has no code in it, but I do have some code which releases the surface:
#Override
public void surfaceDestroyed(SurfaceHolder holder) {
myLog.d(TAG,"Surface Destroyed.");
try {
holder.removeCallback(this);
holder.getSurface().release();
}
catch (Exception e)
{
myLog.e(TAG,e.getMessage());
}
videoexecutor.shutdownNow();
visible=false;
m_codec.stop();
m_codec.release();
m_codec=null;
}
I did had a look at a similar question: Android onStop times out despite doing no work and I do think that this is somehow caused by the surface but I cannot figure it out what is actually causing it, and why not on all devices and not all the time....
Any thoughts?

jelly bean app gets killed on a phone call

Our app is crashing on jelly bean phones (not all of them) and we are completely clueless. It can be repeated by taking a phone call, there is nothing (no exception or jni crash within our code) in logcat just:
03-07 13:07:33.506: I/WindowState(1660): WIN DEATH: Window{4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity paused=false}
03-07 13:07:33.506: W/InputDispatcher(1660): channel '4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
03-07 13:07:33.506: I/ActivityManager(1660): Process com.mapfactor.navigator (pid 3248) has died.
03-07 13:07:33.506: E/InputDispatcher(1660): channel '4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
03-07 13:07:33.506: W/InputDispatcher(1660): Attempted to unregister already unregistered input channel '4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity (server)'
03-07 13:07:33.506: W/WindowManager(1660): Force-removing child win Window{40f34610 SurfaceView paused=false} from container Window{4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity paused=false}
03-07 13:07:33.506: I/LocationManagerService(1660): remove gps (pid 1660), disabled
03-07 13:07:33.506: I/LocationManagerService(1660): remove network (pid 1660), next minTime = 86400000
03-07 13:07:33.506: W/GpsLocationProvider(1660): Unneeded remove listener for uid 1000
...
03-07 13:07:33.506: W/WindowManager(1660): Failed looking up window
03-07 13:07:33.506: W/WindowManager(1660): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy#40e2e780 does not exist
03-07 13:07:33.506: W/WindowManager(1660): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7675)
03-07 13:07:33.506: W/WindowManager(1660): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7666)
03-07 13:07:33.506: W/WindowManager(1660): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:854)
03-07 13:07:33.506: W/WindowManager(1660): at android.os.BinderProxy.sendDeathNotice(Binder.java:449)
03-07 13:07:33.506: W/WindowManager(1660): at dalvik.system.NativeStart.run(Native Method)
03-07 13:07:33.506: I/WindowState(1660): WIN DEATH: null
03-07 13:07:33.506: I/WindowManager(1660): WINDOW DIED Window{4115b0c0 com.mapfactor.navigator/com.mapfactor.navigator.map.MapActivity paused=false}
Just an idea: Have you disabled "Don't keep activities", "Destroy every activity as soon as the user leaves it" in your Settings > Developer Options screen?
OutOfMemory
Possible, but not likely looking at your logcat.
Just throwing this suggestion in the air: Based on the first line, are you not stopping consuming expensive resources like GPS? Are you doing something weird with your pause code?
IOError
So seems like an IOError (unsure why IOException wasn't raised instead) based on line 2 and line 5 here.

Background processes randomly dying while app is running on Samsung S3

I wrote an Android app which runs without problems on every phone I tried except Samsung S3. What happens is that, while my app is running, other background processes (other apps, that is) will start dying. For example, after some time of using my app, Live Wallpaper will die, and user will get a black background on his phone after exiting my app. And finally, after some time of using it, my app is also killed by OS. What's frustrating is that I cannot see any error message in log which would give me a hint as to what exactly is the problem.
This happens only on Samsung S3 (and not on S2, for example).
I thought it was memory related, since my app is very memory intensive (it is loading a lot of images from the web), but I can't see any "no memory" errors in log.
I also suspected that the HTTP framework I am using could be buggy, so I switched from Apache HttpComponents to java.net.HttpURLConnection, but it didn't help.
Any idea about why this is happening or a hint on how to debug it would be appreciated.
Here is an excerpt from the log which shows some background processes dying (for example, Live Wallpaper):
01-07 01:57:37.245: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:37.505: D/dalvikvm(29490): GC_FOR_ALLOC freed 1535K, 17% free 28032K/33735K, paused 71ms, total 71ms
01-07 01:57:37.580: D/dalvikvm(6718): WAIT_FOR_CONCURRENT_GC blocked 0ms
01-07 01:57:37.620: D/dalvikvm(6718): GC_EXPLICIT freed 91K, 9% free 17663K/19399K, paused 3ms+5ms, total 40ms
01-07 01:57:38.190: I/InputReader(2296): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.428 ]
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.190: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:38.335: I/InputReader(2296): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.335: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:38.750: D/dalvikvm(29490): GC_FOR_ALLOC freed 1688K, 18% free 27981K/33735K, paused 114ms, total 114ms
01-07 01:57:39.695: W/PowerManagerService(2296): Timer 0x3->0x3|0x0
01-07 01:57:39.700: D/PowerManagerService(2296): setTimeoutLocked::SmartSleep : after19500
01-07 01:57:39.930: I/InputReader(2296): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.429 ]
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:39.930: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x0
01-07 01:57:40.020: D/DeviceInfo(2296): SysScope Service has unexpectedly disconnected!
01-07 01:57:40.065: I/InputReader(2296): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=]
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
01-07 01:57:40.065: I/InputDispatcher(2296): Delivering touch to current input target: action: 0x1
**01-07 01:57:40.080: I/ActivityManager(2296): Process com.android.smspush (pid 28031) (adj 1) has died.**
01-07 01:57:40.090: W/WallpaperService(2296): Wallpaper service gone: ComponentInfo{com.sec.ccl.csp.app.secretwallpaper.themetwo/com.sec.ccl.csp.app.secretwallpaper.themetwo.SecretWallpaperService}
01-07 01:57:40.125: D/KeyguardViewMediator(2296): setHidden false
**01-07 01:57:40.135: I/ActivityManager(2296): Process com.android.server.device.enterprise:remote (pid 28016) (adj 1) has died.**
**01-07 01:57:40.145: I/ActivityManager(2296): Process com.sec.ccl.csp.app.secretwallpaper.themetwo (pid 29715) (adj 1) has died.**
01-07 01:57:40.285: D/dalvikvm(29490): GC_CONCURRENT freed 1616K, 17% free 28289K/33735K, paused 27ms+21ms, total 178ms
01-07 01:57:40.285: D/dalvikvm(29490): WAIT_FOR_CONCURRENT_GC blocked 112ms
01-07 01:57:40.445: D/dalvikvm(2296): GC_CONCURRENT freed 1869K, 59% free 24186K/57991K, paused 26ms+12ms, total 197ms
01-07 01:57:40.660: D/dalvikvm(29490): GC_CONCURRENT freed 1587K, 16% free 28622K/33735K, paused 3ms+7ms, total 51ms
01-07 01:57:40.685: D/KeyguardViewMediator(2296): setHidden false
There are 3 main reasons why a background process may be stoped, and I'll start from the less to the most probable:
You asked inadvertedly asked it to stop
Check your code for a bug that in awkward situations could request the service to stop. This could be within the service or in other activity from your application.
Uncaught exception
The service hit an uncaught exception. In this situation you should be able to see the information in the log, however the log don't last for long and you may be missing it.
To address this possibility you can set a DefaultUncaughtExceptionHandler like this:
UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
if (!(currentHandler instanceof DefaultExceptionHandler)) {
// Register default exceptions handler
Thread.setDefaultUncaughtExceptionHandler(
new DefaultExceptionHandler(currentHandler));
}
and define your DefaultExceptionHandler class to write to a temp file like this:
public class DefaultExceptionHandler implements UncaughtExceptionHandler {
private UncaughtExceptionHandler defaultExceptionHandler;
public DefaultExceptionHandler(UncaughtExceptionHandler pDefaultExceptionHandler)
{
defaultExceptionHandler = pDefaultExceptionHandler;
}
public void uncaughtException(Thread t, Throwable e) {
final Writer result = new StringWriter();
final PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
try {
String filename = "your_temp_filename";
BufferedWriter bw = new BufferedWriter(new FileWriter(filename));
bw.write(result.toString());
bw.flush();
bw.close();
} catch (Exception e2) {
e2.printStackTrace();
}
defaultExceptionHandler.uncaughtException(t, e);
}
}
Android OS asked the service to stop
Based on your description this is the most probable cause, and the one that you have less control over it.
There is no way to prevent the Android from killing your application when it needs aditional resources or when it believes your service is running for too long. The time allowed for the service to run before being killed may change from device to device, as it depends on resources allocated (i.e. images memory requirement change with screen size) and resources available.
In this case, the only reasonable thing you can do is starting you service as foreground service using:
startForeground(int id, Notification notification);
which informs the OS that your service has user visibility and will be put in the less probable to kill service's list. My experience using it with a few devices is that the service is kept running without interruption, even if you use several other applications in the mean time.
Regards.
I have tracked down the issue. It was actually a memory leak caused by Typeface.createFromAsset() method as described here. The memory that was leaking is native memory (not on Java heap), so that's why there were no OutOfMemory exceptions.
What is odd is that this issue should be fixed since Honeycomb (3.0), but in my case, it is happening on S3 which is running JellyBean (4.1). (I tried on several S3s, and they all have this issue). It would be interesting if someone with access to a different phone that runs JellyBean would test, so we could see if it reproduces there (the link I posted shows a simple way to reproduce it).

Android Testing - App works on one phone, but crashes on others

I created an app and it worked just fine on my phone, so I put it up on the market. My friend tried downloading it first, and it does not work on her phone. After the Splash Screen, it force closes.
I don't understand why this is happening. I was under the impression that the market only allowed users with the correct devices to download the app, so figured this wouldn't be an issue.
Has anyone had this happen? Also is there any way for me to test my app on all different phones to ensure that it will not crash again before re-posting it on the market?
**UPDATE - i had her run aLogCat and here is the result. It was too many characters, so I copied from the first E/
E/CameraService( 166): Invalid Burst Count setting burst count to 1
V/CameraHal( 166): camera_set_parameters
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:311 setParameters - White balance set auto
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:321 setParameters - Antibanding set auto
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:337 setParameters - Exposure compensation set 0
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:343 setParameters - Scene mode set auto
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:363 setParameters - Flash mode set on
D/CameraHalM( 166): Current battery Level, 3425000 uv
D/CameraHalM( 166): flashIntensity = 50
E/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:374 setParameters - Setting KEY_MOT_LEDFLASH--50
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:384 setParameters - Effect set none
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:402 setParameters - Jpeg quality set 90
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:409 setParameters - Thumbnail width set 160
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:416 setParameters - Thumbnail width set 120
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:423 setParameters - Thumbnail quality set 60
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:470 setParameters - Zoom set 0
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:483 setParameters - Auto Exposure Lock set false
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:492 setParameters - Auto WhiteBalance Lock set false
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:507 setParameters - Focus mode set auto
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHalM.cpp:124 setMotParameters - Checking Image Stabilization param, off
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHalM.cpp:144 setMotParameters - Disabling Image Stabilization capturing
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHalM.cpp:189 setMotParameters - Led Torch : 0
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHalM.cpp:289 setMotTcmdParametersIfNeeded - Checking Mot Test Mode param, off
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHalM.cpp:300 setMotTcmdParametersIfNeeded - Disabling Test Mode
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:566 setParameters - PreviewFormat set yuv420sp
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:578 setParameters - VNF true
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:596 setParameters - VSTAB false
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:617 setParameters - IPP mode set ldc-nsf
D/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:652 setParameters - Sensor Orientation is set to 0
E/CameraHal( 166): (12785a0) hardware/ti/omap4xxx/camera/CameraHal.cpp:662 setParameters - Invalid preview resolution 960 x 540
V/MotDrmPlugIn( 165): MotDrmPlugIn::onInitialize : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onSetOnInfoListener : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onOpenDecryptSession by fd : 11
D/ ( 165): filename = /system/media/audio/ui/camera_click.ogg
V/MotDrmPlugIn( 165): MotDrmPlugIn::onTerminate : 6579
V/MotDrmPlugIn( 165): MotDrmPlugIn::onInitialize : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onSetOnInfoListener : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onOpenDecryptSession by fd : 11
D/ ( 165): filename = /system/media/audio/ui/multishot_click.ogg
D/AndroidRuntime( 4594): Shutting down VM
W/dalvikvm( 4594): threadid=1: thread exiting with uncaught exception (group=0x40ac7210)
V/MotDrmPlugIn( 165): MotDrmPlugIn::onTerminate : 6579
V/MotDrmPlugIn( 165): MotDrmPlugIn::onInitialize : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onSetOnInfoListener : 6579
D/MotDrmPlugIn( 165): MotDrmPlugIn::onOpenDecryptSession by fd : 11
D/ ( 165): filename = /system/media/audio/ui/VideoRecord.ogg
I/OMXCodec( 166): isAudio=1, mMIME=audio/vorbis
V/MotDrmPlugIn( 165): MotDrmPlugIn::onTerminate : 6579
E/AndroidRuntime( 4594): FATAL EXCEPTION: main
E/AndroidRuntime( 4594): java.lang.RuntimeException: setParameters failed
E/AndroidRuntime( 4594): at android.hardware.Camera.native_setParameters(Native Method)
E/AndroidRuntime( 4594): at android.hardware.Camera.setParameters(Camera.java:1414)
E/AndroidRuntime( 4594): at sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity.surfaceChanged(ShakeItLikeAPolaroidActivity.java:425)
E/AndroidRuntime( 4594): at android.view.SurfaceView.updateWindow(SurfaceView.java:544)
E/AndroidRuntime( 4594): at android.view.SurfaceView.access$000(SurfaceView.java:81)
E/AndroidRuntime( 4594): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
E/AndroidRuntime( 4594): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590)
E/AndroidRuntime( 4594): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1662)
E/AndroidRuntime( 4594): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2558)
E/AndroidRuntime( 4594): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4594): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4594): at android.app.ActivityThread.main(ActivityThread.java:4697)
E/AndroidRuntime( 4594): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4594): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4594): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
E/AndroidRuntime( 4594): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
E/AndroidRuntime( 4594): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 375): Force finishing activity sillyfidget.com.shakeitpolaroid/.ShakeItLikeAPolaroidActivity
I/OMXCodec( 166): isAudio=1, mMIME=audio/vorbis
I/OMXCodec( 166): isAudio=1, mMIME=audio/vorbis
I/AudioPlayer( 166): read from audio source returned: -1011
I/AudioPlayer( 166): read from audio source returned: -1011
I/AudioPlayer( 166): read from audio source returned: -1011
W/ApplicationContext( 375): Unable to create files directory files
D/ExtDispService( 667): onRotationChanged - rotation = 0
D/ExtDispService( 667): onRotationChanged! - PORTRAIT!!!
D/IExtDispIpcCB( 163): BnExtDispIpcCB NOTIFYCB: type:101; ext1:1; ext2:0;
D/HWC_HDMI_MOT( 163): IpcCB notifyCallback: type:101; ext1:1; ext2:0;
D/HWC_HDMI_MOT( 163): IpcCB notifyCallback: UI Orientation state change - rotation = 0
D/ti_hwc ( 163): hdmi_callback: UI Rotation = 0
I/InputReader( 375): Reconfiguring input devices. changes=0x00000004
I/InputReader( 375): Device reconfigured: id=2, name='atmxt-i2c', surface size is now 540x960, mode is 1
I/ActivityManager( 375): Config changed: {1.0 311mcc480mnc en_US layoutdir=0 sw360dp w360dp h614dp nrml long port finger -keyb/v/h -nav/h s.6}
D/Swype ( 703): checkEditorShowsCompletions(): shows: false
I/PortalService( 817): onConfigurationChanged
D/OpenGLRenderer( 498): Flushing caches (mode 0)
V/RecentsPanelView( 498): onVisibilityChanged(com.android.systemui.recent.RecentsPanelView#41c57358, 8)
I/SystemUIService( 498): onConfigurationChanged reached.
I/SystemUIService( 498): isLayoutXLarge = false
D/EvbridgeService( 817): handleIntent() android.intent.action.CONFIGURATION_CHANGED handled by com.android.portal.EvbridgeService#413f4738
D/RecentsPanelView( 498): panelHeight=0
D/StatusBar.NetworkController( 498): Intent.ACTION_CONFIGURATION_CHANGED Received
D/ConnectivityService( 375): getMobileDataEnabled returning true
D/ConnectivityService( 375): getMobileDataEnabled returning true
D/OpenGLRenderer( 874): Flushing caches (mode 0)
D/OpenGLRenderer( 874): Flushing caches (mode 1)
D/Launcher.Model( 874): onReceive intent=Intent { act=android.intent.action.CONFIGURATION_CHANGED flg=0x60000010 }
W/ActivityManager( 375): Activity pause timeout for ActivityRecord{414bfdd8 sillyfidget.com.shakeitpolaroid/.ShakeItLikeAPolaroidActivity}
D/Launcher.Model( 874): onReceive intent=Intent { act=android.intent.action.CONFIGURATION_CHANGED flg=0x60000010 }
W/InputManagerService( 375): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#41af34d0
W/Launcher( 874): localizable app group not found: Verizon Wireless
W/Launcher( 874): localizable app group not found: Verizon Wireless
W/Launcher( 874): localizable app group not found: Verizon Wireless
W/Launcher( 874): localizable app group not found: Verizon Wireless
I/ActivityManager( 375): No longer want com.google.android.talk (pid 4266): hidden #21
I/AlarmManager( 375): sending alarm Alarm{41ae30a0 type 2 com.android.phone}, PendingIntent{41b402e8: PendingIntentRecord{41d51cb8 com.android.phone broadcastIntent}}
V/AlarmManager( 375): sending alarm OnFinished PendingIntent{41b402e8: PendingIntentRecord{41d51cb8 com.android.phone broadcastIntent}}
D/AudioHardwareMot( 166): AudioStreamOutMot::standby called for 0x129c140
D/AudioHardwareMot( 166): Changed Min CPU Frequency to 300000 KHz
D/AudioHardwareMot( 166): Output 0x129c140 standby complete
D/dalvikvm( 375): GC_EXPLICIT freed 445K, 33% free 17236K/25635K, paused 9ms+7ms
I/Process ( 4594): Sending signal. PID: 4594 SIG: 9
W/InputManagerService( 375): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#420a4e80
W/InputDispatcher( 375): channel '420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
E/InputDispatcher( 375): channel '420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 375): Attempted to unregister already unregistered input channel '420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity (server)'
W/AudioFlinger( 166): session id 16 not found for pid 166
I/ActivityManager( 375): Process sillyfidget.com.shakeitpolaroid (pid 4594) has died.
I/WindowManager( 375): WIN DEATH: Window{419c0168 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.SplashScreen paused=false}
I/WindowManager( 375): WIN DEATH: Window{420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity paused=false}
W/WindowManager( 375): Force-removing child win Window{417dc440 SurfaceView paused=false} from container Window{420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity paused=false}
V/CameraHal( 166): camera_disable_msg_type
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/CameraHal.cpp:225 disableMsgType - Disabling Preview Callback
V/CameraHal( 166): camera_stop_preview
V/CameraHal( 166): camera_cancel_picture
E/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/BaseCameraAdapter.cpp:1791 setState - Adapter state switch INTIALIZED_STATE Invalid Op! event = 0x5
V/CameraHal( 166): camera_release
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/SensorListener.cpp:223 disableSensor - orientation = 0x12e1518 (LIS3DH 3-axis Accelerometer)
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/SensorListener.cpp:108 ~SensorListener - Kill looper thread
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/SensorListener.cpp:120 ~SensorListener - Kill looper
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/SensorListener.cpp:126 ~SensorListener - SensorListener destroyed
I/CameraService( 166): Destroying camera 0
V/CameraHal( 166): camera_device_close
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:1797 stop - --> AppCallbackNotifier NOTIFIER_STOPPED
D/CameraHal( 166): (12e35b8) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:287 notificationThread - Notification Thread received message from Camera HAL
D/CameraHal( 166): (12e35b8) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:1236 processMessage - +Msg get...
D/CameraHal( 166): (12e35b8) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:1238 processMessage - -Msg get...
I/CameraHal( 166): Received NOTIFIER_EXIT command from Camera HAL
D/CameraHal( 166): (12e35b8) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:290 notificationThread - Notification Thread exiting.
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:1301 ~AppCallbackNotifier - Stopping Event Provider
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/AppCallbackNotifier.cpp:1309 ~AppCallbackNotifier - Stopping Frame Provider
D/CameraHal( 166): (12ca020) hardware/ti/omap4xxx/camera/OMXCameraAdapter/OMXCameraAdapter.cpp:1389 switchToLoaded - Already in OMX_Loaded state or OMX_StateInvalid state
W/WindowManager( 375): Failed looking up window
W/WindowManager( 375): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy#41af7900 does not exist
W/WindowManager( 375): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7606)
W/WindowManager( 375): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7597)
W/WindowManager( 375): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1579)
W/WindowManager( 375): at android.os.BinderProxy.sendDeathNotice(Binder.java:433)
W/WindowManager( 375): at dalvik.system.NativeStart.run(Native Method)
I/WindowManager( 375): WIN DEATH: null
I/WindowManager( 375): WINDOW DIED Window{420f92e8 sillyfidget.com.shakeitpolaroid/sillyfidget.com.shakeitpolaroid.ShakeItLikeAPolaroidActivity paused=false}
D/CameraHal( 166): (12d76d0) hardware/ti/omap4xxx/camera/OMXCameraAdapter/OMXCameraAdapter.cpp:3571 Handler - msg.command = -1
D/CameraHal( 166): (12d76d0) hardware/ti/omap4xxx/camera/OMXCameraAdapter/OMXCameraAdapter.cpp:3585 Handler - Exiting command handler
D/CameraHal( 166): (12d2c40) hardware/ti/omap4xxx/camera/OMXCameraAdapter/OMXCameraAdapter.cpp:3628 Handler - Exiting OMX callback handler
I/AlarmManager( 375): sending alarm Alarm{41b2e7d8 type 3 android}, PendingIntent{42116fc0: PendingIntentRecord{421063c0 android broadcastIntent}}
V/AlarmManager( 375): sending alarm OnFinished PendingIntent{42116fc0: PendingIntentRecord{421063c0 android broadcastIntent}}
D/PortalService( 817): Portal onReceive:
I/PortalService( 817): onHandleIntent() action android.intent.action.CLOSE_SYSTEM_DIALOGS
I/ActivityManager( 375): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.motorola.blur.home/.Launcher} from pid 375
I/ActivityManager( 375): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.jtb.alogcat cmp=org.jtb.alogcat/.LogActivity bnds=[8,65][137,245]} from pid 874
D/OpenGLRenderer( 874): Flushing caches (mode 1)
D/Swype ( 703): checkEditorShowsCompletions(): shows: false
I/ActivityManager( 375): Resumed Activity: org.jtb.alogcat/.LogActivity totalTime: 91 ms
W/IInputConnectionWrapper( 874): showStatusIcon on inactive InputConnection
D/OpenGLRenderer( 874): Flushing caches (mode 0)
D/dalvikvm( 4564): GC_CONCURRENT freed 666K, 5% free 11986K/12579K, paused 1ms+17ms
D/Swype ( 703): checkEditorShowsCompletions(): shows: false
W/ActivityManager( 375): Activity destroy timeout for ActivityRecord{414930d8 sillyfidget.com.shakeitpolaroid/.SplashScreen}
W/ActivityManager( 375): Activity destroy timeout for ActivityRecord{414bfdd8 sillyfidget.com.shakeitpolaroid/.ShakeItLikeAPolaroidActivity}
The problem is that you're passing invalid parameters in Camera.setParameters, not all cameras support the same features so you should be querying the camera for it's capabilities before calling that method. However if I were you I'd maybe start a bit smaller because it appears that you are a little over your head here. At the very least you should know how to recognize relevant log info and debug basic problems like this.
FYI: http://developer.android.com/reference/android/hardware/Camera.Parameters.html
May be your friend mobile android level is different with your mobile android level.
Some times the app does not work in all Android phones. If you want to check it you must follow these steps
1) Change your app target in manifest as minsdkversion 8 and target sdk version 15.
2) test your app in all emulators.
3) test each module (working of each activity) in all emulators.
You will definitely find some errors if you do like this. Good luck

how to create a voice reminder in android

i am trying to make a voice reminder which take a text to be remembered and on the time the application convert the text to say it in voice i did the code of the reminder and i create another class extend broad cast receiver and did the code to the reminder to fire in time but it run when i make it show a toast but when i write the code of the speech in the receiver to fire in the time set but it gives me " the application force to close" could you please answer me i wrote this in the onreceive but it doesn't work
public class ReadyToSpeak extends BroadcastReceiver
{
VoiceAlert voicealert= new VoiceAlert();
#Override
public void onReceive(Context context, Intent intent){
// TODO Auto-generated method stub
Intent scheduledIntent = new Intent(context,VoiceAlert.class);
scheduledIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(scheduledIntent);
Toast.makeText(context, "onresive", Toast.LENGTH_LONG).show();
// voicealert.speak();
voicealert.txs.speak("Hello", TextToSpeech.QUEUE_FLUSH, null);
}
}
I did the code all over again and didn't work and that is what appear in the logcat
10-27 10:23:06.920: WARN/KeyCharacterMap(127): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:12.671: WARN/KeyCharacterMap(119): No keyboard for id 0
10-27 10:23:12.671: WARN/KeyCharacterMap(119): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:14.081: DEBUG/dalvikvm(127): GC_EXPLICIT freed 2068 objects / 132776 bytes in 77ms
10-27 10:23:33.990: INFO/ActivityManager(58): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.anddev.android.speechreminder/.ReminderActivity }
10-27 10:23:34.470: INFO/ActivityManager(58): Starting activity: Intent { act=android.speech.tts.engine.CHECK_TTS_DATA cmp=com.svox.pico/.CheckVoiceData }
10-27 10:23:34.710: INFO/ActivityManager(58): Displayed activity org.anddev.android.speechreminder/.ReminderActivity: 577 ms (total 577 ms)
10-27 10:23:34.720: WARN/KeyCharacterMap(313): No keyboard for id 0
10-27 10:23:34.720: WARN/KeyCharacterMap(313): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:23:34.780: VERBOSE/TtsService(319): TtsService.onCreate()
10-27 10:23:34.830: VERBOSE/TtsService(319): About to load /system/lib/libttspico.so, applyFilter=true
10-27 10:23:34.910: VERBOSE/TtsService(319): TtsService.setLanguage(eng, USA, )
10-27 10:23:35.120: INFO/ActivityManager(58): Process com.android.alarmclock (pid 170) has died.
10-27 10:23:35.141: INFO/SVOX Pico Engine(319): loaded en-US successfully
10-27 10:23:35.141: INFO/SynthProxy(319): setting speech rate to 100
10-27 10:23:44.870: DEBUG/dalvikvm(296): GC_EXPLICIT freed 1918 objects / 108296 bytes in 159ms
10-27 10:23:49.990: WARN/KeyCharacterMap(114): No keyboard for id 0
10-27 10:23:50.001: WARN/KeyCharacterMap(114): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-27 10:24:18.050: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#44fe6228
10-27 10:24:20.550: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol
Taghrid, It looks like you're getting a Stackoverflow error. This indicates that somewhere in your code you have Infinite recursion. It looks like it's VoiceAlert and ReadyToSpeak functions that keep calling one another. Are you sure the package your using, org.androiddev.android.test is of good quality? Are you using a release version of it?

Categories

Resources