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. Action bar through compatibility lib on 1.x, 2.x API

Is the compatibility library expected to help with action bar on pre-

Have been trying to get it to work in vain for long.
Changed the sample that uses MenuCompat to show action irrespective of
room. Still no luck.
MenuCompat.setShowAsAction(item, MenuItem.SHOW_AS_ACTION_ALWAYS);

What am I doing wrong? Or is it just to use fragments in options menu
that show at the bottom of the screen?

Thanks in advance.
ps: The only relevant thread in this group was the one with Dianne
Hackborn's reply asking us to properly try the samples out. Yes, I
have already included the jar and the rest of the fragments*support
stuff work well.


2. Resource qualifier bugs in Honeycomb/xoom

After having some unexpected things happen when writing for Honeycomb on an 
xoom, I notice that a couple of the resource qualifier options seem to be 

Dock Mode: not set even when in the dock.
Night Mode: notnight at 11:30 PM EST

Is anyone else noticing that happen in honeycomb in general or on the xoom 

I've created a little app for testing this as I was testing often enough on 
different devices :)

I have no idea if this is a general Honeycomb thing or if its specific to 
the xoom's implementation, but I'm thinking it would be worth finding out 
 so it can be reported.

- Brill Pappin


3. m-gadget 1.0 release

4. Ticker

5. Increment field Via Content Values?

6. Android+Google Docs

7. Google representation on the lists