how do I get the default icon for the current user location to display it on the map? In the maps applications, it's a blue array... I'd like to have something like that, but I don't find it it android.R.drawable... How do I get this default user location icon?
Thanks a lot!
Here you can find the icons from Android 2.2, the current location icon is named ic_maps_indicator_current_position
Java Usage example: myMenuItem.setIcon(android.R.drawable.ic_menu_save);
Resource Usage example: android:icon="#android:drawable/ic_menu_save"
Note from the link above:
Some of the images in the Android jar are not public and therefore cannot be directly used (you can copy them to you own application, but can't reference them via the "android" package namespace). This project does not distinguish between what is public and what is not. If you try to use an image that is not public, you will get an error indicating that fact.
Related
I have some icons as drawable resources that I would like to put in specific locations in a MapBox map in android studio, but I donĀ“t know how.
I have tried converting my resource files into bitmaps, and then convert those bitmaps into strings so as to fill the "withIconImage" method of SymbolOptions class.(I know it works with defined strings such as "airport", "fire-station").
Can someone help me?
Thank you!
This example from the Mapbox Android documentation shows how to add a local drawable resource from an Android application to your Mapbox map as a SymbolLayer. The initSpaceStationSymbolLayer helper method specifically takes care of this:
private void initSpaceStationSymbolLayer(#NonNull Style style) {
style.addImage(
"space-station-icon-id",
BitmapFactory.decodeResource(this.getResources(), R.drawable.iss)
);
style.addSource(new GeoJsonSource("source-id"));
style.addLayer(new SymbolLayer("layer-id", "source-id").withProperties(
iconImage("space-station-icon-id"),
iconIgnorePlacement(true),
iconAllowOverlap(true),
iconSize(.7f)
));
}
You mentioned SymbolOptions, however, so it is likely the case that you are using the Mapbox Annotation Plugin for Android rather than directly adding SymbolLayers. As indicated in the documentation for the SymbolOptions#withIconImage method, icon images are specified as Strings which reference the names of images in your style's sprite sheet. This example from the Mapbox Android Plugins demo app demonstrates how to add an image from the resources folder to your style, to then be used as the icon image in a SymbolManager. Namely, ID_ICON_AIRPORT is defined as "airport" here, then the helper method addAirplaneImageToStyle here adds the relevant image to the style, and finally a Symbol is created here using SymbolOptions#withIconImage and ID_ICON_AIRPORT passed as the argument. You use this same approach for adding your own drawable image.
I'm creating an Android app using MapBox. I've already set up a simple map functionality with markers sourced from .json file. Next step is filtering the markers on the map, just like in this gl-js example here:
https://docs.mapbox.com/mapbox-gl-js/example/filter-markers/
I can't find any sdk examples anywhere, and since this is my first app I really can't figure it out on my own. Any help will be appreciated.
You can check out this example https://docs.mapbox.com/android/maps/examples/multiple-expressions-temperature-change/ that features two layers that fetch a min or max temperature from the data source and display it.
The filtering part is done here:
// Only display Maximum Temperature in this layer
maxTempLayer.setFilter(eq(get("element"), literal("All-Time Maximum Temperature")));
loadedMapStyle.addLayer(maxTempLayer);
Filters accept expressions as arguments, and here Expression.eq is used to compare "element" from the GeoJSON data source (referenced with the Expression.get) with the "All-Time Maximum Temperature" value. If it resolves to true, the feature is going to be displayed, otherwise, it's going to be hidden.
I want to simulate a drive using the SKNavigationSettings.SKNavigationType.FILE. Is there an easy way to generate one of these files? I see the Seattle.log in the demo project, and I could just edit some coordinates and make my own however it would be great to simulate a real drive. Also I am not sure what all of the entries are:
"47.655942 -122.137419, 11.000000, 19.000000, 0.000000, 1380803959889470, 03.10.2013 15:39:19" (what are 11.000000, 19.000000, 0.000000?)
Update: I still do not have a way of doing this and I do not understand some of the values (listed above). The file is Seattle.log and it just consists of a bunch of lines like the one above separated by newlines.
You can find the full SDK documentation here.
https://www.developer.skobbler.com/docs/android/3.0.2/index.html
Yes, you can obtain a logging file with data collected from a real drive. You can use the startLoggingPositions(String filePath, SPositionLoggingType positionLoggingType) and public boolean stopLoggingPositions() from the SKPositionLoggingManager class (com.skobbler.ngx.positioner.logging package) to accomplish that. You will obtain a log file (if the positionLoggingType is set to SK_POSITION_LOGGING_TYPE_LOG) similar to Seattle.log at the specified path.
The values stored in the file are (in this order): Latitude, Longitude, Course, Speed, Accuracy, Timestamp.
Using the latest version of Android Studio.
Once you type the function name and open brackets, AS would automatically display hint with variable type and name (which is really handy). But sometimes it would just disappear.
Does anyone know the keymap (shortcut) that would trigger it to pop again? (haven't found one in AS options, may be I missed one). In particular, I'd like to know the name of the corresponding shortcut so that I can find it through the Preferences screen and update the assigned keys if necessary.
The command name is "Parameter Info".
On Mac, it's assigned to Command+P by default.
On Windows, it's assigned to Ctrl+P by default.
And It's form View menu, called Parameter Info. There is the shortcut on menu.
To display a dropdown version of all the available parameters, you can use Ctrl + Space to show a dropdown list.
I am trying to enable push notifications on my application.
I have the client sample code and now i am trying to get some of the code to implement it on my application. For those of you who have already implemented push notifications on your apps i am sure you are familiar with the class GCMIntentService.
So i am copying this class on my project , i configure the Manifest correctly(or i think i do) but i get errors in the file.
The errors are in expressions like R.string."something"
For example I get errors in :
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error
R.string.gcm_recoverable_error
R.drawable.ic_stat_gcm
The error is always that gcm cannot be resolved or is not a field.
But what exactly is this expression?! Is it a class or something?
Is it something on the Manifest that I haven't configured correctly?
It are strings, probably in the example app you're using, in /res/values/strings.xml
You put strings in there to have a localized place to put your user visible Strings in, so you have
1. One place to find all your strings, if you ever want to change and/or re-use
2. Easy access to translation by putting translations in per example /res/values-de/strings.xml
Look for that file in whatever example you're using, you'll find some XML defined strings. Copy them into your own project, in the same place.
this may helps you ,define all Reuired String in your strings.xml and save
R.string.gcm_registered
R.string.gcm_message
R.string.gcm_deleted
R.string.gcm_error