Search Results

Search found 271 results on 11 pages for 'mapview'.

Page 11/11 | < Previous Page | 7 8 9 10 11 

  • UIView Controller mysteriously getting deallocated

    - by Dan Ray
    I have a UINavigation scheme with a "welcome" page, a middle page, and a detail page. In the middle page, there's a segmented controller that can swap the main body of that page between a table, a calendar, and a MKMapView, each implemented with their own view controller classes. Today I implemented the MapView and its annotations and all of that. It's nice. And a detail disclosure on each callout takes you to the detail page just the same way as if you'd gotten there via the table. Lovely. I also have a right-button-bar button that pushes in a "search" view. From there you can search the data I'm navigating. When it's done filtering the data (an array of objects I'm keeping in a data singleton), it makes the table reload its data, and calls my annotation-clearer-and-builder methods on the map view, and then pops itself out, so the "middle" page (including whatever view was in the guts of it) is back on the screen. Problem is, if I go back and forth between the map and the search a couple times, any mention of the table view causes us to crash with: *** -[CALayer retain]: message sent to deallocated instance 0x710b810. (I obviously have NSZombies turned on.) I put an NSLog in the dealloc method of my table view controller. That thing's never getting called. I don't know if we're ditching it behind the scenes for memory purposes, or if I'm leaking it and can't get my hands back on it, or what. I'm sort of at a loss about where to look. Any hints?

    Read the article

  • Weird URL parse issue. (Android)

    - by Tarmon
    I am attempting to parse in a URL to a KML file from maps.google.com. When I try and use this link: http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=112748174025829638330.000483ad6315714cc941d&z=13&output=kml` I am unable to overlay this KML file on my MapView. If I were to take the KML file that I get from following this link and upload it to my Dropbox it will work just fine. I think there may be something about the URL from Google that it doesn't like? Link from dropbox: http://dl.dropbox.com/u/1037184/Blue_original.kml Also it would be better if we could just save these KML files locally and pass them in the same way but I can't figure out a way to do this. Here is the code I am using: Intent mapIntent = new Intent(Intent.ACTION_VIEW); Uri uri1 = Uri.parse("geo:0,0?q=http://code.google.com/apis/kml/ documentation/KML_Samples.kml"); mapIntent.setData(uri1); startActivity(Intent.createChooser(mapIntent, "Test")); The URL used in this example also works. So to recap: I am curious as to why some URLs work and others don't. Is there a way to place this KML file locally on the device and pass it to a Uri object? Any other suggestions? Thanks, Rob

    Read the article

  • Overlay only draws between first 2 points in Android

    - by LordSnoutimus
    Hi, I am experiencing an unusual error using ItemizedOverlay in Android. I am creating a GPS tracking device that plots a route between waypoints stored in a database. When I provide the first two sets of longitude and latitude points through the emulator in Eclipse, it draws a red line just how I want it, but if I send another GPS point, it animates to the point, but does not draw a line from the last point. public class MyOverlay extends ItemizedOverlay { // private Projection projection; private Paint linePaint; private Vector points; public MyOverlay(Drawable defaultMarker) { super(defaultMarker); points = new Vector<GeoPoint>(); //set colour, stroke width etc. linePaint = new Paint(); linePaint.setARGB(255, 255, 0, 0); linePaint.setStrokeWidth(3); linePaint.setDither(true); linePaint.setStyle(Style.FILL); linePaint.setAntiAlias(true); linePaint.setStrokeJoin(Paint.Join.ROUND); linePaint.setStrokeCap(Paint.Cap.ROUND); } public void addPoint(GeoPoint point) { points.addElement(point); } public void draw(Canvas canvas, MapView view, boolean shadow) { int size = points.size(); Point lastPoint = new Point(); if(size == 0) return; view.getProjection().toPixels(points.get(0), lastPoint); Point point = new Point(); for(int i = 1; i<size; i++){ view.getProjection().toPixels(points.get(i), point); canvas.drawLine(lastPoint.x, lastPoint.y, point.x, point.y, linePaint); lastPoint = point; } } @Override protected OverlayItem createItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public int size() { // TODO Auto-generated method stub return 0; } }

    Read the article

  • iphone mkmapview

    - by karthik
    Hi, This is karthik. I am developing an app using mapview in iphone. I have to use two different pins to show user locations. That two users are different type . One user is belong to some category and another one is some other category. I have to check that category and want to plot pin depend upon that category. When I try to do that, that pin is not showing properly. For a certain category it shows another pin, not what i set there. Can anyone help me? What i need is i want to load two different pins in map depend upon some category. For example , if that category is shopping mall then i have to show building image then if there is any garden i have to show some other image at a same time not one by one . I want to plot two pins with different category at the same time. For that,what could i do? I tried lot of solution , but its not showing properly. Help me?

    Read the article

  • How do I place another attribute to a MKAnnotation?

    - by kevin Mendoza
    for my app each annotation on a map corresponds to a mine locality. each mine has its own unique 7 digit integer identifier. I'm trying to add the property minesEntryNumber to the annotation so when the annotation is clicked on later I can bring up specific information on the selected annotation. This is part of my code: for (id mine in mines) { //NSLog(@"in the loop"); workingCoordinate.latitude = [[mine latitudeInitial] doubleValue]; workingCoordinate.longitude = [[mine longitudeInitial] doubleValue]; iProspectAnnotation *tempMine = [[iProspectAnnotation alloc] initWithCoordinate:workingCoordinate]; [tempMine setTitle:[mine mineName]]; tempMine.minesEntryNumber = [mine entryNumber]; //other code for dealing with mine types and adding the annotation to the mapview } the code works fine without the "tempMine.minesEntryNumber = [mine entryNumber];" part. It loads the map and shows the annotations. however when I try and put this in it brings up an error. So how do I add this property to each annotation and how do I access it later in a different .m file?

    Read the article

  • The rightCalloutAccessory button is not shown

    - by Luca
    I try to manage annotations, and to display an info button on the right of the view when a PIN get selected, my relevant code is this: - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenPin"]; if ([annotation isKindOfClass:[ManageAnnotations class]]) { static NSString* identifier = @"ManageAnnotations"; MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; if (newAnnotation==nil) { newAnnotation=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; }else { newAnnotation.annotation=annotation; } newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; newAnnotation.rightCalloutAccessoryView=[UIButton buttonWithType:UIButtonTypeInfoLight]; return newAnnotation; }else { newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; return newAnnotation; } ManageAnnotations.m : @implementation ManageAnnotations @synthesize pinColor; @synthesize storeName=_storeName; @synthesize storeAdress=_storeAdress; @synthesize coordinate=_coordinate; -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate{ if((self=[super init])){ _storeName=[storeName copy]; _storeAdress=[storeAdress copy]; _coordinate=coordinate; } return self; } -(NSString*)title{ return _storeName; } -(NSString*)subtitle{ return _storeAdress; } ManageAnnotations.h @interface ManageAnnotations : NSObject<MKAnnotation>{ NSString *_storeName; NSString *_storeAdress; CLLocationCoordinate2D _coordinate; } // @property(nonatomic,assign)MKPinAnnotationColor pinColor; @property(nonatomic, readonly, copy)NSString *storeName; @property(nonatomic, readonly, copy)NSString *storeAdress; @property(nonatomic,readonly)CLLocationCoordinate2D coordinate; // -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate; // The PINS are shown correctly on the Map, but without the info button on the right of the view. Am i missing something?

    Read the article

  • Object in Array is not recognised as having "methods"

    - by kevin Mendoza
    I got my application working Awhile back, but after completely and accidentally deleting it, I have tried to create it from square one. unfortunately my rewritten program is a bit cranky; does anyone see or know the possible sources of error? Also, my if statements are acting up. -(void)loadAnnotations { CLLocationCoordinate2D workingCoordinate; iProspectLiteAppDelegate *appDelegate = (iProspectLiteAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableArray *mines =[[NSMutableArray alloc] initWithArray:(NSMutableArray *) appDelegate.mines]; BOOL gold = [[NSUserDefaults standardUserDefaults] boolForKey:@"goldControl"]; BOOL silver = [[NSUserDefaults standardUserDefaults] boolForKey:@"silverControl"]; BOOL copper = [[NSUserDefaults standardUserDefaults] boolForKey:@"copperControl"]; for(id mine in mines) { NSLog(@"in the loop"); workingCoordinate.latitude = [[mine latitudeInitial] doubleValue]; workingCoordinate.longitude = [[mine longitudeInitial] doubleValue]; iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate]; [tempMine setTite:[mine mineName]]; if ([[mine commodity] isEqualToString:@"Gold"] && [gold == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeGold]; [mapView addAnnotation:tempMine]; } if([[mine commodity] isEqualToString:@"Silver"] && [silver == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeSilver]; } if([[mine commodity] isEqualToString:@"Copper"] && [copper == YES]) { [tempMine setAnnotationType:iProspectLiteAnnotationTypeCopper]; } } [mines dealloc]; } where the workingCoordinate.latitude = [[mine latitudeInitial] doubleValue], as well as the longitude, and [mine mineName],it says " No '-latitudeInitiallongitudeInitial' method found" or the mineName/LongitudeInitial. also, it complains about : before ] at all the if statement lines. I don't see any errors, do you?

    Read the article

  • Does anyone know why my maps only show grid

    - by NickTFried
    I've doubled checked my API key is right and that is right I doubled checked that it was correct. Here is my source and XML could anyone check to see what is wrong. Also I make sure I have internet. <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permissions.INTERNET"/> <uses-permission android:name="android.permissions.ACCESS_FINE_LOCATION"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".CadetCommand" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="RedLight"></activity> <activity android:name="PTCalculator"></activity> <activity android:name="LandNav"></activity> </application> <uses-sdk android:minSdkVersion="4"/> package edu.elon.cs.mobile; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; public class LandNav extends MapActivity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.landnav); } @Override protected boolean isRouteDisplayed() { return false; } }

    Read the article

  • Android Maps: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

    - by AP257
    I'm trying to use Android Maps, following the instructions in Hello MapView. I've added <uses-library android:name="com.google.android.maps" /> in the Manifest, and I'm building against the 'Google APIs' target, which claims to be API version 7. So I don't think I'm doing anything obviously wrong, but the project refuses to build with this error: [2010-12-22 13:34:32 - FMS]Installing FMS.apk... [2010-12-22 13:35:01 - FMS]Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2010-12-22 13:35:01 - FMS]Please check logcat output for more details. [2010-12-22 13:35:01 - FMS]Launch canceled! logcat is telling me the following (not very enlightening): D/PackageParser( 55): Scanning package: /data/app/vmdl67147.tmp I/PackageParser( 55): com.android.fms: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE E/PackageManager( 55): Package com.android.fms requires unavailable shared library com.google.android.maps; failing! W/PackageManager( 55): Package couldn't be installed in /data/app/com.android.fms.apk D/AndroidRuntime( 206): Shutting down VM It is possible I haven't set up the Maps API key correctly - when I got it using keytools, I didn't specify an alias_name, though this didn't seem to cause an error. Can anyone help?

    Read the article

  • Mapkit +closest annotation

    - by danskcollignon
    Hi all, I am trying to devellopp an app showing the nearest poi to the users location. My app is now capable of: showing a map (Mapkit) with 110 annotations and the user's location. Furthermore, I have a TableView at the bottom of my screen, to choose between the different annotations. However, they're listed by number, and not by proximity to the user's location, which is my wish. My research have led me to think that I should use CLLocation for getting the user's location. I then have really no idea on how to do it next, using getDistancefrom. My annotations are stored on SecondViewController.m, using this form: -(void)loadOurAnnotations { CLLocationCoordinate2D workingCoordinate; workingCoordinate.latitude = XX.XXXXX; workingCoordinate.longitude = XX.XXXXX; SecondViewAnnotation *POI1 = [[SecondViewAnnotation alloc] initWithCoordinate:workingCoordinate]; [POI1 setTitle:@"POI"]; [POI1 setSubtitle:@"StreetName"]; [POI1 setAnnotationType:SecondViewAnnotationTypePOI1]; [mapView addAnnotation:POI1]; , and so on to POI110. Could someone please give me a clue? I'm a total newbie! Thank you in advance for your help,

    Read the article

  • iPhone SDK: How to center map around a particular point?

    - by buzzappsoftware
    New to MapKit. Having problems centering map around a specified point. Here is the code. Not sure why this is not working. We are expecting to see a map centered around Cincinnati, OH. What we are seeing is the default google map of the world. Any help appreciated. / Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; CLLocationCoordinate2D mapCoords[2]; mapCoords[0].latitude = 39.144057; mapCoords[0].latitude = -84.505484; mapCoords[1].latitude = 39.142984; mapCoords[1].latitude = -84.502534; MKCoordinateSpan span; span.latitudeDelta = 0.2; span.longitudeDelta = 0.2; MKCoordinateRegion region; region.center = mapCoords[0]; region.span = span; [mapView setRegion:region animated:YES]; }

    Read the article

  • android use local service to refresh map UI

    - by urobo
    I don't need a strict code related answer I just need somebody to tell me what I am missing. My application has to retrieve from a web service (xmlrpc) the positions of some users I know and update their position on a MapView. So I decided to use a Service and an Activity extending MapActivity to show results. I thought about two solutions: I ) start the service and make it ask every minute for these positions and send them to the activity as a bundle via intent. (This didn't work out well, since once shown I couldn't find a method to let the activity continue refresh itself until she stop receiving intents+data from the service) II ) Incorporate a thread within the activity which starts the service via context.startService(...) every minute. And the MapUI refresh itself once the service send back an intent and stop itself. (Maybe I will fall in the same problem category as before I haven't tryied yet). I am also giving directions (via maps.google ws) in this way I'd like to refresh only users positions on the map and save the route. What Am I missing do you have any suggestions? related to activities/services internal mechanics, don't know launch modes, use broadcast receivers or intent filters? Thanks in advance

    Read the article

  • Core Data combined Query

    - by Chris Summer
    Hey, i have question related to CoreData. My iphone project has 2 Entities, Organisation and Brand with a 1 to many "BrandsToOrg" relationship and inverse. So my project has a Mapview, where you can see all the Organisations and a little subview when you click on those Organisations.At the subview there is a "show Brands" Button, which should init a new TableView who only shows the brands belong to the seleceted organisation. Any ideas how i can code that? thx NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(TitleMedium == %@)",@"Rock Antenne"];???? NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:self.entityName inManagedObjectContext:managedObjectContext]; [request setEntity:entity]; // If a predicate was passed, pass it to the query if(predicate != nil) { [request setPredicate:predicate]; } // If a sort key was passed, use it for sorting. NSString *sortKey=@"TitleMedium"; BOOL sortAscending=YES; if(sortKey != nil) { NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:sortKey ascending:sortAscending]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [request setSortDescriptors:sortDescriptors]; [sortDescriptors release]; [sortDescriptor release]; } NSError *error; NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; [request release]; [self setEntityArray:mutableFetchResults];

    Read the article

  • ASIHttpRequest problems. "unrecognized selector sent to instance"

    - by Paul Peelen
    Hi, I am experiencing problems using ASIHttpRequst. This is the error I get: 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890 2010-04-11 20:47:08.176 citybikesPlus[5885:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[CALayer rackDone:]: unrecognized selector sent to instance 0x464a890' 2010-04-11 20:47:08.176 citybikesPlus[5885:207] Stack: ( 33936475, 2546353417, 34318395, 33887862, 33740482, 126399, 445238, 33720545, 33717320, 40085013, 40085210, 3108783, 11168, 11022 ) And this is my code (Part of it): // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [image setImage:[UIImage imageNamed:@"bullet_rack.png"]]; BikeAnnotation *bike = [[annotationView annotation] retain]; bike._sub = @""; [super viewDidLoad]; NSString *newUrl = [[NSString alloc] initWithFormat:rackUrl, bike._id]; NSString *fetchUrl = [newUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [networkQueue cancelAllOperations]; [networkQueue setRequestDidFinishSelector:@selector(rackDone:)]; [networkQueue setRequestDidFailSelector:@selector(processFailed:)]; [networkQueue setDelegate:self]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:fetchUrl]] retain]; [request setDefaultResponseEncoding:NSUTF8StringEncoding]; [networkQueue addOperation:request]; [networkQueue go]; } - (void)rackDone:(ASIHTTPRequest *)request { NSString *resultSearch = [request responseString]; NSData *data = [resultSearch dataUsingEncoding:NSUTF8StringEncoding]; NSString *errorDesc = nil; NSPropertyListFormat format; NSDictionary * dict = (NSDictionary*)[NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc]; rackXmlResult* fileResult = [[[rackXmlResult alloc] initWithDictionary:dict] autorelease]; rackXmlSet *rackSet = [fileResult getRackResult]; NSString *subString = [[NSString alloc] initWithFormat:@"Cyklar tillgängligt: %@ -- Lediga platser: %@", rackSet._ready_bikes, rackSet._empty_locks]; [activity setHidden:YES]; [image setHidden:NO]; BikeAnnotation *bike = [annotationView annotation]; bike._sub = subString; } - (void) processFailed:(ASIHTTPRequest *)request { UIAlertView *errorView; NSError *error = [request error]; NSString *errorString = [error localizedDescription]; errorView = [[UIAlertView alloc] initWithTitle: NSLocalizedString(@"Network error", @"Network error") message: errorString delegate: self cancelButtonTitle: NSLocalizedString(@"Close", @"Network error") otherButtonTitles: nil]; [errorView show]; [errorView autorelease]; } The process is loaded as LeftCalloutView in the callout bubble when annotations are loaded in my mapview, so quite a lot (80 times or so). It is meant to retrieve a XML Plist from a server, parse it and use the data... but it dies at the rackDone: Does anybody have any ideas? Regards, Paul Peelen

    Read the article

  • MKMap showing detail of annotations

    - by yeohchan
    I have encountered a problem of populating the description for each annotation. Each annotation works, but there is somehow an area when trying to click on it. Here is the code. the one in bold is the one that has the problem. -(void)viewDidLoad{ FlickrFetcher *fetcher=[FlickrFetcher sharedInstance]; NSArray *rec=[fetcher recentGeoTaggedPhotos]; for(NSDictionary *dic in rec){ NSLog(@"%@",dic); NSDictionary *string = [fetcher locationForPhotoID:[dic objectForKey:@"id"]]; double latitude = [[string objectForKey:@"latitude"] doubleValue]; double longitude = [[string objectForKey:@"longitude"]doubleValue]; if(latitude !=0 && latitude != 0 ){ CLLocationCoordinate2D coordinate1 = { latitude,longitude }; **NSDictionary *adress=[NSDictionary dictionaryWithObjectsAndKeys:[dic objectForKey:@"owner"],[dic objectForKey:@"title"],nil];** MKPlacemark *anArea=[[MKPlacemark alloc]initWithCoordinate:coordinate1 addressDictionary:adress]; [mapView addAnnotation:anArea]; } } } Here is what the Flickr class does: #import <Foundation/Foundation.h> #define TEST_HIGH_NETWORK_LATENCY 0 typedef enum { FlickrFetcherPhotoFormatSquare, FlickrFetcherPhotoFormatLarge } FlickrFetcherPhotoFormat; @interface FlickrFetcher : NSObject { NSManagedObjectModel *managedObjectModel; NSManagedObjectContext *managedObjectContext; NSPersistentStoreCoordinator *persistentStoreCoordinator; } // Returns the 'singleton' instance of this class + (id)sharedInstance; // // Local Database Access // // Checks to see if any database exists on disk - (BOOL)databaseExists; // Returns the NSManagedObjectContext for inserting and fetching objects into the store - (NSManagedObjectContext *)managedObjectContext; // Returns an array of objects already in the database for the given Entity Name and Predicate - (NSArray *)fetchManagedObjectsForEntity:(NSString*)entityName withPredicate:(NSPredicate*)predicate; // Returns an NSFetchedResultsController for a given Entity Name and Predicate - (NSFetchedResultsController *)fetchedResultsControllerForEntity:(NSString*)entityName withPredicate:(NSPredicate*)predicate; // // Flickr API access // NOTE: these are blocking methods that wrap the Flickr API and wait on the results of a network request // // Returns an array of Flickr photo information for photos with the given tag - (NSArray *)photosForUser:(NSString *)username; // Returns an array of the most recent geo-tagged photos - (NSArray *)recentGeoTaggedPhotos; // Returns a dictionary of user info for a given user ID. individual photos contain a user ID keyed as "owner" - (NSString *)usernameForUserID:(NSString *)userID; // Returns the photo for a given server, id and secret - (NSData *)dataForPhotoID:(NSString *)photoID fromFarm:(NSString *)farm onServer:(NSString *)server withSecret:(NSString *)secret inFormat:(FlickrFetcherPhotoFormat)format; // Returns a dictionary containing the latitue and longitude where the photo was taken (among other information) - (NSDictionary *)locationForPhotoID:(NSString *)photoID; @end

    Read the article

  • ProgressDialog does not disappear after executing dismiss, hide or cancel?

    - by Martin
    Hello, I have an Overlay extension which has 2 dialogs as private attributes - one Dialog and one ProgressDialog. After clicking on the Overlay in the MapView, the Dialog object appears. When the user clicks a button in the Dialog it disappears and the ProgressDialog is shown. Simultaneously a background task is started by notifying a running Service. When the task is done, a method (buildingLoaded) in the Overlay object is called to switch the View and to dismiss the ProgressDialog. The View is being switched, the code is being run (I checked with the debugger) but the ProgressDialog is not dismissed. I also tried hide() and cancel() methods, but nothing works. Can somebody help me? Android version is 2.2 Here is the code: public class LODOverlay extends Overlay implements OnClickListener { private Dialog overlayDialog; private ProgressDialog progressDialog; .............. @Override public void onClick(View view) { ....... final Context ctx = view.getContext(); this.progressDialog = new ProgressDialog(ctx); ListView lv = new ListView(ctx); ArrayAdapter<String> adapter = new ArrayAdapter<String>(ctx, R.layout.layerlist, names); lv.setAdapter(adapter); final LODOverlay obj = this; lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String name = ((TextView) view).getText().toString(); Intent getFloorIntent = new Intent(Map.RENDERER); getFloorIntent.putExtra("type", "onGetBuildingLayer"); getFloorIntent.putExtra("id", name); view.getContext().sendBroadcast(getFloorIntent); overlayDialog.dismiss(); obj.waitingForLayer = name; progressDialog.show(ctx, "Loading...", "Wait!!!"); } }); ....... } public void buildingLoaded(String id) { if (null != this.progressDialog) { if (id.equals(this.waitingForLayer)) { this.progressDialog.hide(); this.progressDialog.dismiss(); ............ Map.flipper.showNext(); // changes the view } } } }

    Read the article

  • populate CoreData data model from JSON files prior to app start

    - by johannes_d
    I am creating an iPad App that displays data I got from an API in JSON format. My Core Data model has several entities(Countries, Events, Talks, ...). For each entity I have one .json file that contains all instances of the entity and its attributes as well as its relationships. I would like to populate my Core Data data model with these entities before the start of the App (otherwise it takes about 15 minutes for the iPad to create all the instances of the entities from the several JSON files using factory methods). I am currently importing the data into CoreData like this: -(void)fetchDataIntoDocument:(UIManagedDocument *)document { dispatch_queue_t dataQ = dispatch_queue_create("Data import", NULL); dispatch_async(dataQ, ^{ //Fetching data from application bundle NSURL *tedxgroupsurl = [[NSBundle mainBundle] URLForResource:@"contries" withExtension:@"json"]; NSURL *tedxeventsurl = [[NSBundle mainBundle] URLForResource:@"events" withExtension:@"json"]; //converting the JSON files to NSDictionaries NSError *error = nil; NSDictionary *countries = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:countriesurl] options:kNilOptions error:&error]; countries = [countries objectForKey:@"countries"]; NSDictionary *events = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:eventsurl] options:kNilOptions error:&error]; events = [events objectForKey:@"events"]; //creating entities using factory methods in NSManagedObject Subclasses (Country / Event) [document.managedObjectContext performBlock:^{ NSLog(@"creating countries"); for (NSDictionary *country in countries) { [Country countryWithCountryInfo:country inManagedObjectContext:document.managedObjectContext]; //creating Country entities } NSLog(@"creating events"); for (NSDictionary *event in events) { [Event eventWithEventInfo:event inManagedObjectContext:document.managedObjectContext]; // creating Event entities } NSLog(@"done creating, saving document"); [document saveToURL:document.fileURL forSaveOperation:UIDocumentSaveForOverwriting completionHandler:NULL]; }]; }); dispatch_release(dataQ); } This combines the different JSON files into one UIManagedDocument which i can then perform fetchRequests on to populate tableViews, mapView, etc. I'm looking for a way to create this document outside my application & add it to the mainBundle. Then I could copy it once to the apps DocumentsDirectory and be able I use it (instead of creating the Document within the app from the original JSON files). Any help is appreciated!

    Read the article

  • Application stopped unexpectedly at launch

    - by Chris Stryker
    I've run this on a device and on the emulator. The app stops unexpectedly on both. I have not a clue what is wrong currently. It uses Google API Maps I compiled with Google Api 7. I followed this tutorial http://developer.android.com/guide/tutorials/views/hello-mapview.html (made some alterations clearly) I did use the correct API Key That the final apk is signed with This is the source(If you compile it shouldn't work as it is unsigned) This is the compiled signed apk Log 03-21 00:30:38.912: INFO/ActivityManager(54): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.chris.stryker.worldly/.com.poppoob.WorldlyMap } 03-21 00:30:39.173: INFO/ActivityManager(54): Start proc com.chris.stryker.worldly for activity com.chris.stryker.worldly/.com.poppoob.WorldlyMap: pid=287 uid=10031 gids={3003, 1015} 03-21 00:30:39.532: DEBUG/ddm-heap(287): Got feature list request 03-21 00:30:40.185: WARN/dalvikvm(287): Unable to resolve superclass of Lcom/chris/stryker/worldly/com/poppoob/WorldlyMap; (17) 03-21 00:30:40.193: WARN/dalvikvm(287): Link of class 'Lcom/chris/stryker/worldly/com/poppoob/WorldlyMap;' failed 03-21 00:30:40.205: DEBUG/AndroidRuntime(287): Shutting down VM 03-21 00:30:40.223: WARN/dalvikvm(287): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 03-21 00:30:40.223: ERROR/AndroidRuntime(287): Uncaught handler: thread main exiting due to uncaught exception 03-21 00:30:40.252: ERROR/AndroidRuntime(287): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.chris.stryker.worldly/com.chris.stryker.worldly.com.poppoob.WorldlyMap}: java.lang.ClassNotFoundException: com.chris.stryker.worldly.com.poppoob.WorldlyMap in loader dalvik.system.PathClassLoader@45a13938 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.os.Handler.dispatchMessage(Handler.java:99) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.os.Looper.loop(Looper.java:123) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread.main(ActivityThread.java:4363) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at java.lang.reflect.Method.invokeNative(Native Method) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at java.lang.reflect.Method.invoke(Method.java:521) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at dalvik.system.NativeStart.main(Native Method) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): Caused by: java.lang.ClassNotFoundException: com.chris.stryker.worldly.com.poppoob.WorldlyMap in loader dalvik.system.PathClassLoader@45a13938 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409) 03-21 00:30:40.252: ERROR/AndroidRuntime(287): ... 11 more 03-21 00:30:40.300: INFO/Process(54): Sending signal. PID: 287 SIG: 3 03-21 00:30:40.312: INFO/dalvikvm(287): threadid=7: reacting to signal 3 03-21 00:30:40.396: INFO/dalvikvm(287): Wrote stack trace to '/data/anr/traces.txt' 03-21 00:30:49.002: WARN/ActivityManager(54): Launch timeout has expired, giving up wake lock! 03-21 00:30:49.685: WARN/ActivityManager(54): Activity idle timeout for HistoryRecord{458ab6d0 com.chris.stryker.worldly/.com.poppoob.WorldlyMap}

    Read the article

  • Xcode/iPhone Development 6 months in - Annoyances

    - by clearbrian
    Hi I've been iPhone programming for 6 months and come from a PC/Java/Eclipse background and still have a few annoyances with Xcode/iPhone programming I wonder are there any shortcuts to. Is there any way to prevent multiple windows opening all the time in XCode? a) When you click on the Errors/Warnings in the bottom right of the status bar build errors are shown in separate window. Any way to get these to show in the main editor? b) Anyway to get debugger to appear in main editor. I have a big screen iMac and it's still window hell on Macs. When you come from Alt-Tab the Mac is a nightmare. 2) Anyway to get a toolbar item on the main editor to: a) Open Console (I know CMD-thingy-R) b) Open Break points (you have to open Debugger first then breakpoints) I know there's keyboard shortcuts but I have only left hand free others on the trackball so any keys on right hand side of keyboard are too far. I know you can add Finder toolbar scripts (just wondering if anyway to extend Xcode). Are there utilities to extend Xcode? Scripts/Automator/Any Services I can setup to help. Can you automate Xcode like you can with Windows/ActiveX/VBA 3) Limit lookups using CMD + double click. If I double click on a variable to find its definition using CMD + double click it shows every occurrence of all variables with that name. (annoying it you name all you maps mapView) Anyway to get it to limit to the current class or at least order so current class is first. 4) Find doesn't seem to loop backwards if result all above cursor position I'm in a class and I hit CMD + F for find. Find box appears. I enter some text hit return. It says I have x matches but only back arrow is highlight in Find But when I hit < it does nothing. I need to scroll to the top and redo the search. If the text is both forwards and backwards then both < are highlighted and it works. is this a bug or a 'feature' Missing Eclipse features I have been looking at the User Script menu but was wondering how powerful they are? 5) any scripts around to generate source from members such as description: @property @synthesize if I add a new member, run a script will generate @property/@syntesize and release in dealloc 7) any good sites for scripts? SCM Im having problems with SCM and Folders on HD under project Classes directory. You get a library e.g. JSON. It usually comes as a folder. You copy it to the /Classes for your project. /Classes/JSON I create a Group for the Library in Xcode under Classes group. Classes JSON I drag the files from the folder into xcode into the JSON Group. I add them to the SCM and icon changes from ? to A but if I try and commit them it say folder /JSON is not under SCM. Can you drag a folder into Xcode so that it AND its files get included in SCM? Anyway to stop Xcode Help from being on top all the time. I keep feeling like punching it and telling it to get out of the way! :) I dont mind it open just not in the way once I've finished. Yes I know I can Ctrl-W Sites: the main site I use to learn Obj-C are : stackoverflow.com Google code Search - tonnes of full apps on here http://www.iphonedevsdk.com/forum/iphone-sdk-development/ Apple Developers Forums (anyway to get RSS feed to these or is that blasphemy :) ) Safari - 100s of IT book though prob too many to keep up :) any others? Any site that gives simple examples for Obj-C/ UIKit The docs just show the methods but actual examples (Google code search has helped a lot here)

    Read the article

  • android get duration from maps.google.com directions

    - by urobo
    At the moment I am using this code to inquire google maps for directions from an address to another one, then I simply draw it on a mapview from its GeometryCollection. But yet this isn't enough I need also to extract the total expected duration from the kml. can someone give a little sample code to help me? thanks StringBuilder urlString = new StringBuilder(); urlString.append("http://maps.google.com/maps?f=d&hl=en"); urlString.append("&saddr=");//from urlString.append( Double.toString((double)src.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)src.getLongitudeE6()/1.0E6 )); urlString.append("&daddr=");//to urlString.append( Double.toString((double)dest.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)dest.getLongitudeE6()/1.0E6 )); urlString.append("&ie=UTF8&0&om=0&output=kml"); //Log.d("xxx","URL="+urlString.toString()); // get the kml (XML) doc. And parse it to get the coordinates(direction route). Document doc = null; HttpURLConnection urlConnection= null; URL url = null; try { url = new URL(urlString.toString()); urlConnection=(HttpURLConnection)url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.connect(); dbf = DocumentBuilderFactory.newInstance(); db = dbf.newDocumentBuilder(); doc = db.parse(urlConnection.getInputStream()); if(doc.getElementsByTagName("GeometryCollection").getLength()>0) { //String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getNodeName(); String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getFirstChild().getNodeValue() ; //Log.d("xxx","path="+ path); String[] pairs = path.split(" "); String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude lngLat[1]=latitude lngLat[2]=height // src GeoPoint startGP = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); mMapView01.getOverlays().add(new MyOverLay(startGP,startGP,1)); GeoPoint gp1; GeoPoint gp2 = startGP; for(int i=1;i<pairs.length;i++) // the last one would be crash { lngLat = pairs[i].split(","); gp1 = gp2; // watch out! For GeoPoint, first:latitude, second:longitude gp2 = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); mMapView01.getOverlays().add(new MyOverLay(gp1,gp2,2,color)); //Log.d("xxx","pair:" + pairs[i]); } mMapView01.getOverlays().add(new MyOverLay(dest,dest, 3)); // use the default color } }catch (MalformedURLException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); }catch (SAXException e){ e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } }

    Read the article

  • Problem with large number of markers on the map...

    - by bobetko
    I am working on an Android app that already exists on iPhone. In the app, there is a Map activity that has (I counted) around 800 markers in four groups marked by drawable in four different colors. Each group can be turned on or off. Information about markers I have inside List. I create a mapOverlay for each group, then I attach that overlay to the map. I strongly believe that coding part I did properly. But I will attach my code anyway... The thing is, my Nexus One can't handle map with all those markers. It takes around 15 seconds just to draw 500 markers. Then when all drawn, map is not quite smooth. It is sort of hard to zoom and navigate around. It can be done, but experience is bad and I would like to see if something can be done there. iPhone seems doesn't have problems showing all these markers. It takes roughly about 1-2 seconds to show all of them and zooming and panning is not that bad. Slow down is noticeable but still acceptable. I personally think it is no good to draw all those markers, but app is designed by somebody else and I am not supposed to make any drastic changes. I am not sure what to do here. It seems I will have to come up with different functionality, maybe use GPS location, if known, and draw only markers within some radius, or, if location not known, use center of the screen(map) and draw markers around that. I will have to have reasonable explanation for my bosses in case I make these changes. I appreciate if anybody has any idas. And the code: ... for (int m = 0; m < ArrList.size(); m++) { tName = ArrList.get(m).get("name").toString(); tId = ArrList.get(m).get("id").toString(); tLat = ArrList.get(m).get("lat").toString();; tLng = ArrList.get(m).get("lng").toString();; try { lat = Double.parseDouble(tLat); lng = Double.parseDouble(tLng); p1 = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6)); OverlayItem overlayitem = new OverlayItem(p1, tName, tId); itemizedoverlay.addOverlay(overlayitem); } catch (NumberFormatException e) { Log.d(TAG, "NumberFormatException" + e); } } mapOverlays.add(itemizedoverlay); mapView.postInvalidate(); ................................ public class HelloItemizedOverlay extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); private Context mContext; public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } @Override protected boolean onTap(int index) { final OverlayItem item = mOverlays.get(index); ... EACH MARKER WILL HAVE ONCLICK EVENT THAT WILL PRODUCE CLICABLE ... BALOON WITH MARKER'S NAME. return true; } }

    Read the article

< Previous Page | 7 8 9 10 11