Android : How to save markers in a file

on Sunday, October 12, 2014


hello i want save my added markers (LatLng Point,name,subname,icon) in a .text file


onPause i want save all markers in markers.txt





@Override
public void onPause() {
}



onResume i want load markers.txt





@Override
public void onResume() {

}



i had test with json but always have some errors


Have you any idea how to save the markers in a file with all the option "LatLngPoint-Name-SubName-Icon" ?


Can this be done?





public class MainActivity extends FragmentActivity implements
OnMapLongClickListener {

final int RQS_GooglePlayServices = 1;
private GoogleMap Map;
Location myLocation;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
.findFragmentById(R.id.map);

Map = mySupportMapFragment.getMap();

Map.setMyLocationEnabled(true);

Map.setMapType(GoogleMap.MAP_TYPE_HYBRID);

Map.setOnMapLongClickListener(this);

}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}




@Override
public void onMapLongClick(LatLng point) {
Map.addMarker(new MarkerOptions()
.position(point)
.title("Name")
.snipet("SubName")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
}

@Override
public void onPause() {


}

@Override
public void onResume() {

}


}



0 comments:

Post a Comment