1
我正在使用afilechooser爲此目的。這是默認編程來選擇文件夾內的項目,並獲得用戶選擇的路徑。文件選擇器選擇文件夾(安卓)
但我想用它作爲文件夾選擇器,用戶從Android設備的內存中選擇一個位置,然後應用程序將該文件保存在該位置。
那麼我該怎麼做。
我使用用於此目的的代碼是 -
private void showChooser() {
// Use the GET_CONTENT intent from the utility class
Intent target = FileUtils.createGetContentIntent();
// Create the chooser Intent
Intent intent = Intent.createChooser(
target, getString(R.string.chooser_title));
try {
startActivityForResult(intent, REQUEST_CODE);
} catch (ActivityNotFoundException e) {
// The reason for the existence of aFileChooser
}
}
,我懷疑的代碼可以改爲選擇文件夾而不是文件。任何建議都可能有所幫助。請提出建議,如果有任何其他方式來實現想要的。
謝謝
你能否爲此提出其他建議? –
不,我不知道任何替代品,但是因爲您已經在工作區中擁有代碼,所以您可以嘗試使其適應您的需要。 – pleft
我想選擇文件夾來選擇保存文件的路徑。但是這是選擇文件夾中的項目。無論如何,我會繼續努力。 –