I am trying to pop out an info window on the marker based on the item selected from listview. So basically when the listview item was selected, it will execute the createCallOutView():
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View item,
int position, long id) {
float x = Float.parseFloat(_eventlist.get(position).getEventX());
float y = Float.parseFloat(_eventlist.get(position).getEventY());
ENeighbourhoodActivity.callout.hide();
int[] graphicIDs = ENeighbourhoodActivity.graphicsLayer.getGraphicIDs(x, y, 25);
if (graphicIDs != null && graphicIDs.length > 0) {
Graphic gr = ENeighbourhoodActivity.graphicsLayer.getGraphic(graphicIDs[0]);
Point location = (Point) gr.getGeometry();
ENeighbourhoodActivity.callout.setOffset(0, -10);
ENeighbourhoodActivity.callout.show(location, EventInfoWindow.createCalloutView(
gr, context, userID));
}
getActivity().finish();
}
});
And in my createCallOutView(), it just basically displaying displaying the details of events. However, with theses codes, when the listview item was selected, the screen just freeze and after a while it just shows the application is not responding message and close the activity.
Any ideas? There is no error messages at all. Thanks in advance.
May be your code takes more time in Graphics part. Pt the in another thread so that main thread is not stopped.
Dont forget to use runOnUiThread when you want to update the UI