Objective- I want to show slide shows of different Map Activities which show data according to database, using view flipper(or something similar).
Issues:
View Flipper can't be added to an Activity that is not a MapActivity if flipper contains a mapview.
View Flipper does not allows adding multiple mapviews as one MapActivity can have only one map view.
What I wish to implement
- Want to show slide show of multiple MapActivities which show markers,route etc based on database data.
- Want to refresh these MapActivities also new data is fetched periodically and database is updated.
I'am unable to find a solution to my problem. I have gone through the following links but they provided no relevant solution:
How can i Implement SlideShow in android?
Can a MapView be placed inside a ViewFlipper somehow?
Please help and suggest what is the best approach for this problem.
Thanks!
I did not find standard solution to my problem as view flipper could not be used.I did the following to implement mapview slide show. Its more of a hack than a proper solution but I had no choice.
- In a while loop, I kept re-rendering the same map view in the async map task.
2.After 1st map is loaded I called thread.sleep(10000).
3.I cleared the mapview of all routes and markers.
4.I re rendered the 2nd map view.
5.And the steps were repeated continuously.
@Override
protected Void doInBackground(Void... params) {
final Drawable marker_inBetween;
marker_inBetween = getResources().getDrawable(R.drawable.blue_pin);
marker_inBetween.setBounds(0, 0,
marker_inBetween.getIntrinsicWidth(),
marker_inBetween.getIntrinsicHeight());
helper = new DbHelper(getApplicationContext());
// show slide show
while (true) {
ArrayList<String> IdList =showAllPeopleOnMap();
util.haveASleep(slideShowInterval);
showEachPersonRouteOnMap(IdList);
resetVariables();//resets lists,routes,removes markers etc
}
}
return null;
}
Thanks.