지도를 표시하는 데 Maps API를 사용하는 아주 기본적인 응용 프로그램을 가지고 있으며, 길게 누르면 해당 위치에 마커가 내려갑니다. 다른 위치를 선택하면 현재 마커가 삭제되고 새 마커가 만들어집니다.안드로이드에 소량의 데이터를 저장하는 가장 좋은 방법
응용 프로그램이 내가 원하는 순간에 작업을 수행하지만 응용 프로그램을 닫은 후에도 데이터가 지속되도록 할 수 있습니다.
이 내가 현재 할 노력하고있어 무엇 : 응용 프로그램이
String filename = "userLatLng";
FileOutputStream outputStream;
try {
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(Integer.parseInt(yayaParking.toString()));
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
는 데이터를 저장하는 방법을해야 그 시작 후 데이터를 읽는 데 사용되는
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
BufferedReader reader;
try {
final InputStream file = getAssets().open("userLatLng");
reader = new BufferedReader(new InputStreamReader(file));
String line = reader.readLine();
line = reader.readLine();
System.out.print("Getting Data");
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
. 나는이 일을 아직하지 못했기 때문에 어떤 도움을 주시면 감사하겠습니다!
공유 환경 설정에 저장 https://developer.android.com/training/basics/data-storage/shared-preferences.html –