public static int CopyAssets(Context context, String srcFile, String dstFile) {

        int result = COPY_SUCCESS;
        InputStream in = null;
        OutputStream out = null;
        try {

            File fi;
            if (dstFile.equals(FileUtils.getFileName(dstFile))) {
                fi = new File(context.getFilesDir(), dstFile);
            } else {
                fi = new File(dstFile);
            }

            in = context.getAssets().open(srcFile, AssetManager.ACCESS_STREAMING);

            if (fi.exists() && in.available() <= fi.length()) {
                result = COPY_DST_EXIST;
            } else {
                out = new FileOutputStream(fi);
                byte[] buffer = new byte[10240];
                int read;
                while ((read = in.read(buffer)) != -1) {
                    out.write(buffer, 0, read);
                }
                buffer = null;
            }

        } catch (IOException e) {
            Log.e(TAG, "", e);

            result = COPY_ERROR;
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            in = null;
            if (out != null) {
                try {
                    out.flush();
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            out = null;
        }

        return result;
    }
public static int CopyAssets ( Context context , String srcFile , String dstFile ) { int result = COPY_SUCCESS ; InputStream in = null ; OutputStream out = null ; try { File fi ; if ( dstFile . equals ( FileUtils . getFileName ( dstFile ) ) ) { fi = new File ( context . getFilesDir ( ) , dstFile ) ; } else { fi = new File ( dstFile ) ; } in = context . getAssets ( ) . open ( srcFile , AssetManager . ACCESS_STREAMING ) ; if ( fi . exists ( ) && in . available ( ) <= fi . length ( ) ) { result = COPY_DST_EXIST ; } else { out = new FileOutputStream ( fi ) ; byte [ ] buffer = new byte [ 10240 ] ; int read ; while ( ( read = in . read ( buffer ) ) != - 1 ) { out . write ( buffer , 0 , read ) ; } buffer = null ; } } catch ( IOException e ) { Log . e ( TAG , "" , e ) ; result = COPY_ERROR ; } finally { if ( in != null ) try { in . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } in = null ; if ( out != null ) { try { out . flush ( ) ; out . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } out = null ; } return result ; }
copy assets file to destinations.

@param context
@param srcFile source file in assets.
@param dstFile destination files, full path with folder. if folder is empty,
means copy to context's files folder.
@return {@link #COPY_SUCCESS} means success.{@link #COPY_DST_EXIST},
{@link #COPY_ERROR}