You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Customized marker disappeared after running for a while. #4189
[Android] I use MapboxGLAndroidSDK and I need to update a customized marker every 100ms to change its position and orientation. The orientation is changed by rotating the bitmap. And I use Mapview.setPosition(currentlocation), Mapview.setIcon(icon). But the marker will disappear after running 2-3mins and get no warning or error in the logcat. If I comment Mapview.setIcon(icon) (no orientation change), the marker won't disappear. Is there a way that I can updating both position and orientation?
IconFactory mIconFactory = IconFactory.getInstance(getApplicationContext());
BitmapFactory.Options options = new BitmapFactory.Options();
public void setOptions(BitmapFactory.Options options) {
this.options = options;
this.options.inDither = false;
this.options.inTempStorage = new byte[18 * 23];
}
@tobrun I tried 4.0.0 version, but the marker still disappears after several minutes. I update marker in the AsyncTask, and I continually get this info in the logcat:
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2499'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2519'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2519'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2520'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2520'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2522'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2522'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2620'
I/mbgl: {Worker}[Sprite]: Can't find sprite named 'com.mapbox.icons.icon_2620'
@Zeshengx
The SNAPHOT is being build daily from master so it's logical you are seeing the same result.
Related to the issue:
You are constantly creating new icons and after a couple of minutes you are (probably) running into a OutOfMemory exception. Having trouble creating and loading in 2620 bitmaps is a typical issue with Android development. Google has dedicated whole pages to this subject.
Workaround for now:
Load 8 icons into memory, one for each direction (eg. N, NE, E, SE, S, SW, W, NW) and use those fixed set of icons instead of constantly creating new ones. If needed you could increase this icon set to achieve a better animation.
In future releases:
Just to be clear, we don't support this feature at this time but proposed hack above should work. For future releases we are thinking about supporting rotation as a dynamic marker attribute. With this implemented you can reuse the same bitmap over and over again.
I'm going to close this in favour of feature request in #4207.
Reach out if you have any other questions.
Activity
tobrun commentedon Mar 4, 2016
@Zeshengx
which version of the SDK are you using?
I wanted to point out that the
4.0.0version of the SDK will improve the updating dynamic markers.You can already test this functionality out in the the related SNAPSHOT.
For installation instructions see https://www.mapbox.com/android-sdk/#gradle
Zeshengx commentedon Mar 4, 2016
@tobrun
I clone the source code from mapbox-gl-native
masterbranch, I am not sure which version is. I will try the SNAPSHOT version, thanks.Zeshengx commentedon Mar 4, 2016
@tobrun I tried
4.0.0version, but the marker still disappears after several minutes. I update marker in theAsyncTask, and I continually get this info in the logcat:tobrun commentedon Mar 5, 2016
@Zeshengx
The
SNAPHOTis being build daily from master so it's logical you are seeing the same result.Related to the issue:
You are constantly creating new icons and after a couple of minutes you are (probably) running into a
OutOfMemoryexception. Having trouble creating and loading in2620bitmaps is a typical issue with Android development. Google has dedicated whole pages to this subject.Workaround for now:
Load 8 icons into memory, one for each direction (eg. N, NE, E, SE, S, SW, W, NW) and use those fixed set of icons instead of constantly creating new ones. If needed you could increase this icon set to achieve a better animation.
In future releases:
Just to be clear, we don't support this feature at this time but proposed hack above should work. For future releases we are thinking about supporting
rotationas a dynamic marker attribute. With this implemented you can reuse the same bitmap over and over again.I'm going to close this in favour of feature request in #4207.
Reach out if you have any other questions.
chandreshandroid commentedon May 11, 2017
i am getting same issue in version 5.0
KuboStraka commentedon May 25, 2017
Hi, @chandreshandroid
Have you resolved this issue please? Because I am getting it also.