mardi 24 mars 2015

custom marker blank screen on some android device [on hold]


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.Earlier when i was using default marker it was running beautifully but when i switched to default marker it started giving me problem on HTC wildfire.but still map is running good.


my custom marker xml file is below :



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
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 user it is working like great but for some phone (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 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?





Aucun commentaire:

Enregistrer un commentaire