Permalink
Browse files

Added permission for card write access

  • Loading branch information...
1 parent cdc5018 commit ee62b5897bee4853259befc18e81c1bb924b5175 @trurlo committed Sep 17, 2011
Showing with 10 additions and 2 deletions.
  1. +1 −0 AndroidManifest.xml
  2. +9 −2 src/net/trurlo/PimSRS/PimSRS.java
View
@@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PimSRS"
@@ -203,10 +203,14 @@ protected void toggleAutoPlay() {
}
private boolean copyFile(String src, String dst){
+ Log.d("PimSRS","copying file");
File srcFile = new File(src);
+ Log.d("PimSRS"," src: "+src);
File dstFile = new File(dst);
+ Log.d("PimSRS"," dst: "+dst);
if (srcFile.exists()){
try {
+ Log.d("PimSRS"," src exists, copying");
FileChannel srcChannel = new FileInputStream(srcFile).getChannel();
FileChannel dstChannel = new FileOutputStream(dstFile).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
@@ -215,6 +219,7 @@ private boolean copyFile(String src, String dst){
return true;
}
catch (Exception e){
+ Log.d("PimSRS"," copying error: "+e.getMessage());
return false;
}
}
@@ -237,8 +242,8 @@ private void addCurrentPair() {
String strA = String.format("[sound:%s_%03d.mp3]",currentCueFileStub,pimLines.get(currentPimLineIndex).index);
String srcFileQ = String.format("%s_%03d.mp3",currentFullCueFileStub,pimLines.get(currentPimLineIndex-1).index);
String srcFileA = String.format("%s_%03d.mp3",currentFullCueFileStub,pimLines.get(currentPimLineIndex).index);
- String dstFileQ = String.format("%s\\%s_%03d.mp3",mediaFolder.getPath(),currentCueFileStub,pimLines.get(currentPimLineIndex-1).index);
- String dstFileA = String.format("%s\\%s_%03d.mp3",mediaFolder.getPath(),currentCueFileStub,pimLines.get(currentPimLineIndex).index);
+ String dstFileQ = String.format("%s/%s_%03d.mp3",mediaFolder.getPath(),currentCueFileStub,pimLines.get(currentPimLineIndex-1).index);
+ String dstFileA = String.format("%s/%s_%03d.mp3",mediaFolder.getPath(),currentCueFileStub,pimLines.get(currentPimLineIndex).index);
String strNow = Double.toString(System.currentTimeMillis()/1000.0);
copyFile(srcFileQ,dstFileQ);
@@ -673,6 +678,7 @@ public void onClick(DialogInterface dialog, int which) {
}
private boolean readAnkiFile(String ankiFile){
+ Log.d("PimSRS","reading "+ankiFile);
if ((ankiFile == null)||(ankiFile == "")) return false;
try
{
@@ -686,6 +692,7 @@ private boolean readAnkiFile(String ankiFile){
return true;
}
catch (Exception e){
+ Log.d("PimSRS"," opening error: "+e.getMessage());
ankiFileRead = false;
txtAnkiFile.setText("(no .anki opened)");
this.ankiFileName = "";

0 comments on commit ee62b58

Please sign in to comment.