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 or directory) So as the log indicated, the compiler doesn't finds the file in the /data/data... I maked one other thing, in the copyfile function i maked this: copyfile(context,*"data/data/ carburant.android.com/files/alaa.peugeot.settings.dat"*,sdCard.getAbsolutePath() + "/SDCARD/Carburant/storeddata.dat"); The log message now indicates this: 04-04 11:11:32.771: DEBUG/Carburant(852): /mnt/sdcard/SDCARD/Carburant/storeddata.dat (Permission denied) Let's begin to correct the first message :\ Every user will put its name and car mark, so this 2 variables are not constant! So, in the menu export code i maked this: case R.id.exporter: final SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(context); String fileName = getResources().getString(R.string.fileName); fileDir = "" + preferences.getString("login", "") + "."+ preferences.getString("marque", "") + "."; Import myImport = new Import(this,fileDir+fileName); //Import myImport(this, fileDir+fileName); myImport.transfer(); return true; I think that the problem comes from the red line, it's a comment because i always have an error message on it, but i think that this line can make the problem solved, we have to import in the "import" function the filedir and filename, without this line, nothing imported => it can't find the file in the /data/data... So please what can i put to import the necessary variables to the import function(in the other class). Thank you. 2011/4/4 TreKing <treking...@gmail.com> > On Sun, Apr 3, 2011 at 9:11 PM, Alaeddine Ghribi < > alaeddineghr...@gmail.com> wrote: > >> 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 exception. > > OR > > Print the message the exception gives you (ex.getMessage()) to find out > what file is giving the error. > > > > ------------------------------------------------------------------------------------------------- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en