Форум программистов, компьютерный форум CyberForum.ru

Потоки и AlertDialog - Android

Восстановить пароль Регистрация
Другие темы раздела
Android БД или xml http://www.cyberforum.ru/android-dev/thread899856.html
вообщем у меня есть маленькая игра, которая работает по такому принципу. Когда загружается первое активити, динамически создается xml с данными, потом уже во время игры используется. Так как мне нужно научиться работать с SQLite решил создать базу. Создал базу, но почему-то программа начала работать два раза медленнее. И я нашел почему так происходит. Каждый раз когда запускается новое активити,...
Android Парсинг XML Пробую так String data = getIntent().getStringExtra("data"); try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(data); NodeList nodes = doc.getElementsByTagName("userInfo"); Element element = (Element) nodes.item(0); NodeList... http://www.cyberforum.ru/android-dev/thread899458.html
Android Оптимизация кода
Глупый и очень обширный вопрос, но как оптимизировать код? У меня есть приложение, которое занимает озу телефона около 30 Мб, приложение, в котором одна активити с картой, на неё при запуске наносятся маркеты, данные о маркерах берутся из базы в интернете, на карте есть три кнопки. Размер установленного приложения 3 Мб. Меня смущает, что это не игра, а столько памяти берёт. Клики на кнопки...
Выгрузка в excel Android
Здравствуйте. Заинтересовался темой выгрузки информации в excel файл. То есть создание файла, наполнение нужными листами и данными в ячейках. Нашел инфу про библиотеку JExcelAPI for Android. Даже есть инструкция по этой теме (http://www.kylebeal.com/2011/10/using-jexcelapi-in-an-android-app/). Но завис на этапе создания листов книги. То есть файл создается, а листы в нем уже нет. Может кто...
Android Как программно взять диагональ экрана андроид устройства? http://www.cyberforum.ru/android-dev/thread899074.html
Помогите, пожалуйста, определить к какому drawable (mdpi, hdpi, xdpi...) относится используемый аппарат, естественно кодом.
Android Изменение Title Bar Не нашел в интернете хорошего мануала, как можно изменить внешний вид стандартного title bar в приложении. Например сделать его другого цвета, изменять надпись при необходимости, убрать иконку приложения. Подскажите.. подробнее

Показать сообщение отдельно
osin_pa
0 / 0 / 0
Регистрация: 13.06.2013
Сообщений: 12
13.06.2013, 13:15  [ТС]     Потоки и AlertDialog
Java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
06-13 08:03:01.334: DEBUG/AndroidRuntime(2438): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-13 08:03:01.334: DEBUG/AndroidRuntime(2438): CheckJNI is ON
06-13 08:03:01.373: DEBUG/dalvikvm(2438): Trying to load lib libjavacore.so 0x0
06-13 08:03:01.384: DEBUG/dalvikvm(2438): Added shared lib libjavacore.so 0x0
06-13 08:03:01.414: DEBUG/dalvikvm(2438): Trying to load lib libnativehelper.so 0x0
06-13 08:03:01.414: DEBUG/dalvikvm(2438): Added shared lib libnativehelper.so 0x0
06-13 08:03:02.334: DEBUG/AndroidRuntime(2438): Calling main entry com.android.commands.pm.Pm
06-13 08:03:02.384: WARN/ActivityManager(304): No content provider found for permission revoke: file:///data/local/tmp/com.example.TheCourse
06-13 08:03:03.074: WARN/ActivityManager(304): No content provider found for permission revoke: file:///data/local/tmp/com.example.TheCourse
06-13 08:03:03.074: INFO/PackageManager(304): Copying native libraries to /data/app-lib/vmdl-573635470
06-13 08:03:03.514: DEBUG/dalvikvm(304): GC_CONCURRENT freed 720K, 55% free 5931K/13032K, paused 72ms+75ms, total 245ms
06-13 08:03:03.667: INFO/PackageManager(304): Removing non-system package:com.example.TheCourse
06-13 08:03:03.667: INFO/ActivityManager(304): Force stopping package com.example.TheCourse appid=10046 user=-1
06-13 08:03:03.954: DEBUG/dalvikvm(304): GC_CONCURRENT freed 792K, 55% free 5903K/13032K, paused 78ms+12ms, total 196ms
06-13 08:03:04.064: INFO/PackageManager(304): Package com.example.TheCourse codePath changed from /data/app/com.example.TheCourse-2.apk to /data/app/com.example.TheCourse-1.apk; Retaining data and using new
06-13 08:03:04.079: INFO/PackageManager(304): Running dexopt on: com.example.TheCourse
06-13 08:03:04.414: DEBUG/dalvikvm(2449): DexOpt: load 45ms, verify+opt 192ms, 323868 bytes
06-13 08:03:04.464: INFO/ActivityManager(304): Force stopping package com.example.TheCourse appid=10046 user=-1
06-13 08:03:04.464: WARN/PackageManager(304): Code path for pkg : com.example.TheCourse changing from /data/app/com.example.TheCourse-2.apk to /data/app/com.example.TheCourse-1.apk
06-13 08:03:04.464: WARN/PackageManager(304): Resource path for pkg : com.example.TheCourse changing from /data/app/com.example.TheCourse-2.apk to /data/app/com.example.TheCourse-1.apk
06-13 08:03:04.614: DEBUG/PackageManager(304): New package installed in /data/app/com.example.TheCourse-1.apk
06-13 08:03:04.904: INFO/ActivityManager(304): Force stopping package com.example.TheCourse appid=10046 user=0
06-13 08:03:05.064: DEBUG/dalvikvm(575): GC_EXPLICIT freed 870K, 63% free 6382K/17208K, paused 5ms+16ms, total 146ms
06-13 08:03:05.204: INFO/InputReader(304): Reconfiguring input devices.  changes=0x00000010
06-13 08:03:05.234: WARN/ContextImpl(1583): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1352 android.content.ContextWrapper.startService:450 android.content.ContextWrapper.startService:450 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2376
06-13 08:03:05.334: DEBUG/dalvikvm(1596): GC_EXPLICIT freed 131K, 14% free 2705K/3136K, paused 4ms+5ms, total 368ms
06-13 08:03:05.525: INFO/InputReader(304): Reconfiguring input devices.  changes=0x00000010
06-13 08:03:05.634: WARN/InputMethodManagerService(304): Found no subtypes in a system IME: com.android.inputmethod.pinyin
06-13 08:03:06.874: DEBUG/dalvikvm(304): GC_EXPLICIT freed 987K, 57% free 5723K/13032K, paused 74ms+60ms, total 480ms
06-13 08:03:06.994: DEBUG/AndroidRuntime(2438): Shutting down VM
06-13 08:03:07.014: DEBUG/dalvikvm(2438): GC_CONCURRENT freed 94K, 18% free 467K/564K, paused 1ms+1ms, total 12ms
06-13 08:03:07.014: DEBUG/jdwp(2438): Got wake-up signal, bailing out of select
06-13 08:03:07.014: DEBUG/dalvikvm(2438): Debugger has detached; object registry had 1 entries
06-13 08:03:07.424: WARN/RecognitionManagerService(304): no available voice recognition services found for user 0
06-13 08:03:07.804: DEBUG/AndroidRuntime(2454): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-13 08:03:07.804: DEBUG/AndroidRuntime(2454): CheckJNI is ON
06-13 08:03:07.844: DEBUG/dalvikvm(2454): Trying to load lib libjavacore.so 0x0
06-13 08:03:07.854: DEBUG/dalvikvm(2454): Added shared lib libjavacore.so 0x0
06-13 08:03:07.884: DEBUG/dalvikvm(2454): Trying to load lib libnativehelper.so 0x0
06-13 08:03:07.884: DEBUG/dalvikvm(2454): Added shared lib libnativehelper.so 0x0
06-13 08:03:08.694: DEBUG/AndroidRuntime(2454): Calling main entry com.android.commands.am.Am
06-13 08:03:08.704: DEBUG/dalvikvm(2454): Note: class Landroid/app/ActivityManagerNative; has 157 unimplemented (abstract) methods
06-13 08:03:08.724: INFO/ActivityManager(304): START u0 {flg=0x10000000 cmp=com.example.TheCourse/.FileManager} from pid 2454
06-13 08:03:08.744: WARN/WindowManager(304): Failure taking screenshot for (246x410) to layer 21005
06-13 08:03:08.784: DEBUG/dalvikvm(2465): Not late-enabling CheckJNI (already on)
06-13 08:03:08.820: INFO/ActivityManager(304): Start proc com.example.TheCourse for activity com.example.TheCourse/.FileManager: pid=2465 uid=10046 gids={50046, 1015, 1028}
06-13 08:03:08.824: DEBUG/AndroidRuntime(2454): Shutting down VM
06-13 08:03:08.834: DEBUG/dalvikvm(2454): GC_CONCURRENT freed 94K, 17% free 499K/596K, paused 2ms+1ms, total 13ms
06-13 08:03:08.834: DEBUG/jdwp(2454): Got wake-up signal, bailing out of select
06-13 08:03:08.834: DEBUG/dalvikvm(2454): Debugger has detached; object registry had 1 entries
06-13 08:03:08.944: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:09.144: INFO/dalvikvm(2465): Turning on JNI app bug workarounds for target SDK version 10...
06-13 08:03:09.344: ERROR/Trace(2465): error opening trace file: No such file or directory (2)
06-13 08:03:09.954: DEBUG/dalvikvm(2465): GC_FOR_ALLOC freed 55K, 7% free 2489K/2668K, paused 154ms, total 156ms
06-13 08:03:09.965: INFO/dalvikvm-heap(2465): Grow heap (frag case) to 3.152MB for 635812-byte allocation
06-13 08:03:10.014: DEBUG/dalvikvm(2465): GC_FOR_ALLOC freed 1K, 6% free 3109K/3292K, paused 43ms, total 43ms
06-13 08:03:10.064: DEBUG/dalvikvm(2465): GC_CONCURRENT freed <1K, 6% free 3117K/3292K, paused 7ms+11ms, total 53ms
06-13 08:03:10.404: VERBOSE/PhoneStatusBar(443): setLightsOn(true)
06-13 08:03:10.444: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:10.464: INFO/Choreographer(2465): Skipped 59 frames!  The application may be doing too much work on its main thread.
06-13 08:03:10.474: DEBUG/gralloc_goldfish(2465): Emulator without GPU emulation detected.
06-13 08:03:10.574: INFO/ActivityManager(304): Displayed com.example.TheCourse/.FileManager: +1s803ms
06-13 08:03:11.034: DEBUG/ExchangeService(815): Received deviceId from Email app: null
06-13 08:03:11.034: DEBUG/ExchangeService(815): !!! deviceId unknown; stopping self and retrying
06-13 08:03:12.434: INFO/Choreographer(2465): Skipped 51 frames!  The application may be doing too much work on its main thread.
06-13 08:03:14.544: DEBUG/dalvikvm(2465): GC_CONCURRENT freed 193K, 9% free 3337K/3636K, paused 70ms+5ms, total 125ms
06-13 08:03:14.844: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:14.905: INFO/Choreographer(2465): Skipped 52 frames!  The application may be doing too much work on its main thread.
06-13 08:03:16.074: DEBUG/ExchangeService(815): !!! EAS ExchangeService, onCreate
06-13 08:03:16.074: DEBUG/ExchangeService(815): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
06-13 08:03:16.083: WARN/ActivityManager(304): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
06-13 08:03:16.083: DEBUG/ExchangeService(815): !!! Email application not found; stopping self
06-13 08:03:16.094: WARN/ActivityManager(304): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
06-13 08:03:16.104: DEBUG/ExchangeService(815): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
06-13 08:03:16.194: ERROR/ActivityThread(815): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ceab10 that was originally bound here
        android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ceab10 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
        at android.app.ContextImpl.bindService(ContextImpl.java:1418)
        at android.app.ContextImpl.bindService(ContextImpl.java:1407)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
        at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
        at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
06-13 08:03:16.294: INFO/Choreographer(2465): Skipped 57 frames!  The application may be doing too much work on its main thread.
06-13 08:03:16.324: WARN/dalvikvm(2465): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
06-13 08:03:16.376: DEBUG/dalvikvm(2465): GC_CONCURRENT freed 34K, 5% free 3708K/3864K, paused 11ms+40ms, total 133ms
06-13 08:03:16.394: ERROR/AndroidRuntime(2465): FATAL EXCEPTION: Thread-129
        java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
        at android.os.Handler.<init>(Handler.java:197)
        at android.os.Handler.<init>(Handler.java:111)
        at android.app.Dialog.<init>(Dialog.java:107)
        at android.app.AlertDialog.<init>(AlertDialog.java:114)
        at android.app.AlertDialog$Builder.create(AlertDialog.java:931)
        at android.app.AlertDialog$Builder.show(AlertDialog.java:950)
        at com.example.TheCourse.FileManager$11.run(FileManager.java:672)
        at java.lang.Thread.run(Thread.java:856)
06-13 08:03:16.454: WARN/ActivityManager(304): Force finishing activity com.example.TheCourse/.FileManager
06-13 08:03:16.454: WARN/WindowManager(304): Failure taking screenshot for (246x410) to layer 21020
06-13 08:03:16.484: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:16.564: INFO/Choreographer(2465): Skipped 44 frames!  The application may be doing too much work on its main thread.
06-13 08:03:16.794: ERROR/StrictMode(815): null
        android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ceab10 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
        at android.app.ContextImpl.bindService(ContextImpl.java:1418)
        at android.app.ContextImpl.bindService(ContextImpl.java:1407)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
        at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
        at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
06-13 08:03:16.905: WARN/ActivityManager(304): Unbind failed: could not find connection for android.os.BinderProxy@415bd660
06-13 08:03:16.944: INFO/Choreographer(2465): Skipped 66 frames!  The application may be doing too much work on its main thread.
06-13 08:03:17.025: INFO/Choreographer(575): Skipped 44 frames!  The application may be doing too much work on its main thread.
06-13 08:03:17.034: ERROR/ActivityThread(815): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf8250 that was originally bound here
        android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf8250 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
        at android.app.ContextImpl.bindService(ContextImpl.java:1418)
        at android.app.ContextImpl.bindService(ContextImpl.java:1407)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
        at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
        at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
        at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
06-13 08:03:17.054: INFO/Choreographer(304): Skipped 43 frames!  The application may be doing too much work on its main thread.
06-13 08:03:17.064: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:17.194: ERROR/SurfaceFlinger(37): ro.sf.lcd_density must be defined as a build property
06-13 08:03:17.984: ERROR/StrictMode(815): null
        android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cf8250 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
        at android.app.ContextImpl.bindService(ContextImpl.java:1418)
        at android.app.ContextImpl.bindService(ContextImpl.java:1407)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
        at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
        at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
        at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
        at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
        at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
06-13 08:03:18.134: WARN/ActivityManager(304): Unbind failed: could not find connection for android.os.BinderProxy@413b15a8
06-13 08:03:18.273: DEBUG/dalvikvm(815): GC_CONCURRENT freed 439K, 20% free 2491K/3076K, paused 112ms+594ms, total 1674ms
06-13 08:03:18.863: INFO/Process(2465): Sending signal. PID: 2465 SIG: 9
06-13 08:03:19.023: INFO/ActivityManager(304): Process com.example.TheCourse (pid 2465) has died.
Добавлено через 5 минут
Последнии записи.

Добавлено через 16 минут
Если убрать:

new AlertDialog.Builder(FileManager.this) //здесь программа падает
.setView(txt)
.setPositiveButton(R.string.Ok, null)
.show();

то все нормально работает, как только я в второстепенном потоке пытаюсь что-нибудь вызвать - падает. Не понимаю в чем дело.
 
Текущее время: 18:32. Часовой пояс GMT +3.
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru