android-anr-dialog

How to recursively scan directories in Android

痴心易碎 提交于 2019-12-18 06:58:03
问题 How can I recursively scan directories in Android and display file name(s)? I'm trying to scan, but it's slow (force close or wait). I'm using the FileWalker class given in a separate answer to this question. 回答1: You should almost always access the file system only from a non-UI thread. Otherwise you risk blocking the UI thread for long periods and getting an ANR. Run the FileWalker in an AsyncTask 's doInBackground() . This is a slightly optimized version of FileWalker: public class

Is “ANR” an exception or an error or what?

末鹿安然 提交于 2019-12-18 04:29:17
问题 Is the ANR an exception, an error or what? Can we actually catch it in a try{} catch(){} structure? 回答1: ANR (Application Not Responding) is not exactly an error. It is shown when your application is very sluggish and takes a lot of time to respond, thus making the user wait. The user won't appreciate if your application makes them wait for a long time. So, the Android framework gives the user an option of closing your application. http://developer.android.com/guide/practices/design

How to resolve the ANR error while invoking the Camera?

我只是一个虾纸丫 提交于 2019-12-17 21:06:16
问题 I have two button's in the main menu. I invoking the camera when I press the 1st button. Here I didn't get any issue. Camera working properly. After taking the picture, I come back in to main menu and again I press the 1st button. Here I got the issue. Camera invoking properly. But I got ANR error (Reason: keyDispatchingTimedOut) while i'm taking the picture. How to resolve this issue? Edit:: I'm using following code, Button Listener , Button imageButton = (Button) findViewById(R.id.button1);

Android LogCat shows BufferQueueProcedure

泄露秘密 提交于 2019-12-14 02:38:10
问题 At first please excuse my bad English. I have a final version of my App (school work) - it is taking photos and after that photos are being stitched using c++ code. I tested the app on my phone Xperia mini API 15 where everything is OK on this device. But I borrowed school Nexus 5 API 21 and there are two problems. First problem is frustrating. Today, I was debugging all day without solution. I have no idea, which part of code can make this error. Whenever the app is running - don't matter if

Android app not responding (ANR)

房东的猫 提交于 2019-12-14 00:28:05
问题 I have an android app, which listens to a socket from the server and retrieves data in json format and save data in the database. Resource cursor adapter is used to display the data in a list. When the app is idle for 10 minutes or more, it is not reponding. Any solutions? 回答1: ANR occurs when the main thread is blocked for a few time. Specifically, 5 seconds in an Activity, 10 seconds in a BroadcastReceiver and 20 seconds in a Service. So, to avoid ANR , you need to ensure that you don't do

Need help reading the stack traces

走远了吗. 提交于 2019-12-13 18:30:54
问题 I'm getting these stack traces when running my app which crash. I get that it has to do something with "ANR keyDispatchingTimedOut". I'm new in Android development and I need some helping reading the traces. DALVIK THREADS: "main" prio=5 tid=1 NATIVE | group="main" sCount=1 dsCount=0 s=N obj=0x40028ae0 self=0xcd58 | sysTid=7787 nice=0 sched=0/0 cgrp=default handle=-1345021904 | schedstat=( 12266998315 6628478984 2116 ) at android.database.sqlite.SQLiteQuery.native_fill_window(Native Method)

Application isn't responding - Delphi XE6 - Android

六眼飞鱼酱① 提交于 2019-12-13 16:32:43
问题 On Android, when I touch the screen during a long function (required time > 30 sec) 15sec after the click, a message "Application isn't responding" appears. I don't want to see it. I did a test project, with 2 buttons and a function "LongProcess" for simulate a long process (it's just a sleep of 30 sec). My first button "LaunchFunction" just call the function. My second button "LaunchThread", launch a Thread who will execute my "LongProcess". In the first case I have my problem but in the

Using StrictMode in app production phase

回眸只為那壹抹淺笑 提交于 2019-12-11 20:33:02
问题 I know that StrictMode designed mainly to be used in application development phase, but according to my app needs, it's not acceptable to get ANR while it's quite acceptable to get crash, and StrictMode provides a way to prevent ANR dialogs: StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll() .penaltyLog().penaltyDeath().build()); what if I used it inside the app production phase? and what will happen when the app getting ANR while StrictMode used? will it freeze, crash, or

Android onStop times out despite doing no work

十年热恋 提交于 2019-12-11 17:24:29
问题 I'm having trouble with an app crashing when returning to the activity. If I navigate away with the home button the phone (or emulator) onPause, onSaveInstanceState, and onStop are all called as per the lifecycle: 05-05 14:12:20.790 2043-2043/? I/myview: onPause was run 05-05 14:12:20.790 2043-2043/? I/myview: onSaveInstanceState was run 05-05 14:12:20.790 2043-2043/? I/myview: onStop was run Code in the activity: @Override protected void onPause(){ super.onPause(); Log.i("myview", "onPause

Interpreting an ANR stack trace

核能气质少年 提交于 2019-12-11 04:28:34
问题 I'm working with an implementation of an MQTT client from the PAHO library in Android. Sometimes, the application locks up when it tried to publish a message (I think) and I can't figure out what's going on. I also apologize in advance for the all to long post. I really don't know what the important bits are and the SO "spoiler" tag >! wouldn't work to hide the details. The MQTT client is working in a separate thread but I'm calling the mqtt client instance from the UI thread. Perhaps this