Hi,
So, i solved the 80% of the problem, now when debugging i have all the path
to the settings.dat:
/data/data/acrburant.android.com/files/settings.dat
However, i'm facing a problem when writing the file to the SDCARD. I have
permission denied and SDCARD not mounted exception.
Here is the code:
05.04.2011 15:47, Alaeddine Ghribi пишет:
However, i'm facing a problem when writing the file to the SDCARD. I
have permission denied and SDCARD not mounted exception.
Here is the code:
Do you have a memory card in the phone?
If you do, make sure it's not mounted as a disk drive by your
I added this in the emulator:
-sdcard /Users/Alaeddine/Documents/workspace/android_sdcard
I verified also that the /sdcard is well mounted by the emulator, not by the
the computer.
This can not be a code problem ?
By the way, i solved the problem of settings.dat path by doing this(to all
persons
So i just have this problem to solve now. I'm trying everything, followed
this link(http://www.brighthub.com/mobile/google-android/articles/33240.aspx)
as well, and always have the problem of sdcard not mounted!I verified with
Settings-Storage and it indicated unavailable . Any idea ?
Thank you.
So i maked this:
catch(FileNotFoundException ex){
Toast.makeText(context, File Not found, Toast.LENGTH_SHORT).show();
String x=ex.getMessage();
Log.d(Carburant, x);
}
Here is the message i get:
04-04 11:07:20.851: DEBUG/Carburant(377): /alaa.peugeot.settings.dat (No
such file
A few things.
1 - For the target file, don't use SDCARD in your paths.
Environment.getExternalStorageDirectory already gives you the path to the
top-level directory (root) of the memory card.
Android 2.2 uses a path that's different from earlier versions, and you can
rely on this function to do
I really don't know what method to use! all right, i have this:
copyfile(context,data/data/
carburant.android.com/files/alaa.peugeot.settings.dat,sdCard.getAbsolutePath()
+ /Carburant/storeddata.dat);
I have to replace data/data/
carburant.android.com/files/alaa.peugeot.settings.dat by a method.
Review this:
http://developer.android.com/guide/topics/data/data-storage.html
http://developer.android.com/guide/topics/data/data-storage.htmlAnd Google
Java IO.
Once you have a better understanding of how the system deals with Files and
what you're actually trying to do it should be a lot
All the informations are here i guess! But there is not an example :( !
Plus, the examples in in the android dev site are not very clear!
Please, can you help me(i'm noob, i know :( :D!) ?
Thanks.
Accessing files on external storage
If you're using API Level 8 or greater, use
On Mon, Apr 4, 2011 at 10:54 AM, Alaeddine Ghribi alaeddineghr...@gmail.com
wrote:
All the informations are here i guess! But there is not an example
You don't need an Android example. This is all standard Java IO. AGAIN:
Google Java IO. Use the Android docs to get File objects to the right
So all this lines are false, they are not correct, all the problem come from
this lines?
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdCard.getAbsolutePath() + /Carburant/);
dir.mkdirs();
copyfile(context,nom,sdCard.getAbsolutePath() +
/Carburant/storeddata.dat);
Your question doesn't make any sense, is it that the file can't be
opened that you need help with? You can stop the debugger when you get
the error and read the message that it reports. Typically it might be
something like the file doesn't exist or that you don't have
permission to open it. Did
Why have i to open the file? I just want to copy it to the SDCARD !
I searched in the java/android docs and i don't find a method that can
return the right path to the file in the /data/data...
2011/4/4 Kristopher Micinski krismicin...@gmail.com
Your question doesn't make any sense, is it
2011/4/4 Alaeddine Ghribi alaeddineghr...@gmail.com
Why have i to open the file? I just want to copy it to the SDCARD !
You can't read or write a file without opening it.
And you can't copy a file without opening source for reading and destination
for writing.
I searched in the
I can't believe I'm still beating this dead horse.
On Mon, Apr 4, 2011 at 1:55 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
So all this lines are false, they are not correct, all the problem come
from this lines?
If those lines are throwing th exception, then yes, it would seem the
On Mon, Apr 4, 2011 at 2:04 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
I searched in the java/android docs and i don't find a method that can
return the right path to the file in the /data/data...
Your f***ing with me now right? Because not only is this clearly documented,
but I
I readed and i'm reading all this docs! i just can't find the right function
to use! you are just send links and google JAVA IO without any precision!
BUT THERE IS NO DOUBT THAT I HAVE TO THANK YOU! You are talking with me as
i'm an experiment dev, i admit it, i'm noob in the android development!
Debug your transfer() method and make sure, that all the path are
correct (e.g. no duplicated slashes) If i'm not mistaken
Environment.getExternalStorageDirectory().getAbsolutePath() returns
the slash terminated string.
Make sure that the dir is created and your context was got correctly.
Make
Help
El abr 3, 2011 10:01 p.m., Alaeddine Ghribi alaeddineghr...@gmail.com
escribió:
To be honest, i don't know how to step through the code until i get the
exception :\! F5 in the debugger?
But as you said, i have an other option that consists to put a break point
un the catch line! I'll report
Alaeddine, forums like this exist in order for people to help one
another. It's very likely you'll not get someone to review your code,
point to a line or two and tell you precisely how to fix it.
As a programmer/developer, you have to be resourceful. And this will
mean you'll have to read
On Mon, Apr 4, 2011 at 2:23 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
I readed and i'm reading all this docs! i just can't find the right
function to use! you are just send links and google JAVA IO without any
precision!
Once again, the functions to use are at the link I posted.
You have reason! Believe me i readed and i'm reading all the docs! I'll
re-see it now!And I'll well do my homework(i hope i'll succeed)!
2011/4/4 TreKing treking...@gmail.com
On Mon, Apr 4, 2011 at 2:23 PM, Alaeddine Ghribi
alaeddineghr...@gmail.com wrote:
I readed and i'm reading all this
Nothing happens when i tap in the menu option button Export !
On 3 avr, 03:54, TreKing treking...@gmail.com wrote:
On Sat, Apr 2, 2011 at 8:40 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
I have a problem in the Import class that i can't recognize it !
What does that mean?
I edited the code to a one more correct:
public class Import {
private Context context;
private String nom;
public Import(Context context,String nom) {
this.context = context;
this.nom=nom;
}
public void transfer(){
File sdCard =
I solved the half of the problem for now, however, i'm having a File
Not Found exception ! why the file is not copied ? How can i verify
the file in the SDCARD in the emulator ?
Thanks.
On 3 avr, 15:42, Alaeddine Ghribi alaeddineghr...@gmail.com wrote:
I edited the code to a one more correct:
I added a virtual SDCARD and the file is not exported ! I have a
storeddata.dat directory :\ ! Plus, i have a file not found exception
when tapping in the menu option export !
Any idea ?
On 3 avr, 16:06, Alaeddine Ghribi alaeddineghr...@gmail.com wrote:
I solved the half of the problem for now,
I think you are not creating a directory for the target file. Look up
File.mkdir and mkdirs.
03.04.2011 19:40 пользователь Alaeddine Ghribi alaeddineghr...@gmail.com
написал:
I added a virtual SDCARD and the file is not exported ! I have a
storeddata.dat directory :\ ! Plus, i have a file not
The directory is well created, but i have also storeddata is created
as a directiry too not as a file !
I'm trying also this code and same problem:
public void transfer(){
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdCard.getAbsolutePath() +
On Sun, Apr 3, 2011 at 10:06 AM, Alaeddine Ghribi alaeddineghr...@gmail.com
wrote:
I solved the half of the problem for now, however, i'm having a File Not
Found exception !
OK. From what?
why the file is not copied ?
I assume your FileNotFoundException has something to do with it.
I copied the apk to my phone, and when i tap in the menu button
export, same problem! Plus the directory is not created(in the
Simulator yes the direc is created)!
Here is the menu button export code:
case R.id.exporter:
final SharedPreferences preferences = PreferenceManager
I copied the apk to my phone, and when i tap in the menu button
export, same problem! Plus the directory is not created(in the
Simulator yes the direc is created)!
Here is the menu button export code:
case R.id.exporter:
final SharedPreferences preferences = PreferenceManager
So here is the code(not working yet):
public class Import {
private Context context;
private String nom;
public Import(Context context,String nom) {
this.context = context;
this.nom=nom;
}
public void transfer(){
File sdCard =
On Sun, Apr 3, 2011 at 7:08 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
It shows me File Not Found
Step through your code and figure out which one is throwing the exception,
for starters.
Sorry, but do you mean that i put a break point in this
line: catch(FileNotFoundException ex){
Toast.makeText(context, File Not found, Toast.LENGTH_SHORT).show();
and see what it gives as output values ?
2011/4/4 TreKing treking...@gmail.com
On Sun, Apr 3, 2011 at 7:08 PM, Alaeddine Ghribi
Nope, he means step through until you *get* the exception...
However, if you put a breakpoint at *that* line you should be able to read
(in the Eclipse debugger) what file is causing you trouble.
kris
On Sun, Apr 3, 2011 at 9:51 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
Sorry, but
To be honest, i don't know how to step through the code until i get the
exception :\! F5 in the debugger?
But as you said, i have an other option that consists to put a break point
un the catch line! I'll report the getted results.
2011/4/4 Kristopher Micinski krismicin...@gmail.com
Nope, he
On Sun, Apr 3, 2011 at 9:11 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
So i put a breakpoint in the catch line and in the debugger i think that i
have the right variables:
Put a break at the *start* of your code and *step through* line by line
until you hit the line that causes the
Right, you should probably learn to use the debugger.
It's not long, there's not much to it. Try messing around with it for a
while and figure it out. It's a good way to find out what your code is
really doing.
On Sun, Apr 3, 2011 at 10:38 PM, TreKing treking...@gmail.com wrote:
On Sun, Apr 3,
Well i have an export menu button, and when i tap on it, this class is
executed, the normal way:
case R.id.importer:
Intent i = new Intent(this,Import.class);
startActivity(i);
return true;
I have a problem in the Import class that i can't recognize it
On Sat, Apr 2, 2011 at 8:40 PM, Alaeddine Ghribi
alaeddineghr...@gmail.comwrote:
I have a problem in the Import class that i can't recognize it !
What does that mean?
-
TreKing
40 matches
Mail list logo