package com.android;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class androidm extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                // get Button Text end etc..
                final Button button = (Button) findViewById(R.id.Button01);

                button.setOnClickListener(new Button.OnClickListener() {
                        public void onClick(View v) {

                                   try {
                       String server = "myserver";
                       String username = "myusername"
                       String password = "mypassword";

                   FTPClient f = new FTPClient();
                   // possibly: f.enterLocalPassiveMode();
                   f.connect(server);
                   f.login(username, password);
                   FTPFile[] files = f.listFiles();

                   if(files != null) {
                           textView.setText(files[0].toString
());
                           }
                  else {

                   }

                   f.logout();
                   f.disconnect();

               } catch(IOException e) {
                     textView.setText(e.getMessage());
               }
                        }
                });

        }

}

I added commons-net-ftp-2.0.jar File wich is ftp client and when i
clickd login application make crashed, can help me

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to