0

I have implemented custom marker using google android map v2.It is running good on some device and on some device custom marker appear to be blank.my custom marker xml file is below :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

            <TextView
                android:id="@+id/markerText1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="20sp"
                android:textStyle="bold"/>

            <TextView
                android:id="@+id/markerText2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />

            <TextView
                android:id="@+id/markerText3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
            <TextView
                android:id="@+id/markerText4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/markerImage1"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:src="@drawable/ic_action_call"
            android:contentDescription="Map Info"/>
            <TextView
                android:id="@+id/markerText5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Tap Here for more."
                />
    </LinearLayout>
</LinearLayout>

And I have implemented it in java file like below :

    SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.fp_map);
    map = fm.getMap();
    if(map != null){

        map.setIndoorEnabled(false);
        map.setOnCameraChangeListener(getCameraChangeListener());
        //add custom window here
        map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
            @Override
            public View getInfoWindow(Marker marker) {
                return null;
            }

            @Override
            public View getInfoContents(Marker marker) {
                View v = null;
                try {
                    if(!marker.getTitle().equalsIgnoreCase("diff")) {
                        try {
                            v = getLayoutInflater().inflate(R.layout.info_window, null);
                            TextView title = (TextView) v.findViewById(R.id.markerText1);
                            TextView midMsg = (TextView) v.findViewById(R.id.markerText2);
                            TextView BelowMsg1 = (TextView) v.findViewById(R.id.markerText3);
                            TextView BelowMsg2 = (TextView) v.findViewById(R.id.markerText4);

                            String[] data = marker.getSnippet().split("\\|\\|");
                            title.setText(marker.getTitle());
                            midMsg.setText(data[0]);
                            BelowMsg1.setText("check here:" + data[2]);
                            BelowMsg2.setText(data[1] + "check here also");
                            return v;
                        } catch (Exception e) {
                            String error = e.getMessage();
                        }
                    } else {
                        return null; //so that normal view can be generted.
                    }
                } catch (Exception e){
                    String error1 = e.getMessage();
                    return null;
                }
                return v;
            }
        });

    }

finally I add marker like below :

BitmapDescriptor loaded_icon;
loaded_icon = BitmapDescriptorFactory.fromResource(R.drawable.smiley_f);
map.addMarker((new MarkerOptions().position(new LatLng(Double.parseDouble(data[1]), Double.parseDouble(data[2])))
                                            .title(data[0])
                                            .snippet(data[5] + "||" + data[6] + "||" + data[7])
                                            .icon(loaded_icon)))
                                            .showInfoWindow();
                         

The above add marker code is in loop so different marker can be shown to user. Now my problem is for many users, it is working like great but for some phones (Ex. HTC WILDFIRE), it is giving blank screen as marker with image which I mentioned in xml file.

I also get below error, not sure if it related to above problem or not. This error start coming way before opening page of map.

E/copybit? Error opening frame buffer errno=13 (Permission denied)

W/Adreno200-EGLSUB? <updater_create_surface_state:342>: updater_create_surface_state failed to open copybit, error: -13

Did google but did not find helpful. Please help.Thanks in advance

I tried to check openGL with below function

private boolean detectOpenGLES20() {
        ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        return (info.reqGlEsVersion >= 0x20000);
    }

And this function giving me true reply. So how to check if marker will be shown or not?

fmatt
  • 464
  • 1
  • 5
  • 15

1 Answers1

0

To use the Google Maps API v2, it require the device to be able to run OpenGL ES 2.0 or up, as it mentioned here.

However, some older phones (mainly 2.2 or before), which include HTC Wildfire, has no GPU and does not support OpenGL ES 2.0.

So this might be the reason why it fail to show up on your HTC Wildfire.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
kaho
  • 4,746
  • 1
  • 16
  • 24
  • so basically my custom marker will not be shown on HTC or same device who does not have or support GPU. is it?? or is there another way to work out. second question is if there anot other way around then how to distinguish devices who have GPU or support GPU on defferent android version. – user1435604 Mar 24 '15 at 04:32
  • I think you can open a webview to use the web api for that – kaho Mar 24 '15 at 05:58
  • ohkey..and how to distinguish devices who have GPU or support GPU on different android version. is glGetString(GL_VERSION); function is enough or need to do more check? – user1435604 Mar 24 '15 at 08:51
  • But one thing i didn't understand is ..initially map was working good with default marker and when i switched to new custom marker ..map is still working,,only custom marker's text appearing blank, but image is appearning coorectly, why is that so? it shd crash or give something as error , but it didn't show that behaviours? – user1435604 Mar 24 '15 at 10:05
  • see updated question.I checked openGL with above mentioned function and it gave me true respone.So I think it has openGL but issue is something different – user1435604 Mar 24 '15 at 13:46