About Monkey 2 › Forums › Monkey 2 Programming Help › File banana
This topic contains 9 replies, has 2 voices, and was last updated by
Gwenel
8 months, 2 weeks ago.
-
AuthorPosts
-
July 20, 2018 at 7:59 am #15089
I could really use some help I’m trying to load the first line of text in Level/Scores.txt sdcard into a one-dimensional array of character, is there no Banana for that? I don’ want to use internal files a tthis point because I need it to be a separate file right now.
July 23, 2018 at 3:51 pm #15122Please paste your code here and describe where do you have problems.
July 25, 2018 at 11:36 am #15150I am learning Monkey2 going from desktop now to tablets i reliase I need to understand how save textfile on Androids sdcard. Is it possible? I just need the smallest banana how to do such a thing and i can learn from that i think.
July 25, 2018 at 11:56 am #15151Try to do that:
Monkey1234Local scores:="player1=100, player2=50"SaveText( scores,ExternalDir()+"/scores.txt" )Local testScores:=LoadText( ExternalDir()+"/scores.txt" )Print testScoresI have no installed android environment.
July 31, 2018 at 8:57 am #15196it didn’t work in Android in Dekstop it saved a file in Monkeys own folder (not app folder but the main monkey folder) when you take away the /
Nnothing happens in either platform with the /
Do i have to give Android permissions to write somehow?
August 1, 2018 at 6:59 am #15209The path given on my Samsung Android phones is
/storage/emulated/0/Android/data/com.monkey2.monkey2game/files/
One had sdcard inserted one has not still both gives the same path from the External command.
I don’t know where to go from here to be able to load and save onto the card, have I missed something?
August 1, 2018 at 7:06 am #15210Permissins are required, but as far as I see they already added into manifest by default:
Monkey12345<uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permission android:name="com.android.vending.BILLING" />August 1, 2018 at 6:48 pm #15224Thank you sooo much it did work i was just not looking at the right place !
I was looking at the root of the sd card but what happened was that external points to android/data/com.monkey2.monkey2game/files on the internal memory. (very much like ios does with some apps)
Also I checked that on the phones with a sdcard installed the same path is created but always empty. So external means the inbuilt memory/drive, with some special path added to match the name of the app.
This is what you get when you are new to these kind of things
August 1, 2018 at 7:03 pm #15225The next issue would be to place it correclty becuase that place was a thousand clicks away. I seriosly didn’t even knew there was such a place inside my phone called Android/data/blalbbala. But it is a great start
August 1, 2018 at 7:16 pm #15226I made a list for anyone who might want to load and save files on the Android.
On the left is the name,on the right you see the path to put in your Monkeycode.
My files /All files = /storage/emulated/0/ (path here continues with Downloads, Playlists, Pictures etc)
Images = /storage/emulated/0/DCIM/Camera
Videos = same as above
Music = /storage/emulated/0/Music
Documents = /storage/emulated/0/Documents
Default Monkey2 (Externaldir command) = /storage/emulated/0/Android/data/com.monkey2.monkey2game
So,
device storage = /storage/emulated/0
SD memory card = /storage/extSdCard
This probably changes from models and versions but its good facts to begin an understanding how it works.
-
AuthorPosts
You must be logged in to reply to this topic.