[APP] CalendarCG.apk problem + Phone Apk building problem - Android Q&A, Help & Troubleshooting

Dear all,
i'm Fabrizio from Italy and i'm happy to be a new members of the forum.
I hope that this is a correct section :
I've two big problems with my android phone:
FIRST PROBLEM -CALENDARCG.APK If the phone is setting in english language , i can open the calendar, i can insert new event, i can edit event.
If i shift the phone in another language setting ( italian,french,german or other) i can open the calendar, but when i try to insert a new event,
i receive follow alert : "The application Calendar (process.com.android.calendar) has stopped unexpectedly. Please try again." - and asked to force close.
I tried to reset the phone, hard rest the hone, clear data but nothing..always same problem.
Please can you help me to solve these problem?? Have i to modify the AndroidManifest or what?
SECOND PROBLEM - PHONE.APK SOLVED
I decompiled Phone.apk( i've android 4.0.4 - multi apk tool with apktool 1.5.0- and i have to change translation on value-it ) without problem, and i tried to rebuild them (without change any file) and i received following error:
Code:
--------------------------------------------------------------------------
|05/12/2012 -- 22:08:37,87|
--------------------------------------------------------------------------
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
I: Loading resource table...
W: Skipping "android" package group
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\fakate\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
D:\android\APK\other\..\projects\Phone.apk\res\values\arrays.xml:158: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-nl\arrays.xml:131: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-pt-rPT\arrays.xml:131: error: Found tag reference-array where item is expected
D:\android\APK\other\..\projects\Phone.apk\res\values-es\strings.xml:248: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-es\strings.xml:249: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values-it\strings.xml:248: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-it\strings.xml:249: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values-ru\strings.xml:212: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
D:\android\APK\other\..\projects\Phone.apk\res\values-ru\strings.xml:213: error: Unexpected end tag string
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:702: error: Public entry identifier 0x7f06002f entry index is larger than available symbols (index 47, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:702: error: Public symbol array/cdma_subscription_choices declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:695: error: Public entry identifier 0x7f060028 entry index is larger than available symbols (index 40, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:695: error: Public symbol array/cdma_subscription_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:689: error: Public symbol array/cdma_system_select_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:698: error: Public entry identifier 0x7f06002b entry index is larger than available symbols (index 43, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:698: error: Public symbol array/dtmf_tone_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:699: error: Public symbol array/dtmf_tone_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:703: error: Public entry identifier 0x7f060030 entry index is larger than available symbols (index 48, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:703: error: Public symbol array/subscription_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:700: error: Public symbol array/td_network_mode_choices declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:701: error: Public symbol array/td_network_mode_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:696: error: Public entry identifier 0x7f060029 entry index is larger than available symbols (index 41, total symbols 40).
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:696: error: Public symbol array/tty_mode_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:697: error: Public symbol array/tty_mode_values declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:674: error: Public symbol array/vt_incall_video_setting_entries2 declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:675: error: Public symbol array/vt_incall_video_setting_local_nightmode_entries declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:676: error: Public symbol array/vt_incall_video_setting_local_nightmode_entries2 declared here is not defined.
D:\android\APK\other\..\projects\Phone.apk\res\values\public.xml:677: error: Public symbol array/vt_incall_video_setting_peer_quality_entries declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\fakate\AppData\Local\Temp\APKTOOL5211967303135877753.tmp, -I, C:\Users\fakate\apktool\framework\1.apk, -S, D:\android\APK\other\..\projects\Phone.apk\res, -M, D:\android\APK\other\..\projects\Phone.apk\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\fakate\AppData\Local\Temp\APKTOOL5211967303135877753.tmp, -I, C:\Users\fakate\apktool\framework\1.apk, -S, D:\android\APK\other\..\projects\Phone.apk\res, -M, D:\android\APK\other\..\projects\Phone.apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)
... 6 more
How i can solve both problems?
Tnx in advance for your help,

Courtesy up

Up
Sent from my 4S clone using xda app-developers app

Up again
Sent from my 4S clone using xda app-developers app

Hi, Phone.apk building problem solved.
Now remain the problem of calendarCG.
Please can suggets me an evenual solution?
Tnx,
Fabrizio

HI,attached teh APK.
I supose that the problem is in the dex file.......

flagello79 said:
HI,attached teh APK.
I supose that the problem is in the dex file.......
Click to expand...
Click to collapse
Sorry for double post,
but yesterday i attached wrong file.
The correct file are below.
Please note that th efile CAlendarCG.odex.zi is only renamed ( remove .zip to have original odex file)
Thx for your support in this case
Rgds,
Fabrizio

This is the log
Code:
12-09 12:13:49.649 I/ActivityManager(163): Start proc com.android.providers.calendar for content provider com.android.providers.calendar/.CalendarProvider2: pid=1582 uid=10006 gids={3003}
12-09 12:13:49.650 E/look-----------------------------------------------(1573): 31
12-09 12:13:49.679 I/SurfaceFlinger(163): [SurfaceFlinger] statistic - FrameCount: 120, Duration: 4290277us, fps: 27.970222
12-09 12:13:49.723 V/ActivityManager(163): Binding process pid 1582 to record ProcessRecord{40a22528 1582:com.android.providers.calendar/10006}
12-09 12:13:49.723 V/ActivityManager(163): New death recipient [email protected]0a359a0 for thread [email protected]
12-09 12:13:49.724 V/ActivityManager(163): New app record ProcessRecord{40a22528 1582:com.android.providers.calendar/10006} [email protected] pid=1582
Sent from my 4S using xda app-developers app

And Aldo this one:
Code:
12-09 12:59:08.000 E/InputDispatcher(163): channel '40a630d0 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-09 12:59:08.000 E/InputDispatcher(163): channel '40a630d0 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
Sent from my 4S using xda app-developers app

And this us the log when i've the phone setting language in english:
Code:
12-09 14:30:45.378 I/ActivityManager(163): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.LaunchActivity bnds=[320,576][472,740] } from pid 287
12-09 14:30:45.527 I/ActivityManager(163): Start proc com.android.calendar for activity com.android.calendar/.LaunchActivity: pid=3180 uid=10006 gids={3003}
12-09 14:30:45.615 V/ActivityManager(163): Binding process pid 3180 to record ProcessRecord{40ade2d8 3180:com.android.calendar/10006}
12-09 14:30:45.615 V/ActivityManager(163): New app record ProcessRecord{40ade2d8 3180:com.android.calendar/10006} [email protected] pid=3180
12-09 14:30:45.616 V/ActivityManager(163): Launching: HistoryRecord{40a270d8 com.android.calendar/.LaunchActivity}
12-09 14:30:45.760 E/LaunchActivity(3180): onAccountsLoaded startActivity: com.android.calendar.MonthActivity
12-09 14:30:45.760 I/ActivityManager(163): Starting: Intent { flg=0x20020000 cmp=com.android.calendar/.MonthActivity } from pid 3180
12-09 14:30:45.768 V/ActivityManager(163): Enqueueing pending finish: HistoryRecord{40a270d8 com.android.calendar/.LaunchActivity}
12-09 14:30:45.768 V/ActivityManager(163): Launching: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:46.138 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/properties
12-09 14:30:46.160 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.166 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.172 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.180 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456271/2456271
12-09 14:30:46.228 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/instances/groupbyday/2456263/2456293
12-09 14:30:46.474 V/ActivityManager(163): Activity idle: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:46.580 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.MonthActivity: +812ms (total +1s150ms)
12-09 14:30:46.580 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.MonthActivity:812:4344566
12-09 14:30:47.190 I/ActivityManager(163): Starting: Intent { act=android.intent.action.EDIT cmp=com.android.calendar/.EditEvent (has extras) } from pid 3180
12-09 14:30:47.203 V/ActivityManager(163): Launching: HistoryRecord{40a97848 com.android.calendar/.EditEvent}
12-09 14:30:47.443 I/CalendarProvider(1582): CalendarProvider2: query,uri=content://com.android.calendar/calendars
12-09 14:30:47.666 V/ActivityManager(163): Activity idle: HistoryRecord{40a97848 com.android.calendar/.EditEvent}
12-09 14:30:47.666 V/ActivityManager(163): Stopping HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}: nowVisible=false waitingVisible=true finishing=false
12-09 14:30:47.875 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.EditEvent: +671ms
12-09 14:30:47.875 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.EditEvent:671:4345860
12-09 14:30:47.875 V/ActivityManager(163): Stopping HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}: nowVisible=true waitingVisible=false finishing=false
12-09 14:30:47.875 V/ActivityManager(163): Ready to stop: HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:47.883 V/ActivityManager(163): Activity stopped: token=HistoryRecord{40c148e0 com.android.calendar/.MonthActivity}
12-09 14:30:48.338 I/ActivityManager(163): Starting: Intent { cmp=com.android.calendar/.StartAndEndActivity (has extras) } from pid 3180
12-09 14:30:48.368 V/ActivityManager(163): Launching: HistoryRecord{40b06ef0 com.android.calendar/.StartAndEndActivity}
12-09 14:30:48.765 V/ActivityManager(163): Activity idle: HistoryRecord{40b06ef0 com.android.calendar/.StartAndEndActivity}
12-09 14:30:48.766 V/ActivityManager(163): Stopping HistoryRecord{40a97848 com.android.calendar/.EditEvent}: nowVisible=false waitingVisible=true finishing=false
12-09 14:30:48.889 I/ActivityManager(163): [AppLaunch] Displayed com.android.calendar/.StartAndEndActivity: +521ms
12-09 14:30:48.889 D/ActivityManager(163): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.StartAndEndActivity:521:4346875
12-09 14:30:48.889 V/ActivityManager(163): Stopping HistoryRecord{40a97848 com.android.calendar/.EditEvent}: nowVisible=true waitingVisible=false finishing=false
Sent from my 4S using xda app-developers app

Up
Sent from my 4S using xda app-developers app

up again:banghead::banghead::banghead::banghead:
Sent from my 4S using xda app-developers app

THIS IS A COMPLETE ERROR LOG
Code:
12-11 22:14:57.342 V/AlarmManager(182): 6: dic 12 12:08:00 p. com.android.providers.calendar
12-11 22:15:28.049 I/ActivityManager(182): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.calendar/.LaunchActivity bnds=[320,576][472,740] } from pid 13361
12-11 22:15:28.117 I/ActivityManager(182): Start proc com.android.calendar for activity com.android.calendar/.LaunchActivity: pid=25243 uid=10006 gids={3003}
12-11 22:15:28.173 V/ActivityManager(182): Binding process pid 25243 to record ProcessRecord{406ab498 25243:com.android.calendar/10006}
12-11 22:15:28.173 V/ActivityManager(182): New app record ProcessRecord{406ab498 25243:com.android.calendar/10006} [email protected] pid=25243
12-11 22:15:28.174 V/ActivityManager(182): Launching: HistoryRecord{405467f8 com.android.calendar/.LaunchActivity}
12-11 22:15:28.275 E/LaunchActivity(25243): onAccountsLoaded startActivity: com.android.calendar.MonthActivity
12-11 22:15:28.276 I/ActivityManager(182): Starting: Intent { flg=0x20020000 cmp=com.android.calendar/.MonthActivity } from pid 25243
12-11 22:15:28.278 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{405467f8 com.android.calendar/.LaunchActivity}
12-11 22:15:28.279 V/ActivityManager(182): Launching: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:28.701 I/ActivityManager(182): Start proc com.android.providers.calendar for content provider com.android.providers.calendar/.CalendarProvider2: pid=25252 uid=10006 gids={3003}
12-11 22:15:28.771 V/ActivityManager(182): Binding process pid 25252 to record ProcessRecord{406bb860 25252:com.android.providers.calendar/10006}
12-11 22:15:28.771 V/ActivityManager(182): New app record ProcessRecord{406bb860 25252:com.android.providers.calendar/10006} [email protected] pid=25252
12-11 22:15:28.796 I/ActivityThread(25252): Pub com.android.calendar: com.android.providers.calendar.CalendarProvider2
12-11 22:15:28.856 I/CalendarProvider(25252): onAccountsUpdated.
12-11 22:15:28.942 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXX,type=com.google
12-11 22:15:28.943 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXXXt,type=com.facebook.auth.login
12-11 22:15:28.943 I/CalendarProvider(25252): AccountManager data account,nae=XXXXXXXXXXXX,type=com.whatsapp
12-11 22:15:28.961 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/properties
12-11 22:15:28.967 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456273/2456273
12-11 22:15:28.988 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/whenbyday/2456273/2456273
12-11 22:15:29.023 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/calendar_alerts
12-11 22:15:29.039 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/instances/groupbyday/2456263/2456293
12-11 22:15:29.140 D/Calendar(25252): missed alarms found: 0
12-11 22:15:29.148 I/ActivityManager(182): [AppLaunch] Displayed com.android.calendar/.MonthActivity: +870ms (total +1s36ms)
12-11 22:15:29.148 D/ActivityManager(182): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.MonthActivity:870:55329649
12-11 22:15:29.184 V/ActivityManager(182): Activity idle: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:30.511 I/ActivityManager(182): Starting: Intent { act=android.intent.action.EDIT cmp=com.android.calendar/.EditEvent (has extras) } from pid 25243
12-11 22:15:30.526 V/ActivityManager(182): Launching: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:30.770 I/CalendarProvider(25252): CalendarProvider2: query,uri=content://com.android.calendar/calendars
12-11 22:15:31.015 V/ActivityManager(182): Activity idle: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:31.016 V/ActivityManager(182): Stopping HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: nowVisible=false waitingVisible=true finishing=false
12-11 22:15:31.224 I/ActivityManager(182): [AppLaunch] Displayed com.android.calendar/.EditEvent: +698ms
12-11 22:15:31.224 D/ActivityManager(182): AP_PROF:AppLaunch_LaunchTime:com.android.calendar/.EditEvent:698:55331725
12-11 22:15:31.225 V/ActivityManager(182): Stopping HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: nowVisible=true waitingVisible=false finishing=false
12-11 22:15:31.225 V/ActivityManager(182): Ready to stop: HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:31.229 V/ActivityManager(182): Activity stopped: token=HistoryRecord{40546a50 com.android.calendar/.MonthActivity}
12-11 22:15:31.787 I/ActivityManager(182): Starting: Intent { cmp=com.android.calendar/.StartAndEndActivity (has extras) } from pid 25243
12-11 22:15:31.818 V/ActivityManager(182): Launching: HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:32.012 W/ActivityManager(182): Force finishing activity com.android.calendar/.StartAndEndActivity
12-11 22:15:32.014 W/ActivityManager(182): Force finishing activity com.android.calendar/.EditEvent
12-11 22:15:32.014 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{40546dc0 com.android.calendar/.EditEvent}
12-11 22:15:32.183 D/AES (182): process : com.android.calendar
12-11 22:15:32.183 D/AES (182): module : com.android.calendar v10 (4.0.4)
12-11 22:15:32.186 D/AEE/LIBAEE(182): shell: raise_exp(2, 25243, -1361051648, com.android.calendar, 0x0x633db8, 0x0x0)
12-11 22:15:32.186 E/AEE/LIBAEE(182): read_cmdline:com.android.calendar
12-11 22:15:32.513 W/ActivityManager(182): Activity pause timeout for HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:32.513 V/ActivityManager(182): Enqueueing pending finish: HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}
12-11 22:15:34.083 I/ActivityManager(182): Process com.android.calendar (pid 25243) has died.
12-11 22:15:34.083 V/ActivityManager(182): Dying app: ProcessRecord{406ab498 25243:com.android.calendar/10006}, pid: 25243, thread: [email protected]
12-11 22:15:34.083 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40545a68 com.android.browser/.BrowserActivity}, HistoryRecord{409d0738 com.android.contacts/.DialtactsActivity}, HistoryRecord{40549ca8 com.android.mms/.ui.ConversationList}, HistoryRecord{40b0afc0 com.android.phone/.InCallScreen}, HistoryRecord{40a73bc0 com.android.launcher/.Launcher}, HistoryRecord{40546dc0 com.android.calendar/.EditEvent}, HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}, HistoryRecord{40546a50 com.android.calendar/.MonthActivity}] with 8 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #7 HistoryRecord{40546a50 com.android.calendar/.MonthActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #6 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #5 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [] with 0 entries
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}] with 1 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #0 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from list [HistoryRecord{40546dc0 com.android.calendar/.EditEvent}, HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}] with 2 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #1 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Record #0 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.084 V/ActivityManager(182): Removing app ProcessRecord{406ab498 0:com.android.calendar/10006} from history with 9 entries
12-11 22:15:34.084 V/ActivityManager(182): Record #8 HistoryRecord{40547250 com.android.calendar/.StartAndEndActivity}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.087 E/InputDispatcher(182): channel '4054b4c8 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
12-11 22:15:34.087 E/InputDispatcher(182): channel '4054b4c8 com.android.calendar/com.android.calendar.MonthActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-11 22:15:34.091 V/ActivityManager(182): Record #7 HistoryRecord{40546dc0 com.android.calendar/.EditEvent}: app=ProcessRecord{406ab498 0:com.android.calendar/10006}
12-11 22:15:34.095 I/WindowManager(182): WIN DEATH: Window{40568fb8 com.android.calendar/com.android.calendar.EditEvent paused=true}

No suggestion?no idea?
Sent from my 4S using xda app-developers app

Up
Sent from my 4S using xda app-developers app

..and finally MONTH ACTIVITY.class
PLEASE GIVE ME HELP TO FIND THE PROBLEM AND TO SOLVE THE BUG,SO I CAN USE THE CALENDAR ALSO WHE LANGUAGE PHONE SETTING IS IN ITALIAN,OR FRENCH,OR ANY OTHER LANGUAGES!
Code:
package com.android.calendar;
import android.app.Activity;
import android.content.*;
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.text.format.*;
import android.view.*;
import android.view.animation.*;
import android.widget.*;
import com.android.iphoneview.iphoneUtils;
import java.util.*;
// Referenced classes of package com.android.calendar:
// Navigator, MonthView, Utils, AgendaActivity,
// DayActivity, CalendarPreferenceActivity, EditEvent, EventLoader,
// CalendarApplication
public class MonthActivity extends Activity
implements android.widget.ViewSwitcher.ViewFactory, Navigator, android.view.animation.Animation.AnimationListener, android.view.View.OnClickListener
{
public MonthActivity()
{
mUpdateTZ = new _cls1();
oldlines = 0;
mIntentReceiver = new _cls2();
mObserver = new _cls3(new Handler());
}
void eventsChanged()
{
((MonthView)mSwitcher.getCurrentView()).reloadEvents();
}
public boolean getAllDay()
{
return false;
}
public long getSelectedTime()
{
return ((MonthView)mSwitcher.getCurrentView()).getSelectedTimeInMillis();
}
int getStartDay()
{
return mStartDay;
}
protected ViewSwitcher getSwitcher()
{
return mSwitcher;
}
public void goTo(Time time, boolean flag)
{
updateTitle(time);
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
monthview.dismissPopup();
Time time1 = monthview.getTime();
if(flag)
{
int i = time1.month + 12 * time1.year;
MonthView monthview1;
if(time.month + 12 * time.year < i)
{
mSwitcher.setInAnimation(mInAnimationPast);
mSwitcher.setOutAnimation(mOutAnimationPast);
} else
{
mSwitcher.setInAnimation(mInAnimationFuture);
mSwitcher.setOutAnimation(mOutAnimationFuture);
}
}
monthview1 = (MonthView)mSwitcher.getNextView();
monthview1.setSelectionMode(monthview.getSelectionMode());
monthview1.setSelectedTime(time);
monthview1.reloadEvents();
setListview(monthview1.minLines());
monthview1.animationStarted();
mSwitcher.showNext();
monthview1.requestFocus();
mTime = time;
}
public void goToToday()
{
Time time = new Time(Utils.getTimeZone(this, mUpdateTZ));
time.set(System.currentTimeMillis());
time.minute = 0;
time.second = 0;
time.normalize(false);
((TextView)findViewById(0x7f0d0013)).setText(iphoneUtils.formatMonthYear(time));
mTime = time;
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
monthview.setSelectedTime(time);
monthview.reloadEvents();
}
public View makeView()
{
MonthView monthview = new MonthView(this, this);
monthview.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-1, -1));
monthview.setSelectedTime(mTime);
return monthview;
}
public void onAnimationEnd(Animation animation)
{
((MonthView)mSwitcher.getCurrentView()).animationFinished();
}
public void onAnimationRepeat(Animation animation)
{
}
public void onAnimationStart(Animation animation)
{
}
public void onClick(View view)
{
if(!view.equals(mTabAgenda)) goto _L2; else goto _L1
_L1:
iphoneUtils.startActivity(this, com/android/calendar/AgendaActivity.getName(), getSelectedTime());
iphoneUtils.cancelAnimationAndFinishActivity(this);
_L4:
return;
_L2:
if(view.equals(mTabDay))
{
iphoneUtils.startActivity(this, com/android/calendar/DayActivity.getName(), getSelectedTime());
iphoneUtils.cancelAnimationAndFinishActivity(this);
} else
if(view.equals(mButtonSetting))
iphoneUtils.startActivity(this, com/android/calendar/CalendarPreferenceActivity.getName(), getSelectedTime());
else
if(view.equals(mButtonAddEvent))
{
long l = getSelectedTime();
long l1 = l + 0x36ee80L;
Intent intent = new Intent("android.intent.action.EDIT");
intent.setClassName(this, com/android/calendar/EditEvent.getName());
intent.putExtra("beginTime", l);
intent.putExtra("endTime", l1);
intent.putExtra("allDay", getAllDay());
startActivity(intent);
overridePendingTransition(0x7f040000, 0x7f04000d);
} else
if(view.equals(mButtonToday))
goToToday();
if(true) goto _L4; else goto _L3
_L3:
}
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setRequestedOrientation(1);
setContentView(0x7f030019);
mContentResolver = getContentResolver();
long l;
int i;
String s;
String s1;
String s2;
String s3;
String s4;
String s5;
String s6;
if(bundle != null)
l = bundle.getLong("beginTime");
else
l = iphoneUtils.timeFromIntentInMillis(getIntent());
mTime = new Time(Utils.getTimeZone(this, mUpdateTZ));
mTime.set(l);
mTime.normalize(true);
mStartDay = Calendar.getInstance().getFirstDayOfWeek();
i = mStartDay - 1 - 1;
s = DateUtils.getDayOfWeekString(1 + (i + 1) % 7, 20);
((TextView)findViewById(0x7f0d00a7)).setText(s);
s1 = DateUtils.getDayOfWeekString(1 + (i + 2) % 7, 20);
((TextView)findViewById(0x7f0d00a8)).setText(s1);
s2 = DateUtils.getDayOfWeekString(1 + (i + 3) % 7, 20);
((TextView)findViewById(0x7f0d00a9)).setText(s2);
s3 = DateUtils.getDayOfWeekString(1 + (i + 4) % 7, 20);
((TextView)findViewById(0x7f0d00aa)).setText(s3);
s4 = DateUtils.getDayOfWeekString(1 + (i + 5) % 7, 20);
((TextView)findViewById(0x7f0d00ab)).setText(s4);
s5 = DateUtils.getDayOfWeekString(1 + (i + 6) % 7, 20);
((TextView)findViewById(0x7f0d00ac)).setText(s5);
s6 = DateUtils.getDayOfWeekString(1 + (i + 7) % 7, 20);
((TextView)findViewById(0x7f0d00ad)).setText(s6);
((TextView)findViewById(0x7f0d0013)).setText(iphoneUtils.formatMonthYear(mTime));
mEventLoader = new EventLoader(this);
mProgressBar = (ProgressBar)findViewById(0x7f0d0033);
mSwitcher = (ViewSwitcher)findViewById(0x7f0d0034);
mSwitcher.setFactory(this);
mSwitcher.getCurrentView().requestFocus();
mInAnimationPast = AnimationUtils.loadAnimation(this, 0x7f040004);
mOutAnimationPast = AnimationUtils.loadAnimation(this, 0x7f040005);
mInAnimationFuture = AnimationUtils.loadAnimation(this, 0x7f04000a);
mOutAnimationFuture = AnimationUtils.loadAnimation(this, 0x7f04000b);
mInAnimationPast.setAnimationListener(this);
mInAnimationFuture.setAnimationListener(this);
ll = (LinearLayout)findViewById(0x7f0d00ae);
mTabAgenda = (TextView)findViewById(0x7f0d000d);
mTabAgenda.setOnClickListener(this);
mTabDay = (TextView)findViewById(0x7f0d000e);
mTabDay.setOnClickListener(this);
mButtonSetting = (Button)findViewById(0x7f0d0002);
mButtonSetting.setOnClickListener(this);
mButtonAddEvent = (Button)findViewById(0x7f0d0004);
mButtonAddEvent.setOnClickListener(this);
mButtonToday = (Button)findViewById(0x7f0d000c);
mButtonToday.setOnClickListener(this);
}
public boolean onCreateOptionsMenu(Menu menu)
{
return super.onCreateOptionsMenu(menu);
}
protected void onNewIntent(Intent intent)
{
long l = iphoneUtils.timeFromIntentInMillis(intent);
if(l > 0L)
{
Time time = new Time(Utils.getTimeZone(this, mUpdateTZ));
time.set(l);
goTo(time, false);
}
}
public boolean onOptionsItemSelected(MenuItem menuitem)
{
return super.onOptionsItemSelected(menuitem);
}
protected void onPause()
{
super.onPause();
if(isFinishing())
mEventLoader.stopBackgroundThread();
mContentResolver.unregisterContentObserver(mObserver);
unregisterReceiver(mIntentReceiver);
((MonthView)mSwitcher.getCurrentView()).dismissPopup();
((MonthView)mSwitcher.getNextView()).dismissPopup();
mEventLoader.stopBackgroundThread();
CalendarApplication.setDefaultView(this, 0);
}
public boolean onPrepareOptionsMenu(Menu menu)
{
return super.onPrepareOptionsMenu(menu);
}
protected void onResume()
{
super.onResume();
mUpdateTZ.run();
mEventLoader.startBackgroundThread();
eventsChanged();
MonthView monthview = (MonthView)mSwitcher.getCurrentView();
MonthView monthview1 = (MonthView)mSwitcher.getNextView();
String s = PreferenceManager.getDefaultSharedPreferences(this).getString("preferredDetailedView", CalendarPreferenceActivity.DEFAULT_DETAILED_VIEW);
monthview.updateView();
monthview1.updateView();
monthview.setDetailedView(s);
monthview1.setDetailedView(s);
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction("android.intent.action.TIME_SET");
intentfilter.addAction("android.intent.action.DATE_CHANGED");
intentfilter.addAction("android.intent.action.TIMEZONE_CHANGED");
registerReceiver(mIntentReceiver, intentfilter);
setListview(monthview.minLines());
mContentResolver.registerContentObserver(android.provider.Calendar.Events.CONTENT_URI, true, mObserver);
}
protected void onSaveInstanceState(Bundle bundle)
{
super.onSaveInstanceState(bundle);
bundle.putLong("beginTime", mTime.toMillis(true));
}
public void setListview(int i)
{
lp = (android.widget.RelativeLayout.LayoutParams)ll.getLayoutParams();
newHeight = 110;
if(oldlines == i) goto _L2; else goto _L1
_L1:
if(i != 4) goto _L4; else goto _L3
_L3:
newHeight = 290;
_L6:
lp.height = newHeight;
if(oldHeight != 0)
{
TranslateAnimation translateanimation = new TranslateAnimation(0.0F, 0.0F, newHeight - oldHeight, 0.0F);
translateanimation.setDuration(400L);
ll.startAnimation(translateanimation);
}
oldlines = i;
oldHeight = newHeight;
_L2:
return;
_L4:
if(i == 5)
newHeight = 200;
else
if(i == 6)
newHeight = 110;
if(true) goto _L6; else goto _L5
_L5:
}
protected void startProgressSpinner()
{
mProgressBar.setVisibility(0);
}
protected void stopProgressSpinner()
{
mProgressBar.setVisibility(8);
}
public void updateTitle(Time time)
{
TextView textview = (TextView)findViewById(0x7f0d0013);
StringBuffer stringbuffer = new StringBuffer(iphoneUtils.formatMonthYear(time));
if(!TextUtils.equals(Utils.getTimeZone(this, mUpdateTZ), Time.getCurrentTimezone()))
{
int i = 1;
if(DateFormat.is24HourFormat(this))
i |= 0x80;
long l = System.currentTimeMillis();
String s = Utils.getTimeZone(this, mUpdateTZ);
boolean flag;
TimeZone timezone;
if(time.isDst != 0)
flag = true;
else
flag = false;
timezone = TimeZone.getTimeZone(s);
stringbuffer.append(" (").append(Utils.formatDateRange(this, l, l, i)).append(" ").append(timezone.getDisplayName(flag, 0, Locale.getDefault())).append(")");
}
textview.setText(stringbuffer.toString());
}
private static final boolean DEBUG = true;
private static final int INITIAL_HEAP_SIZE = 0x400000;
private static final String TAG = "MonthActivity";
private LinearLayout ll;
private android.widget.RelativeLayout.LayoutParams lp;
private Button mButtonAddEvent;
private Button mButtonSetting;
private Button mButtonToday;
private ContentResolver mContentResolver;
EventLoader mEventLoader;
private Animation mInAnimationFuture;
private Animation mInAnimationPast;
private BroadcastReceiver mIntentReceiver;
private ContentObserver mObserver;
private Animation mOutAnimationFuture;
private Animation mOutAnimationPast;
private ProgressBar mProgressBar;
private int mStartDay;
private ViewSwitcher mSwitcher;
private TextView mTabAgenda;
private TextView mTabDay;
private Time mTime;
private Runnable mUpdateTZ;
private int newHeight;
private int oldHeight;
private int oldlines;
private class _cls1
implements Runnable
{
public void run()
{
mTime.timezone = Utils.getTimeZone(MonthActivity.this, this);
mTime.normalize(true);
updateTitle(mTime);
}
final MonthActivity this$0;
_cls1()
{
this$0 = MonthActivity.this;
super();
}
}
private class _cls2 extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
String s = intent.getAction();
if(s.equals("android.intent.action.TIME_SET") || s.equals("android.intent.action.DATE_CHANGED") || s.equals("android.intent.action.TIMEZONE_CHANGED"))
eventsChanged();
}
final MonthActivity this$0;
_cls2()
{
this$0 = MonthActivity.this;
super();
}
}
private class _cls3 extends ContentObserver
{
public boolean deliverSelfNotifications()
{
return true;
}
public void onChange(boolean flag)
{
eventsChanged();
}
final MonthActivity this$0;
_cls3(Handler handler)
{
this$0 = MonthActivity.this;
super(handler);
}
}
}

UP:crying: :crying: :crying: :crying: :crying: :crying:

Related

Unable to instantiate activity

Hello guys. So i'm trying to make a app that will play a aac stream from an online radio station. I managed to build the project but i get this error when running it.
Code:
05-27 06:12:00.734: E/AndroidRuntime(450): FATAL EXCEPTION: main
05-27 06:12:00.734: E/AndroidRuntime(450): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.spoledge.aacplay/com.spoledge.aacplay.AACPlayerActivity}: java.lang.ClassNotFoundException: com.spoledge.aacplay.AACPlayerActivity in loader dalvik.system.PathClassLoader[/data/app/com.spoledge.aacplay-2.apk]
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.os.Handler.dispatchMessage(Handler.java:99)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.os.Looper.loop(Looper.java:123)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-27 06:12:00.734: E/AndroidRuntime(450): at java.lang.reflect.Method.invokeNative(Native Method)
05-27 06:12:00.734: E/AndroidRuntime(450): at java.lang.reflect.Method.invoke(Method.java:507)
05-27 06:12:00.734: E/AndroidRuntime(450): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-27 06:12:00.734: E/AndroidRuntime(450): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-27 06:12:00.734: E/AndroidRuntime(450): at dalvik.system.NativeStart.main(Native Method)
05-27 06:12:00.734: E/AndroidRuntime(450): Caused by: java.lang.ClassNotFoundException: com.spoledge.aacplay.AACPlayerActivity in loader dalvik.system.PathClassLoader[/data/app/com.spoledge.aacplay-2.apk]
05-27 06:12:00.734: E/AndroidRuntime(450): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-27 06:12:00.734: E/AndroidRuntime(450): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-27 06:12:00.734: E/AndroidRuntime(450): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-27 06:12:00.734: E/AndroidRuntime(450): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
05-27 06:12:00.734: E/AndroidRuntime(450): ... 11 more
This is my project AACPlayerActivity.java code:
Code:
package com.spoledge.aacplay;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.spoledge.aacdecoder.AACPlayer;
import com.spoledge.aacdecoder.PlayerCallback;
/**
* This is the main activity.
*/
public class AACPlayerActivity extends Activity implements View.OnClickListener, PlayerCallback {
private History history;
private AutoCompleteTextView urlView;
private Button btnPlay;
private Button btnStop;
private TextView txtStatus;
private EditText txtBufAudio;
private EditText txtBufDecode;
private ProgressBar progress;
private Handler uiHandler;
private AACPlayer aacPlayer;
////////////////////////////////////////////////////////////////////////////
// PlayerCallback
////////////////////////////////////////////////////////////////////////////
private boolean playerStarted;
public void playerStarted() {
uiHandler.post( new Runnable() {
public void run() {
txtBufAudio.setEnabled( false );
txtBufDecode.setEnabled( false );
btnPlay.setEnabled( false );
btnStop.setEnabled( true );
txtStatus.setText( R.string.text_buffering );
progress.setProgress( 0 );
progress.setVisibility( View.VISIBLE );
playerStarted = true;
}
});
}
/**
* This method is called periodically by PCMFeed.
*
* @param isPlaying false means that the PCM data are being buffered,
* but the audio is not playing yet
*
* @param audioBufferSizeMs the buffered audio data expressed in milliseconds of playing
* @param audioBufferCapacityMs the total capacity of audio buffer expressed in milliseconds of playing
*/
public void playerPCMFeedBuffer( final boolean isPlaying,
final int audioBufferSizeMs, final int audioBufferCapacityMs ) {
uiHandler.post( new Runnable() {
public void run() {
progress.setProgress( audioBufferSizeMs * progress.getMax() / audioBufferCapacityMs );
if (isPlaying) txtStatus.setText( R.string.text_playing );
}
});
}
public void playerStopped( final int perf ) {
uiHandler.post( new Runnable() {
public void run() {
btnPlay.setEnabled( true );
btnStop.setEnabled( false );
txtBufAudio.setEnabled( true );
txtBufDecode.setEnabled( true );
// txtStatus.setText( R.string.text_stopped );
txtStatus.setText( "" + perf + " %" );
progress.setVisibility( View.INVISIBLE );
playerStarted = false;
}
});
}
public void playerException( final Throwable t) {
uiHandler.post( new Runnable() {
public void run() {
new AlertDialog.Builder( AACPlayerActivity.this )
.setTitle( R.string.text_exception )
.setMessage( t.toString())
.setNeutralButton( R.string.button_close,
new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dialog, int id) {
dialog.cancel();
}
}
)
.show();
txtStatus.setText( R.string.text_stopped );
if (playerStarted) playerStopped( 0 );
}
});
}
////////////////////////////////////////////////////////////////////////////
// OnClickListener
////////////////////////////////////////////////////////////////////////////
/**
* Called when a view has been clicked.
*/
public void onClick( View v ) {
try {
switch (v.getId()) {
case R.id.view_main_button_play: start(); break;
case R.id.view_main_button_stop: stop(); break;
}
}
catch (Exception e) {
Log.e( "AACPlayerActivity", "exc" , e );
}
}
////////////////////////////////////////////////////////////////////////////
// Protected
////////////////////////////////////////////////////////////////////////////
@Override
protected void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
setContentView( R.layout.main );
btnPlay = (Button) findViewById( R.id.view_main_button_play );
btnStop = (Button) findViewById( R.id.view_main_button_stop );
urlView = (AutoCompleteTextView) findViewById( R.id.view_main_edit_url );
txtStatus = (TextView) findViewById( R.id.view_main_text_status );
txtBufAudio = (EditText) findViewById( R.id.view_main_text_bufaudio );
txtBufDecode = (EditText) findViewById( R.id.view_main_text_bufdecode );
progress = (ProgressBar) findViewById( R.id.view_main_progress );
txtBufAudio.setText( String.valueOf( AACPlayer.DEFAULT_AUDIO_BUFFER_CAPACITY_MS ));
txtBufDecode.setText( String.valueOf( AACPlayer.DEFAULT_DECODE_BUFFER_CAPACITY_MS ));
btnPlay.setOnClickListener( this );
btnStop.setOnClickListener( this );
history = new History( this );
history.read();
if (history.size() == 0 ) {
history.addUrl( "/sdcard/local/cro2-32.aac" );
history.addUrl( "netshow.play.cz:8000/crocb32aac" );
history.addUrl( "62.44.1.26:8000/cro2-128aac" );
history.addUrl( "2483.live.streamtheworld.com:80/KFTZFMAACCMP3" );
history.addUrl( "yourmuze.com:8000/play/paradise/l.aac" );
history.addUrl( "yourmuze.com:8000/play/paradise/m.aac" );
history.addUrl( "yourmuze.com:8000/play/paradise/h.aac" );
}
urlView.setAdapter( history.getArrayAdapter());
uiHandler = new Handler();
}
@Override
protected void onPause() {
super.onPause();
history.write();
}
@Override
protected void onDestroy() {
super.onDestroy();
stop();
}
////////////////////////////////////////////////////////////////////////////
// Private
////////////////////////////////////////////////////////////////////////////
private void start() {
stop();
aacPlayer = new AACPlayer( this, getInt( txtBufAudio ), getInt( txtBufDecode ));
aacPlayer.playAsync( getUrl());
}
private void stop() {
if (aacPlayer != null) {
aacPlayer.stop();
aacPlayer = null;
}
}
private String getUrl() {
String ret = urlView.getText().toString();
history.addUrl( ret );
return ret;
}
private int getInt( EditText et ) {
return Integer.parseInt( et.getText().toString());
}
}
And this is my AndroidManifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="schemas.android.com/apk/res/android"
package="com.spoledge.aacplay"
android:versionCode="1"
android:versionName="@string/app_version"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="10"/>
<application
android:label="@string/app_name"
android:debuggable="true"
>
<activity
android:name="com.spoledge.aacplay.AACPlayerActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
So can someone help me solve this out? Thanks!
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums & Read the Forum Rules
Moving to Q&A
Here is your problem:
05-27 06:12:00.734: E/AndroidRuntime(450): Caused by: java.lang.ClassNotFoundException: com.spoledge.aacplay.AACPlayerActivity in loader dalvik.system.PathClassLoader[/data/app/com.spoledge.aacplay-2.apk]
Click to expand...
Click to collapse
are you using any external libraries?
are they exactly in libs directory in your project?

android spinner selected value stop mediaplayer

Hello guys. I`m working on a app for listening a online radio station. All works great, but i run into a bump using a spinner. Here is my code:
Code:
package com.hrupin.streamingmedia;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
import android.media.MediaPlayer.OnCompletionListener;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.hrupin.media.R;
public class StreamingMp3Player extends Activity implements OnClickListener, OnTouchListener, OnCompletionListener, OnBufferingUpdateListener, OnItemSelectedListener{
TextView textMsg, textPrompt;
ImageView imageView;
Spinner spnLocale;
final String textSource = "xxxxxxx.php";
private ImageButton buttonPlayPause;
protected EditText editTextSongURL;
private MediaPlayer mediaPlayer;
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn1 = (Button) findViewById(R.id.btn1);
btn1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
System.exit(0);
}
});
imageView = (ImageView) findViewById(R.id.imagine);
textPrompt = (TextView)findViewById(R.id.textprompt);
textMsg = (TextView)findViewById(R.id.textmsg);
textMsg.post( new Runnable(){
public void run(){
URL textUrl;
try {
textUrl = new URL(textSource);
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
String StringBuffer;
String stringText = "";
while ((StringBuffer = bufferReader.readLine()) != null) {
stringText += StringBuffer;
}
bufferReader.close();
textMsg.setText(stringText);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
textMsg.setText(e.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
textMsg.setText(e.toString());
}
textMsg.postDelayed(this,(1000*10));
}
});
initView();
spnLocale = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.planets_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnLocale.setAdapter(adapter);
spnLocale.setOnItemSelectedListener(new StreamingMp3Player());
}
private void initView() {
buttonPlayPause = (ImageButton)findViewById(R.id.ButtonTestPlayPause);
buttonPlayPause.setOnClickListener(this);
editTextSongURL = (EditText)findViewById(R.id.EditTextSongURL);
editTextSongURL.setText("Romantic FM");
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnBufferingUpdateListener(this);
mediaPlayer.setOnCompletionListener(this);
}
public void onClick(View v) {
if(v.getId() == R.id.ButtonTestPlayPause){
try {
mediaPlayer.setDataSource("xxxxxxx:7651");
mediaPlayer.prepare();
} catch (Exception e) {
e.printStackTrace();
}
//mediaFileLengthInMilliseconds = mediaPlayer.getDuration();
if(!mediaPlayer.isPlaying()){
mediaPlayer.start();
//buttonPlayPause.setBackgroundColor(Color.RED);
buttonPlayPause.setImageResource(R.drawable.button_pause);
}else {
mediaPlayer.pause();
buttonPlayPause.setImageResource(R.drawable.button_play);
//System.out.println("Pauza");
}
}
}
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if(pos == 1) {
mediaPlayer.pause();
}
}
@SuppressWarnings("rawtypes")
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
public void onCompletion(MediaPlayer mp) {
buttonPlayPause.setImageResource(R.drawable.button_play);
}
public void onBufferingUpdate(MediaPlayer arg0, int arg1) {
// TODO Auto-generated method stub
}
public boolean onTouch(View arg0, MotionEvent arg1) {
// TODO Auto-generated method stub
return false;
}
}
This next code is supposed to stop mediaplayer from playing if i select a specific value from the spinner options:
Code:
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if(pos == 1) {
mediaPlayer.pause();
}
}
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
But instead of stopping the mediaplayer it crashes. I get this error from logcat:
Code:
05-28 06:34:42.752: E/AndroidRuntime(377): FATAL EXCEPTION: main
05-28 06:34:42.752: E/AndroidRuntime(377): java.lang.NullPointerException
05-28 06:34:42.752: E/AndroidRuntime(377): at com.hrupin.streamingmedia.StreamingMp3Player.onItemSelected(StreamingMp3Player.java:165)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.widget.AdapterView.fireOnSelected(AdapterView.java:871)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.widget.AdapterView.access$200(AdapterView.java:42)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:837)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.os.Handler.handleCallback(Handler.java:587)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.os.Handler.dispatchMessage(Handler.java:92)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.os.Looper.loop(Looper.java:123)
05-28 06:34:42.752: E/AndroidRuntime(377): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-28 06:34:42.752: E/AndroidRuntime(377): at java.lang.reflect.Method.invokeNative(Native Method)
05-28 06:34:42.752: E/AndroidRuntime(377): at java.lang.reflect.Method.invoke(Method.java:507)
05-28 06:34:42.752: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-28 06:34:42.752: E/AndroidRuntime(377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-28 06:34:42.752: E/AndroidRuntime(377): at dalvik.system.NativeStart.main(Native Method)
So can someone tell me what i'm doing wrong? Thanks!
java.lang.NullPointerException
05-28 06:34:42.752: E/AndroidRuntime(377): at com.hrupin.streamingmedia.StreamingMp3Player.onItemSelected(StreamingMp3Player.java:165)
Click to expand...
Click to collapse
Check this line and see why you have a NULL object, because this is your problem
this is the error(the mediaPlayer.Pause line):
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if(pos == 1) {
mediaPlayer.pause();
}
}
but i don`t understand why.

NetworkOnMainThreadException error in jellybean

I've been trying to get this to work for the last week or so and still have no idea what the problem is. it works on android 2.1 but not on 4.1. ive got this string in a service that check for updates in my app.
Code:
latestVersion = Integer.parseInt(getHttpString(urlLatestVersion));
its called in checkForUpdate(); which is called in onStart(Intent intent, int startId);.
Code:
private String getHttpString(String urlString) throws IOException {
InputStream in = null;
int response = -1;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection))
throw new IOException("Not an HTTP connection");
try {
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
httpConn.connect();
response = httpConn.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
in = httpConn.getInputStream();
}
} catch (Exception ex) {
ex.printStackTrace();
//
//main error currently lies here
// TODO fix errors that accures on android 4.0 and above.
//
}
if (in != null) {
StringBuilder sb = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(in, "UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line); // .append("\n");
}
} finally {
in.close();
}
return sb.toString();
} else
return "";
}
this is the error from the logcat
Code:
W/System.err( 7077): android.os.NetworkOnMainThreadException
W/System.err( 7077): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
W/System.err( 7077): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
W/System.err( 7077): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
W/System.err( 7077): at java.net.InetAddress.getAllByName(InetAddress.java:214)
W/System.err( 7077): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
W/System.err( 7077): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
W/System.err( 7077): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)
W/System.err( 7077): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
W/System.err( 7077): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
W/System.err( 7077): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
W/System.err( 7077): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
W/System.err( 7077): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
W/System.err( 7077): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
W/System.err( 7077): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.getHttpString(Update.java:166)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.checkForUpdate(Update.java:98)
W/System.err( 7077): at com.lukemovement.roottoolbox.pro.Update.onStart(Update.java:75)
W/System.err( 7077): at android.app.Service.onStartCommand(Service.java:450)
W/System.err( 7077): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2620)
W/System.err( 7077): at android.app.ActivityThread.access$1900(ActivityThread.java:143)
W/System.err( 7077): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
W/System.err( 7077): at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err( 7077): at android.os.Looper.loop(Looper.java:137)
W/System.err( 7077): at android.app.ActivityThread.main(ActivityThread.java:4935)
W/System.err( 7077): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 7077): at java.lang.reflect.Method.invoke(Method.java:511)
W/System.err( 7077): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
W/System.err( 7077): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
W/System.err( 7077): at dalvik.system.NativeStart.main(Native Method)
I/Example update( 7077): Invalid int: ""
so has android given up on being backwards compatible or have just just forgotten to add this bit in?
ive read that i need to use AsyncTask. but i cant seem to get it to work for me, could anyone help me with this please?
replaced
Code:
@Override
public void onStart(final Intent intent, int startId) {
with
Code:
@Override
public void onStart(final Intent intent, int startId) {
new Thread(new Runnable(){
@Override
public void run() {
fix the issue instantly.
lukemovement1 said:
replaced
Code:
@Override
public void onStart(final Intent intent, int startId) {
with
Code:
@Override
public void onStart(final Intent intent, int startId) {
new Thread(new Runnable(){
@Override
public void run() {
fix the issue instantly.
Click to expand...
Click to collapse
Yep!
You can't run your network requests on main thread. Use have to use AsyncTask. http://developer.android.com/reference/android/os/AsyncTask.html

Making a simple android app?

Hello.
I would like to make a very simple Android app, with no UI. Kind of a shortcut. I tried searching the web, and I didn't find what I was looking for.
The question is: Can I make a simple app, that only launches an activity?
I want to make an app to launch the following activity : "com.cyanogenmod.trebuchet.preference.Preferences". Kind of how the app "QuickShortcutMaker" works.
Thanks in advance for future answers.
I haven't much experience on android developer, but I think that this can do what you want.
Start a new project with an empty activity and put this inside the activity.java file:
Code:
public class MainActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.cyanogenmod.trebuchet.preference.Preferences");
startActivity(intent);
finish();
}
}
dancer_69 said:
I haven't much experience on android developer, but I think that this can do what you want.
Start a new project with an empty activity and put this inside the activity.java file:
Code:
public class MainActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.cyanogenmod.trebuchet.preference.Preferences");
startActivity(intent);
finish();
}
}
Click to expand...
Click to collapse
Thanks a lot for your help!
This line is giving me an error upon debug:
Code:
Intent intent = pm.getLaunchIntentForPackage("com.cyanogenmod.trebuchet.preference.Preferences");
The commands 'Intent intent" and "PackageManager" are not recognized. Eclipse suggests changing them, importing them, or creating a class. What should I do?
This is the logcat:
Code:
I/ActivityManager( 524): START u0 {act=android.intent.action.MAIN cat=[android.
intent.category.LAUNCHER] flg=0x10200000 cmp=com.AB.launchersettings/.MainActivi
ty} from pid 876
D/ALSAModule( 175): setHardwareParams: reqBuffSize 1024 channels 2 sampleRate 4
8000
D/ALSAModule( 175): setHardwareParams: buffer_size 2048, period_size 1024, peri
od_cnt 2
D/dalvikvm(26747): Late-enabling CheckJNI
I/ActivityManager( 524): Start proc com.AB.launchersettings for activity com.AB
.launchersettings/.MainActivity: pid=26747 uid=10046 gids={50046, 1028}
D/overlay ( 172): FROM_STATE = OV_BYPASS_3_LAYER TO_STATE = OV_CLOSED
E/Trace (26747): error opening trace file: No such file or directory (2)
D/AndroidRuntime(26747): Shutting down VM
W/dalvikvm(26747): threadid=1: thread exiting with uncaught exception (group=0x4
0a4a888)
E/AndroidRuntime(26747): FATAL EXCEPTION: main
E/AndroidRuntime(26747): java.lang.RuntimeException: Unable to start activity Co
mponentInfo{com.AB.launchersettings/com.AB.launchersettings.MainActivity}: java.
lang.NullPointerException
E/AndroidRuntime(26747): at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2307)
E/AndroidRuntime(26747): at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2357)
E/AndroidRuntime(26747): at android.app.ActivityThread.access$600(Activit
yThread.java:153)
E/AndroidRuntime(26747): at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:1247)
E/AndroidRuntime(26747): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(26747): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(26747): at android.app.ActivityThread.main(ActivityThrea
d.java:5231)
E/AndroidRuntime(26747): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(26747): at java.lang.reflect.Method.invoke(Method.java:5
11)
E/AndroidRuntime(26747): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:794)
E/AndroidRuntime(26747): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:561)
E/AndroidRuntime(26747): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(26747): Caused by: java.lang.NullPointerException
E/AndroidRuntime(26747): at android.app.Instrumentation.execStartActivity
(Instrumentation.java:1410)
E/AndroidRuntime(26747): at android.app.Activity.startActivityForResult(A
ctivity.java:3376)
E/AndroidRuntime(26747): at android.app.Activity.startActivityForResult(A
ctivity.java:3337)
E/AndroidRuntime(26747): at android.app.Activity.startActivity(Activity.j
ava:3572)
E/AndroidRuntime(26747): at android.app.Activity.startActivity(Activity.j
ava:3540)
E/AndroidRuntime(26747): at com.AB.launchersettings.MainActivity.onCreate
(MainActivity.java:16)
E/AndroidRuntime(26747): at android.app.Activity.performCreate(Activity.j
ava:5110)
E/AndroidRuntime(26747): at android.app.Instrumentation.callActivityOnCre
ate(Instrumentation.java:1080)
E/AndroidRuntime(26747): at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2261)
E/AndroidRuntime(26747): ... 11 more
W/ActivityManager( 524): Force finishing activity com.AB.launchersettings/.Ma
inActivity
D/dalvikvm( 524): GC_FOR_ALLOC freed 1154K, 23% free 26363K/33812K, paused 86ms
, total 86ms
W/BackupManagerService( 524): dataChanged but no participant pkg='com.android.p
roviders.settings' uid=10031
W/ActivityManager( 524): Activity pause timeout for ActivityRecord{40cbfcc8 u0
com.AB.launchersettings/.MainActivity}
D/alsa_ucm( 175): snd_use_case_set(): uc_mgr 0x2a0092a0 identifier _verb value
Inactive
D/alsa_ucm( 175): Set mixer controls for HiFi Lowlatency enable 0
D/alsa_ucm( 175): snd_use_case_set(): uc_mgr 0x2a0092a0 identifier _disdev valu
e Speaker
D/alsa_ucm( 175): Set mixer controls for Speaker enable 0
W/ActivityManager( 524): Activity destroy timeout for ActivityRecord{40cbfcc8 u
0 com.AB.launchersettings/.MainActivity}
What I did:
Created a new project ( Filled up the name, icon and stuff)
Went straight to MainActivity.java, and put what you gave me in it.
Debugged the app by installing it on my Nexus 4.
Import them.
EDIT:
Seems that the above code doesn't work. So replace all content on your activity, except the first line(com... what you have as name) with this:
Code:
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
public class MainActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent();
intent.setClassName("com.cyanogenmod.trebuchet", "com.cyanogenmod.trebuchet.preference.Preferences");
startActivity(intent);
finish();
}
}
dancer_69 said:
Import them.
EDIT:
Seems that the above code doesn't work. So replace all content on your activity, except the first line(com... what you have as name) with this:
Code:
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
public class MainActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent();
intent.setClassName("com.cyanogenmod.trebuchet", "com.cyanogenmod.trebuchet.preference.Preferences");
startActivity(intent);
finish();
}
}
Click to expand...
Click to collapse
This worked. Thanks a lot!!

[Q] Really confused and annoyed right now

Can somebody please tell me how these bits of code
Code:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
Uri originalUri = data.getData();
selectedImageImageView.setImageURI(originalUri);
selectedImageImageView.setVisibility(View.VISIBLE);
progressDialog.setProgress(0);
progressDialog.show();
new GetImageFileTask(this).execute(imageHelper,
selectedImageImageView);
}
super.onActivityResult(requestCode, resultCode, data);
}
Code:
public static final int GALLERY_KITKAT_INTENT_CALLED = 2;
public static final int GALLERY_INTENT_CALLED = 1;
private final int PREF_WIDTH_IMAGE = 500;
private Activity activity;
public ImageHelper(Activity activity) {
this.activity = activity;
}
public void getImage() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
activity.startActivityForResult(intent, GALLERY_INTENT_CALLED);
} else {
showKitKatGallery();
}
}
private void showKitKatGallery() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
activity.startActivityForResult(intent, GALLERY_KITKAT_INTENT_CALLED);
}
public File getFileFromImageView(ImageView imageView) throws IOException {
int preferredWidth = PREF_WIDTH_IMAGE;
Bitmap origBitmap = drawableToBitmap(imageView.getDrawable());
int origWidth = origBitmap.getWidth();
int origHeight = origBitmap.getHeight();
int destHeight, destWidth;
if (origWidth <= preferredWidth || origHeight <= preferredWidth) {
destWidth = origWidth;
destHeight = origHeight;
} else {
destWidth = PREF_WIDTH_IMAGE;
destHeight = origHeight / (origWidth / destWidth);
}
File tempFile = new File(activity.getCacheDir(), "temp.png");
tempFile.createNewFile();
Bitmap bitmap = resizeBitmap(origBitmap, destWidth, destHeight);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos);
byte[] bitmapData = bos.toByteArray();
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(bitmapData);
fos.close();
return tempFile;
}
public static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
int width = drawable.getIntrinsicWidth();
width = width > 0 ? width : 1;
int height = drawable.getIntrinsicHeight();
height = height > 0 ? height : 1;
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
}
private Bitmap resizeBitmap(Bitmap inputBitmap, int newWidth, int newHeight) {
return Bitmap.createScaledBitmap(inputBitmap, newWidth, newHeight, true);
}
}
have managed to come up with this error:
Code:
05-15 02:10:01.199: E/AndroidRuntime(17169): FATAL EXCEPTION: main
05-15 02:10:01.199: E/AndroidRuntime(17169): Process: com.simplistic.bloxbackup, PID: 17169
05-15 02:10:01.199: E/AndroidRuntime(17169): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:13985 flg=0x43 }} to activity {com.simplistic.bloxbackup/com.simplistic.bloxbackup.activities.GalleryActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageURI(android.net.Uri)' on a null object reference
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread.deliverResults(ActivityThread.java:3637)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3680)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread.access$1300(ActivityThread.java:149)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.os.Handler.dispatchMessage(Handler.java:102)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.os.Looper.loop(Looper.java:211)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread.main(ActivityThread.java:5321)
05-15 02:10:01.199: E/AndroidRuntime(17169): at java.lang.reflect.Method.invoke(Native Method)
05-15 02:10:01.199: E/AndroidRuntime(17169): at java.lang.reflect.Method.invoke(Method.java:372)
05-15 02:10:01.199: E/AndroidRuntime(17169): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
05-15 02:10:01.199: E/AndroidRuntime(17169): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
05-15 02:10:01.199: E/AndroidRuntime(17169): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageURI(android.net.Uri)' on a null object reference
05-15 02:10:01.199: E/AndroidRuntime(17169): at com.simplistic.bloxbackup.activities.GalleryActivity.onActivityResult(GalleryActivity.java:101)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.Activity.dispatchActivityResult(Activity.java:6135)
05-15 02:10:01.199: E/AndroidRuntime(17169): at android.app.ActivityThread.deliverResults(ActivityThread.java:3633)
Because i don't know if any of you have seen my thread about my new app "Blox Backup" but the launch has been a big massive flop due this problem.
Now what i don't get is that it was all working as it should before i signed then published it?! I mean i know that apps don't work on every phone but this simply will not work at all no matter the phone!
So can someone please review the code and see where the null pointer is coming from because it shouldn't be coming up as null especially when it didn't before. I have tried to get an answer on Stack but nobody has bothered
So yeah please give me hand because i need this app back on Gplay
Thanks
I'm on my phone right now and have just taken a quick look, but my understanding is that "selectedImageView" is null. You could use something like Eclipse's debugging tool to check in real time where the crash happens and due to what.
So I've been playing around with it and it doesn't crash any more but it'll just finish the intent then do nothing. so nothing is being uploaded...
Code:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == imageHelper.GALLERY_KITKAT_INTENT_CALLED) {
Uri originalUri = data.getData();
selectedImageImageView.setImageURI(originalUri);
selectedImageImageView.setVisibility(View.VISIBLE);
progressDialog.setProgress(0);
progressDialog.show();
new GetImageFileTask(this).execute(imageHelper,
selectedImageImageView);
}else{
if(resultCode == imageHelper.GALLERY_INTENT_CALLED){
Uri originalUri = data.getData();
selectedImageImageView.setImageURI(originalUri);
selectedImageImageView.setVisibility(View.VISIBLE);
progressDialog.setProgress(0);
progressDialog.show();
new GetImageFileTask(this).execute(imageHelper,
selectedImageImageView);
}
}
super.onActivityResult(requestCode, resultCode, data);
}
Code:
public int GALLERY_KITKAT_INTENT_CALLED = 2;
public int GALLERY_INTENT_CALLED = 1;
public ImageHelper(Activity activity) {
this.activity = activity;
}
public void getImage() {
if (Build.VERSION.SDK_INT < 19) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
activity.startActivityForResult(intent, 2);
} else {
showKitKatGallery();
}
}
private void showKitKatGallery() {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
activity.startActivityForResult(intent, 1);
}
I also have a feeling this
Code:
public class GetImageFileTask extends AsyncTask<Object, Object, Object> {
private OnGetImageFileListener listener;
public GetImageFileTask(OnGetImageFileListener listener) {
this.listener = listener;
}
@Override
protected Object doInBackground(Object[] params) {
File imageFile = null;
ImageHelper imageHelper = (ImageHelper) params[0];
ImageView imageView = (ImageView) params[1];
try {
imageFile = imageHelper.getFileFromImageView(imageView);
} catch (IOException e) {
e.printStackTrace();
}
return imageFile;
}
@Override
protected void onPostExecute(Object imageFile) {
listener.onGotImageFile((File) imageFile);
}
}
may have something to do with the problem but i could be wrong
X10_minipro said:
I'm on my phone right now and have just taken a quick look, but my understanding is that "selectedImageView" is null. You could use something like Eclipse's debugging tool to check in real time where the crash happens and due to what.
Click to expand...
Click to collapse
I done but it didn't show anything that i didn't already know
Right i give up, I've tried every single "solution" but absolutely nothing works, so i have no idea what's happened but it won't work so this app, unless someone can actually fix it, is going to off the play store
Okay, I'm feeling very very stupid right now, it turns out i forgot i deleted the imageview from the layout but made a rookie mistake and left the code. I'm such a twat.

Categories

Resources