FTP client : How to change working directory

by Guru » Fri, 23 Apr 2010 08:02:05 GMT

Sponsored Links
 Hi friends,
I am beginner to android. I am trying to develop FTP client in
android. I am unable to change the working directory.
I am using FileZilla FTP server.
I want to upload one file (samplefile.txt) to FTP server. So,

Step 1: I created this file using
FileOutputStream fOut =
OutputStreamWriter osw = new OutputStreamWriter(fOut);

and I confirmed this file got created in "/data/data/com.xyz.Hello/

Step 2: open and connect to ftp server

ftp.connect("107.108.yy.xx", 4000);
ftp.login(username, password);
ftp.port(ftp.getRemoteAddress(), ftp.getRemotePort());

Step 3: Store samplefile.txt in FTP server

InputStream input;
                                String path = new
                                Log.i("FTP", path);
                                input = new FileInputStream("samplefile.txt");



Problem: In the step 3, when I do  String path = new
java.io.File(".").getCanonicalPath(); I am getting root directory "/".
But my file is in "/data/data/com.xyz.Hello/files/samplefile.txt". So
I should do change working directory to "/data/data/com.xyz.Hello/
files". But I am not getting how to do this in android? Please help me
to know how to change the working directory. and also let me know if
there is any code help on creating FTP on android.


Other Threads

1. Does Android support JSR 177 APDUConnection?



2. Checking whether the screen is locked


I'm writing a presence agent application for Android (that checks if
you are 'available' or 'away'). For this I would like to check any
activity on the phone.
The easiest way to do this would be to check whether the screen is
locked. Is there any way to do this?
Alternatively, is there a way to check if the user is 'using' the
screen or touching any keys without having to be in the activity of
this app (so I can check this from within my service when the user is
using other apps).

Thanks in advance!


3. what is difference between OnClickListener and OnTouchListener?

4. Context menus for TableRow?

5. writing into sd card falling

6. Android - next attempt

7. New or Existing Application.