Все папки, кроме этой читает. Вылетало пока не удалил файл с "Windows-1252" символом в имени.
Кодtry
{
ArrayList<String> fileStr = new ArrayList<String>();
File files = new File("/mnt/sdcard/Download/Club/");
if(files.length() > 0)
{
for(File f : files.listFiles())
{
fileStr.add(f.getAbsolutePath().toString());
}
((TextView)findViewById(R.id.textView1)).setText("Файлов: " + fileStr.size());
ListView lv = (ListView)findViewById(R.id.listView1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.item,fileStr);
lv.setAdapter(adapter);
}
}
catch (Exception ex) { }
(Приложение просто закрылось без AlertDialog)
Лог
03-09 20:33:17.739 1264-1264/core.player.app E/Trace﹕ error opening trace file: No such file or directory (2)
03-09 20:33:17.747 1264-1264/core.player.app W/dalvikvm﹕ JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xa7
03-09 20:33:17.747 1264-1264/core.player.app W/dalvikvm﹕ string: 'test�.txt'
03-09 20:33:17.747 1264-1264/core.player.app W/dalvikvm﹕ in Ljava/io/File;.listImpl:(Ljava/lang/String;)[Ljava/lang/String; (NewStringUTF)
03-09 20:33:17.795 1264-1264/core.player.app A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 1264 (core.player.app)
03-09 20:33:18.007 281-299/system_process W/ActivityManager﹕ Force removing ActivityRecord{538c6a70 core.player.app/.MainActivity}: app died, no saved state
03-09 20:33:18.015 281-376/system_process W/WindowManager﹕ Rebuild removed 3 windows but added 2
03-09 20:33:18.015 281-376/system_process W/WindowManager﹕ This window was lost: Window{538c887c Starting core.player.app paused=false}
03-09 20:33:18.015 281-376/system_process W/WindowManager﹕ mSession=Session{537cae1c uid 1000} mClient=android.view.ViewRootImpl$W@538bf394
mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=3 fl=#1830118 pfl=0x9 wanim=0x103028f}
Requested w=800 h=1184 mLayoutSeq=96
mBaseLayer=21000 mSubLayer=0 mAnimLayer=21015+0=21015 mLastLayer=21015
mToken=AppWindowToken{5394fb2c token=Token{5390b38c ActivityRecord{538c6a70 core.player.app/.MainActivity}}}
mRootToken=AppWindowToken{5394fb2c token=Token{5390b38c ActivityRecord{538c6a70 core.player.app/.MainActivity}}}
mAppToken=AppWindowToken{5394fb2c token=Token{5390b38c ActivityRecord{538c6a70 core.player.app/.MainActivity}}}
mViewVisibility=0x0 mHaveFrame=true mObscured=false
mSeq=0 mSystemUiVisibility=0x0
mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]
mConfiguration={1.0 0mcc0mnc en_US sw400dp w400dp h567dp nrml port finger qwerty/v/v dpad/v s.4}
mHasSurface=true mShownFrame=[17.285706,34.427734][817.2857,1218.4277]
mFrame=[0,0][800,1184] last=[0,0][800,1184]
mSystemDecorRect=[0,50][800,1184] last=[0,50][800,1184]
Frames: containing=[0,0][800,1184] parent=[0,0][800,1184] display=[0,0][800,1184]
content=[0,50][800,1184] visible=[0,50][800,1184]
Cur insets: content=[0,50][0,0] visible=[0,50][0,0]
Lst insets: content=[0,50][0,0] visible=[0,50][0,0]
mSurface=Surface(name=Starting core.player.app, identity=16)
mDrawState=HAS_DRAWN mLastHidden=true
Surface: shown=false layer=21015 alpha=0.964063 rect=(17.285706,34.427734) 800.0 x 1184.0
mShownAlpha=0.964063 mAlpha=1.0 mLastAlpha=0.964063
mGlobalScale=1.0 mDsDx=0.97071135 mDtDx=0.0 mDsDy=0.0 mDtDy=0.96964777
mExiting=false mRemoveOnExit=false mDestroying=true mRemoved=false
03-09 20:33:18.015 281-376/system_process W/WindowManager﹕ Current app token list:
03-09 20:33:18.015 281-376/system_process W/WindowManager﹕ Final window list:
03-09 20:33:18.023 533-533/com.android.launcher W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-09 20:33:18.027 281-623/system_process W/InputMethodManagerService﹕ Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@538c35d0 attribute=null
Если эти файлы в папке, то программа вылетает сразу, даже не успев открыться,
так видит их менеджер файлов Android
Как обезопасить программу от подобных ошибок?