Hirdetés
- Motorola Edge 50 Neo - az egyensúly gyengesége
- Megjöttek Magyarországra a Redmi Note 15-ök, január 22-től ennyiért kaphatók
- Huawei Watch GT 3 Pro - korlátolt szépség
- Xiaomi 13T és 13T Pro - nincs tétlenkedés
- Ismét az alsó polcot bővíti a Tecno
- Milyen okostelefont vegyek?
- Android alkalmazások - szoftver kibeszélő topik
- Mobil flották
- Telekom mobilszolgáltatások
- Bemutatkozott a Poco X7 és X7 Pro
Új hozzászólás Aktív témák
-
SektorFlop
aktív tag
Sziasztok!
Már jó rég jártam itt, viszont most nagyon csúnyán elakadtam egy egyszerű dologgal. Van egy egyszerű kódom, ami lementene egy fájlt belső van külső tárhely /Android/data/... mappájába. 10 telefonból 9-en működik. A kivétel egy Huawei Y6 (Android 5.1.1, EMUI 3.1) Valakinek volt hasonló problémája? Vagy esetleg megoldást tud rá valaki?
A leegyszerűsített program rész:
public void createFile(TextView textView){
String filepath ="/storage/sdcard1/Android/data/com.example.app/route.txt";
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filepath);
byte[] buffer = "Ez lesz írva a fájlba".getBytes();
fos.write(buffer, 0, buffer.length);
fos.close();
textView.setText("Saved");
} catch (FileNotFoundException e) {
e.printStackTrace();
textView.setText(e.toString());
} catch (IOException e) {
e.printStackTrace();
textView.setText(e.toString());
}finally{
if(fos != null)
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
textView.setText(e.toString());
}
}
}Manifestben következő permissionok:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />11-08 09:18:52.442 6957-6957/com.mobilengine.filesavetest W/System.err: java.io.FileNotFoundException: /storage/sdcard1/Android/data/com.example.app/route.txt: open failed: EACCES (Permission denied)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.IoBridge.open(IoBridge.java:494)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.mobilengine.filesavetest.MainActivity.createFile(MainActivity.java:36)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.mobilengine.filesavetest.MainActivity.onCreate(MainActivity.java:27)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.Activity.performCreate(Activity.java:6102)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.access$1200(ActivityThread.java:165)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.os.Looper.loop(Looper.java:135)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5593)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.lang.reflect.Method.invoke(Native Method)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.Posix.open(Native Method)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: at libcore.io.IoBridge.open(IoBridge.java:480)
11-08 09:18:52.452 6957-6957/com.mobilengine.filesavetest W/System.err: ... 18 more
Új hozzászólás Aktív témák
- Motorola Edge 50 Neo - az egyensúly gyengesége
- Elemlámpa, zseblámpa
- Épített vízhűtés (nem kompakt) topic
- Gyúrósok ide!
- Okos Otthon / Smart Home
- Brogyi: CTEK akkumulátor töltő és másolatai
- PlayStation 5
- Google Chromecast topic
- joghurt: Megtarthatod a jogsid?
- Magga: PLEX: multimédia az egész lakásban
- További aktív témák...
- iPhone 17 256 GB Sage - Bontatlan !! www.stylebolt.hu - Apple eszközök és tartozékok !!
- ÁRGARANCIA! Épített KomPhone i5 12400F 16/32/64GB RAM RTX 3060 12GB GAMER PC termékbeszámítással
- HP ProDesk 600 G5 i3-9100 8GB 256GB 1 év garancia
- GYÖNYÖRŰ iPhone 12 Mini 128GB Purple-1 ÉV GARANCIA - Kártyafüggetlen, MS3630
- Honor 200 Lite 256GB, Kártyafüggetlen, 1 Év Garanciával
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


