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. Appwidget onDisabled not called.

Hi All,

I have AppWidget which runs fine but I want to do some cleanup task
when last appwidget is deleted. So according to android documents, I
implemented onDisabled() method in my AppWidgetProvider class.But when
i delete the last AppWidget, onDisabled is not getting called.

When I implemented onDeleted() method, It gets called. I checked all
instance of my appwidgets using following code,


int[] allAppWidgets=appWidgetManager.getAppWidgetIds(new

for(int i=0;i<allAppWidgets.length;i++)

It shows that it has got 11 instances of appwidget. But i cannot see
any instance of my appwidget except the one which i create.

Does anyone knows how to delete all the instances of this invisible



2. Query in Android Application development

Hi to all!!

         I am Raghav Rajagopalan from Chennai, India. I am a Android
application developer. I am new to this domain. I am working on building a
application. I have few queries. I hope you can help me out in solving my

My requirements are:

1. I have a Login Screen created. I need to create a SqLite DB to check if
user is a valid one or not.
2. If valid user navigate to my web site.
3. If new user he needs to register first.
3a. To register he needs click on the Register now button in Login screen,
Which will navigate user to my website for registration.
3b. After registeration i need to come back to login screen using a back
button in the Registeration screen(website).

I have designed the layout.

This is my task. I have tried many ways in developing this issue. But hardly
never worked fine for me.

Its my kind request to you to help me out in this issue.

Thanks in advance.

Raghav Rajagopalan


3. [WTA] Restore backup gagal

4. [WTI] Penyerahan Dana Partisipasi id-android untuk Bro Rheza Christian.

5. Bluetooth killer availabled in Android ? - WiFi Direct

6. Penyerahan Dana Partisipasi id-android untuk BroRheza Christian.

7. WTPamer : Livehome di juned