2013-07-02 2 views
0

모바일지도에서 저장된지도 타일을 SD 카드 대신 프로젝트에 추가 할 수 있습니까?앱 프로젝트에서 OSM 맵 타일 저장

내가 공개 할 앱에서지도 타일을 사용하고 싶습니다. 그것은 안드로이드 마켓에서 무료 응용 프로그램입니다.

지도 타일은 4 개의 zip 파일로 나뉘어 있습니다. 프로젝트 파일에서지도 타일을 사용하고 사용하거나 온라인 서버를 다운로드해야합니다.

어떤 도움을

파일을 저장 한 다음 개인 응용 프로그램 데이터 디렉토리에 복사하는 자산 폴더를 사용하는 것입니다 당신에게

답변

0

하나의 옵션을 감사 좋은 것입니다. 이런 식으로하면 효과가 있습니다. 이렇게하면 데이터베이스가 복사되지만 zip 파일을 복사 할 수 있습니다.

/** 
* Copies your database from your local assets-folder to the just created empty database in the 
* system folder, from where it can be accessed and handled. This is done by transfering 
* bytestream. 
* */ 
private void copyDataBase() throws IOException { 

    // Open your local db as the input stream 
    InputStream myInput = mContext.getAssets().open(DB_NAME); 

    // Path to the just created empty db 
    String outFileName = DB_PATH.toString(); 
    // boolean success = DB_PATH.mkdirs(); 

    // Open the empty db as the output stream 
    OutputStream myOutput = new FileOutputStream(outFileName); 

    // transfer bytes from the inputfile to the outputfile 
    byte[] buffer = new byte[1024]; 
    int length; 
    while ((length = myInput.read(buffer)) > 0) { 
     myOutput.write(buffer, 0, length); 
    } 

    // Close the streams 
    myOutput.flush(); 
    myOutput.close(); 
    myInput.close(); 

}