【问题标题】:I want to open my FTP server page using Android Browser Intent我想使用 Android Browser Intent 打开我的 FTP 服务器页面
【发布时间】:2020-04-13 20:21:45
【问题描述】:

我使用以下代码,但应用程序只是崩溃,因为 URI.Parse 不知道如何处理 ftp:/

Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(LinkUrl.get("ftp:/192.168.0.103")));

startActivity(intent);

LOG Cat 如下(引发异常的部分):

2019-12-22 03:04:25.877 8018-8018/com.example.webview E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.webview, PID: 8018
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webview/com.example.webview.MainActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=ftp:///... }

【问题讨论】:

    标签: android android-intent ftp ftp-client ftpwebrequest


    【解决方案1】:

    很少有设备会有支持ftp 方案的应用,因为 FTP 不受欢迎且不安全。您需要抓住ActivityNotFoundException 并优雅地处理用户缺少支持ftp 方案的应用程序的情况。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      • 1970-01-01
      • 2014-07-30
      • 2012-08-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多