codingdir logo sitemap sitemap |
Home
PHP
C#
C++
ANDROID
JAVA
JAVASCRIPT
PYTHON

Google Map custom Marker Out of Memory Error (API V2)


By : , Category : android

You are trying to put 4 Mpix image as a marker icon. That doesn't seem like a good idea.

Load it as a Bitmap, scaling it down to reasonable size.

ReLated :

Here is how far I've gotten. Google Maps API adds a CSS Keyframe snippet on the page from inside of http://maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/14/4/%7Bcommon,map,util,marker%7D.js

inside the page it looks something like this

@-webkit-keyframes _gm2657 {
0 % {
    -webkit-transform: translate3d(0px, 0px, 0); -webkit-animation-timing-function: ease-out;
}
50 % {
    -webkit-transform: translate3d(0px, -20px, 0); -webkit-animation-timing-function: ease-in ;
}
100 % {
    -webkit-transform: translate3d(0px, 0px, 0); -webkit-animation-timing-function: ease-out;
}

}

The function in there is compressed to

function uJ(a, b) {
var c = [];
c[A]("@-webkit-keyframes ", b, " {\n");
K(a.b, function (a) {
    c[A](100 * a[$k], "% { ");
    c[A]("-webkit-transform: translate3d(", a[Fv][0], "px,", a[Fv][1], "px,0); ");
    c[A]("-webkit-animation-timing-function: ", a.wa, "; ");
    c[A]("}\n")
});
c[A]("}\n");
return c[Mc]("")
}

I can't dig through that any more right now to figure out how to hack into that object.

The trouble is that I don't know how they build that keyframe animation name. I've gotten as far as a.d="_gm"+l[B](1E4*l[Qb]()) from the file above, but good luck tracking that one back up to what l[B] is or what object 1E4*l equates to, or how Qb is defined.

My next route would be to scrape the HTML for script tags containing @-webkit-keyframes _gm and see about extracting the number used, then using it to write your own keyframe animation, and hope that google maps uses your injected CSS instead of its own.

Along those lines I wrote a little jQuery method to search for all divs with a style attribute partially matching "_gm".

var poll;
var ntrvl = setInterval(function () {
    poll = $("div[style*=' _gm']");
    if (poll.length > 0) {
        craftNewAnimation(poll.css('-webkit-animation-name'));
        clearInterval(ntrvl);
    }

}, 10);

function craftNewAnimation(name) {
    console.log(name);
    var markup = ['<style>',
        '@-webkit-keyframes ' + name + ' {',
        '0%{ opacity: 0; }',
        '100%{ opacity: 1; }',
        '}',
        '</style'
    ];
    $('body').append(markup.join(""));
}

http://jsbin.com/uJAdaJA/3/edit

It doesn't replace the first one it detect's animation for some reason. And there might be other ways to get that magic keyframe-name without so much hacking.

Good luck.

google.maps.SymbolPath class sample usage;

var marker = new google.maps.Marker({
    position: map.getCenter(),
    icon: {
      path: google.maps.SymbolPath.CIRCLE,
      scale: 10
    },
    draggable: true,
    map: map
  });

== is a reference comparison. It checks to see if the objects point to the same reference. .equals() evaluates to the comparison of values in the object.

You can find more details about the linkage to problem views in the following tutorial. http://www.eclipse.org/articles/Article-Mark%20My%20Words/mark-my-words.html

Comments


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © codingdir.com All Rights Reserved .