You should write a method getCurrentFileNames() that get filename and search inside mobile folder and returns a list of Current stored Files.You should also write another method DownloafFileFromServer(String fileName) that takes a file name and if file exist in server it should download it and if not exist it should delete it in mobile folder. Implementation files('libs/commons-net-3.6.jar') Implementation ':constraint-layout:1.0.2'ĪndroidTestImplementation ':runner:1.0.1'ĪndroidTestImplementation '.espresso:espresso-core:3.0.1' Implementation fileTree(include:, dir: 'libs') ProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' TestInstrumentationRunner ".AndroidJUnitRunner" Public class MainActivity extends AppCompatActivity void onCreate(Bundle savedInstanceState) : android.os.NetworkOnMainThreadExceptionĪt (ActivityThread.java:2702)Īt (ActivityThread.java:2767)Īt $900(ActivityThread.java:177)Īt $H.handleMessage(ActivityThread.java:1449)Īt android.os.Handler.dispatchMessage(Handler.java:102)Īt android.os.Looper.loop(Looper.java:145)Īt (ActivityThread.java:5951)Īt .invoke(Native Method)Īt .invoke(Method.java:372)Īt .ZygoteInit$n(ZygoteInit.java:1399)Īt .ZygoteInit.main(ZygoteInit.java:1194)Ĭaused by: android.os.NetworkOnMainThreadExceptionĪt android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147)Īt (InetAddress.java:418)Īt (InetAddress.java:252)Īt (InetAddress.java:305)Īt .nnect(SocketClient.java:202)Īt .nnect(SocketClient.java:306)Īt 1.MainActivity.onCreate(MainActivity.java:40)Īt (Activity.java:6289)Īt (Instrumentation.java:1119)Īt (ActivityThread.java:2655)Ġ1-24 12:50:11.007 7023-7023/1 I/Process: Sending signal. Most third-party file managers on Android come with support for FTP, so you can start an FTP server on Android and then connect to it on a PC. To use it, you need to have an FTP server on one device, and an FTP client on another. Import .ftp.FTPConnectionClosedException FTP works over the internet, so you can use it to connect to a device in your Wi-Fi network, or to a remote server. This is my MainActivity.java:- package 1 Please have a look at the code and help me out. I am unable to connect to FTP server and my app crashes. It should be dynamic, that is it should reflect all the changes done inside the folder of which I have given a specific URL, that is if something is deleted or inserted, it should be reflected in the app. ![]() ![]() I want to access files located in a folder on the FTP server by giving ftp's hostname and display it in my app which is developed using the android studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |