Hi Guys
I have a mapview displaying region A. On pressing a button, I want to swap to region B. MY code on click is
mapSwitchButton.addEventListener('click', function(e)
{
Titanium.API.info("You clicked the button");
if(mapSwitchButton.title == 'show area 1')
{
mapSwitchButton.title = 'show Pick-Up';
mapView.region = { latitude:43.623075, longitude:-79.480988,
latitudeDelta:0.002109, longitudeDelta:0.005284 };
mapView.setAnnotations(mapAnnotation1);
}
else
{
mapSwitchButton.title = 'show area 2';
mapView.region = { latitude:43.828923, longitude:-80.52927,
latitudeDelta:0.01548, longitudeDelta:0.042272 };
mapView.setAnnotations(mapAnnotation2);
}
});
this doesn't work - it causes the application to restart. I would appreciate it if someone could give me a pointer to how I swap regions
Regards, Richard
2 Answers
Accepted Answer
- remove the annotation Code
- use setRegion();
- note: setRegion does not work on android, there is a Bug which will be fixed in 2.2.
You may try the latest CI build.
mapView is defined in the same function as the button
the error I see is
D
[INFO][TiAPI ( 656)] You clicked the button
[INFO][DEBUG ( 551)] *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
[INFO][DEBUG ( 551)] Build fingerprint: 'generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys'
[INFO][DEBUG ( 551)] pid: 656, tid: 664 >>> com.slingride.slingrider <<<
[INFO][DEBUG ( 551)] signal 11 (SIGSEGV), fault addr 00000014
[INFO][DEBUG ( 551)] r0 00000000 r1 8146d2ec r2 00000082 r3 00000000
[INFO][DEBUG ( 551)] r4 00000000 r5 47e3fb80 r6 00118c98 r7 47e3faa7
[INFO][DEBUG ( 551)] r8 4503ad70 r9 47e3faa7 10 002982e8 fp 574ef695
[INFO][DEBUG ( 551)] ip 81539340 sp 47e3fa40 lr 8107217b pc 8106cbb8 cpsr 60000030
[INFO][DEBUG ( 551)] #00 pc 0006cbb8 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] #01 pc 00072176 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] #02 pc 00070478 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] #03 pc 00070558 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] #04 pc 00147858 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)]
[INFO][DEBUG ( 551)] code around pc:
[INFO][DEBUG ( 551)] 8106cb98 1c2060e5 ffc8f7ff 46c0bd70 ffffff9b
[INFO][DEBUG ( 551)] 8106cba8 4b16b570 447b1c04 781b681b d1102b00
[INFO][DEBUG ( 551)] 8106cbb8 2b007d03 6900d007 fd0cf004 d0141e05
[INFO][DEBUG ( 551)] 8106cbc8 75232300 6900e003 fcf0f004 1c281c05
[INFO][DEBUG ( 551)] 8106cbd8 f7ffbd70 2800ff09 68e5d101 1c20e7f7
[INFO][DEBUG ( 551)]
[INFO][DEBUG ( 551)] code around lr:
[INFO][DEBUG ( 551)] 81072158 9002efae ea56f0b8 dd1c2800 58e34b4c
[INFO][DEBUG ( 551)] 81072168 2301781a 703b4053 f7ff9802 f7fafb05
[INFO][DEBUG ( 551)] 81072178 1c05fd17 f7fae7b1 1e06fdb7 e76ad000
[INFO][DEBUG ( 551)] 81072188 e7aa2500 703b2301 f0b01c28 f7ffef90
[INFO][DEBUG ( 551)] 81072198 1c05fba7 9802e7a1 ee70f0b5 f0c49004
[INFO][DEBUG ( 551)]
[INFO][DEBUG ( 551)] stack:
[INFO][DEBUG ( 551)] 47e3fa00 afd41724 /system/lib/libc.so
[INFO][DEBUG ( 551)] 47e3fa04 000000dc
[INFO][DEBUG ( 551)] 47e3fa08 000013fc
[INFO][DEBUG ( 551)] 47e3fa0c 000001b8
[INFO][DEBUG ( 551)] 47e3fa10 0000267c
[INFO][DEBUG ( 551)] 47e3fa14 81070539 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] 47e3fa18 002982e8 [heap]
[INFO][DEBUG ( 551)] 47e3fa1c afd0be39 /system/lib/libc.so
[INFO][DEBUG ( 551)] 47e3fa20 00000001
[INFO][DEBUG ( 551)] 47e3fa24 00118c98 [heap]
[INFO][DEBUG ( 551)] 47e3fa28 00118c98 [heap]
[INFO][DEBUG ( 551)] 47e3fa2c 4503ad70 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
[INFO][DEBUG ( 551)] 47e3fa30 0011f588 [heap]
[INFO][DEBUG ( 551)] 47e3fa34 808406ab /system/lib/libdvm.so
[INFO][DEBUG ( 551)] 47e3fa38 df002777
[INFO][DEBUG ( 551)] 47e3fa3c e3a070ad
[INFO][DEBUG ( 551)] #00 47e3fa40 81539258 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] 47e3fa44 47e3fb80
[INFO][DEBUG ( 551)] 47e3fa48 00118c98 [heap]
[INFO][DEBUG ( 551)] 47e3fa4c 8107217b /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] #01 47e3fa50 4503ad70 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
[INFO][DEBUG ( 551)] 47e3fa54 afd0cd81 /system/lib/libc.so
[INFO][DEBUG ( 551)] 47e3fa58 47e3fb80
[INFO][DEBUG ( 551)] 47e3fa5c 8091e333 /data/data/com.slingride.slingrider/lib/libstlport_shared.so
[INFO][DEBUG ( 551)] 47e3fa60 47e3fa78
[INFO][DEBUG ( 551)] 47e3fa64 8091e33b /data/data/com.slingride.slingrider/lib/libstlport_shared.so
[INFO][DEBUG ( 551)] 47e3fa68 47e3fa78
[INFO][DEBUG ( 551)] 47e3fa6c 8111e470 /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[INFO][DEBUG ( 551)] 47e3fa70 00118c98 [heap]
[INFO][DEBUG ( 551)] 47e3fa74 4503ad70 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
[INFO][DEBUG ( 551)] 47e3fa78 47e3faa7
[INFO][DEBUG ( 551)] 47e3fa7c 002982e8 [heap]
[INFO][DEBUG ( 551)] 47e3fa80 574ef695
[INFO][DEBUG ( 551)] 47e3fa84 00118c98 [heap]
[INFO][DEBUG ( 551)] 47e3fa88 47e3fb18
[INFO][DEBUG ( 551)] 47e3fa8c 47e3fb20
[INFO][DEBUG ( 551)] 47e3fa90 47e3fb80
[INFO][DEBUG ( 551)] 47e3fa94 8107047d /data/data/com.slingride.slingrider/lib/libkroll-v8.so
[WARN][TiAnalyticsSvc( 656)] (Thread-17) [9639,21079] Analytics Service Started
[INFO][DEBUG ( 551)] debuggerd committing suicide to free the zombie!
[INFO][DEBUG ( 674)] debuggerd: Jun 30 2010 14:39:19
[INFO][ActivityManager( 79)] Process com.slingride.slingrider (pid 656) has died.
[WARN][ActivityManager( 79)] Scheduling restart of crashed service com.slingride.slingrider/org.appcelerator.titanium.analytics.TiAnalyticsService in 5000ms
[INFO][WindowManager( 79)] WIN DEATH: Window{450604d0 com.slingride.slingrider/com.slingride.slingrider.SlingrideActivity paused=false}
[INFO][WindowManager( 79)] WIN DEATH: Window{450635e8 com.slingride.slingrider/ti.modules.titanium.ui.TiTabActivity paused=false}
[INFO][ActivityManager( 79)] Start proc com.slingride.slingrider for activity com.slingride.slingrider/.SlingrideActivity: pid=675 uid=10041 gids={1015, 3003}
[INFO][UsageStats( 79)] Unexpected resume of com.slingride.slingrider while already resumed in com.slingride.slingrider
[INFO][TiApplication( 675)] (main) [0,0] checkpoint, app created.
[INFO][TiApplication( 675)] (main) [849,849] Titanium 2.1.2 (2012/08/24 14:46 ed7f777)
[INFO][TiApplication( 675)] (main) [1533,2382] Titanium Javascript runtime: v8
[INFO][TiRootActivity( 675)] (main) [0,0] checkpoint, on root activity create, savedInstanceState: Bundle[mParcelledData.dataSize=204]
[ERROR][TiApplication( 675)] (KrollRuntimeThread) [5002,5002] APP PROXY: ti.modules.titanium.app.AppModule@44f39db0
[WARN][ActivityManager( 79)] Activity idle timeout for HistoryRecord{450a3948 com.slingride.slingrider/.SlingrideActivity}
[INFO][TiAPI ( 675)] Welcome to SlingRider for android
[INFO][ActivityManager( 79)] Starting activity: Intent { cmp=com.slingride.slingrider/ti.modules.titanium.ui.TiTabActivity (has extras) }
[INFO][TiRootActivity( 675)] (main) [1,1] checkpoint, on root activity resume. activity = com.slingride.slingrider.SlingrideActivity@44f3eef8
[WARN][ActivityManager( 79)] Activity pause timeout for HistoryRecord{450a3948 com.slingride.slingrider/.SlingrideActivity}
[WARN][TiAnalyticsSvc( 675)] (Thread-11) [217,218] Analytics Service Started
[WARN][TiTabActivity( 675)] (main) [682,900] Notifying TiTabGroup, activity is created
[WARN][TiDrawableReference( 675)] (main) [440,1340] Could not open stream to get bitmap
Your Answer
Think you can help? Login to answer this question!