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. Is it safe to queue KeyEvents and MotionEvents for deferred processing?

I decided to start pipelining input to increase responsiveness in my
games.  Basically what I do is when the activity receives a Key or
Motion event, it sends it to a feed method in the game, which
encapsulates it with a time and whatever else I need and puts it in a
queue then immediately returns so the UI loop is never held up waiting
for long.  The main loop later processes the queue, applying the
events in it at the appropriate times.

This works great and makes the games snappy, although now I'm starting
to miss touch events intermittently.  I realized that the events could
be recycled objects and that could make them not safe to queue.  Is
this the case or is it safe to queue them for deferred processing like
I'm doing?

2. ARM EABI toolchain for Android donut

Hi All,

Embinux team has released beta build
(ecc-android-crm_g3d7823fa_bb0f1156c-0909-arm-eabi.bin.tgz) of Embinux
Cross Compiler (ARM port) for Android donut.

In this release GCC is upgraded to 4.4.1 and armv7-a is also supported.

The release notes and download links are available from 

- Embinux Team

unsubscribe: android-porting+unsubscr...@googlegroups.com

3. launching m3u playlist with intent

4. Why "MediaPlayer" Couldn't open file on client side, trying server side?

5. Why "MediaPlayer" couldn't open file on client side, trying server side?

6. Margins acting wierd

7. AndroidManifest compile time checks