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

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

無(wú)法使用 Intent.ACTION_VIEW 在 Android 上打開(kāi) Excel 文件

無(wú)法使用 Intent.ACTION_VIEW 在 Android 上打開(kāi) Excel 文件

人到中年有點(diǎn)甜 2021-06-18 15:03:15
我試圖讓用戶在我的應(yīng)用程序中導(dǎo)出一個(gè) excel 文件,并讓該應(yīng)用程序自動(dòng)打開(kāi)創(chuàng)建的 excel 文件。使用 jxl 成功創(chuàng)建并存儲(chǔ)了 excel 文件,但是當(dāng)我嘗試使用 Hancom Office 編輯器打開(kāi)它時(shí),除了屏幕出現(xiàn)黑色覆蓋之外,什么也沒(méi)有發(fā)生。這是一個(gè) gif: 我無(wú)法弄清楚是什么導(dǎo)致了這種情況,也無(wú)法在網(wǎng)上找到任何相關(guān)信息。我正在使用這里接受的答案來(lái)支持我的目標(biāo) SDK 28。我的導(dǎo)出方法: public void onExport(View view){        try {            //write changes to excel file(changes made outide of function)            workbook.write();            workbook.close();            Toast.makeText(getApplication(),                    "Data Exported to Excel Sheet", Toast.LENGTH_SHORT).show();            findViewById(R.id.btn_export).setEnabled(false);            //set file to saved excel file            File file = new File(Environment.getExternalStorageDirectory(),                    race.getName()+".xls");            Uri path = FileProvider.getUriForFile(getApplicationContext(), "com.something.racecalculator.fileprovider", file);            Intent intent = new Intent(Intent.ACTION_VIEW);            Log.i("path: ", path.toString());            intent.setDataAndType(path, "image/jpg");            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);            startActivity(intent);        } catch (IOException e) {            e.printStackTrace();        } catch (WriteException e) {            e.printStackTrace();        }        catch (ActivityNotFoundException e) {            Log.i("oh no:", "No application available to view excel");        } }我在 AndroidManifest.xml 中的 provider 標(biāo)記(設(shè)置為的子項(xiàng)):<provider            android:name=".GenericFileProvider"            android:authorities="com.something.racecalculator.fileprovider"            android:exported="false"            android:grantUriPermissions="true">            <meta-data                android:name="android.support.FILE_PROVIDER_PATHS"                android:resource="@xml/provider_paths"/>        </provider>據(jù)我所知,我沒(méi)有收到任何錯(cuò)誤或警告。謝謝你的幫助。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 511 瀏覽
慕課專欄
更多

添加回答

舉報(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)