第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

android pie:我無法獲取文件名或文件路徑

android pie:我無法獲取文件名或文件路徑

斯蒂芬大帝 2022-05-21 20:37:18
我的代碼在任何設(shè)備上都可以正常工作..但不能在 android pie 上工作我正在嘗試從片段中的 onActivityResult 獲取真實(shí)路徑和文件名我正在使用 apachi 庫(kù)中的 FileNameUtils并使用這個(gè)庫(kù)https://gist.github.com/tatocaster/32aad15f6e0c50311626但它給了我空這是我的代碼private void pickFile() {    Intent intent = new Intent();    intent.setType("*/*");    intent.setAction(Intent.ACTION_GET_CONTENT);    startActivityForResult(Intent.createChooser(intent, "Select File"), PICKFILE_REQUEST_CODE);  }  @Override  public void onActivityResult(int requestCode, int resultCode, Intent data) {    if (requestCode == PICKFILE_REQUEST_CODE) {      filePath = RealPathUtil.getRealPath(getContext(), data.getData());      fileName = FilenameUtils.getName(filePath);      Log.i("FileNameIs",filePath + "Hello  " + fileName );//      if (fileName !=null)//      {//        mFileName//            .setText(fileName.isEmpty() ? getString(R.string.failed_please_try_again) : fileName);////        deleteOldPath();////      }    }  }更新..在下一個(gè)..修復(fù)它第一的獲取文件名我用過這個(gè)功能  public void dumpImageMetaData(Uri uri) {    String TAG = "TagIs";    // The query, since it only applies to a single document, will only return    // one row. There's no need to filter, sort, or select fields, since we want    // all fields for one document.    Cursor cursor = getActivity().getContentResolver()        .query(uri, null, null, null, null, null);    try {      // moveToFirst() returns false if the cursor has 0 rows.  Very handy for      // "if there's anything to look at, look at it" conditionals.      if (cursor != null && cursor.moveToFirst()) {        // Note it's called "Display Name".  This is        // provider-specific, and might not necessarily be the file name.        String displayName = cursor.getString(            cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));        fileName = displayName ==null ? "Failed" : displayName;        deleteOldPath();      }    } finally {      cursor.close();    }  }
查看完整描述

1 回答

?
夢(mèng)里花落0921

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊

看這個(gè) 。安卓參考


查看完整回答
反對(duì) 回復(fù) 2022-05-21
  • 1 回答
  • 0 關(guān)注
  • 261 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)