私のアプリはラズベリーから画像をダウンロードできます。それはうまく動作します。これはコードです保存せずに画像を表示
public void downloadFile() {
FTPClient ftpClient = new FTPClient();
try {
ftpClient.connect("******");
ftpClient.login("****","*****");
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
String remoteFile1;
File downloadFile1 = new File(filePath);
OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
boolean success = ftpClient.retrieveFile(remoteFile1, outputStream1);
outputStream1.close();
if (success) {
System.out.println("File #1 has been downloaded successfully.");
} else {
System.out.println("Error in downloading file !");
}
boolean logout = ftpClient.logout();
if (logout) {
System.out.println("Connection close...");
}
} catch (IOException ex) {
System.out.println("Error: " + ex.getMessage());
ex.printStackTrace();
} finally {
try {
ftpClient.disconnect();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
私はそれを表示することができますので、私のアプリのユーザーが見ることができます。イメージの読み込みでは、このコードを使用してImも動作します。
private void loadImage(String imagePath) {
Uri imageUri;
String fullImagePath;
Drawable image;
ImageView imageDisplay;
imageUri = Uri.parse(imagePath);
fullImagePath = imageUri.getPath();
image = Drawable.createFromPath(fullImagePath);
imageDisplay=(ImageView) findViewById(R.id.imageDisplay);
imageDisplay.setImageDrawable(image);
}
今、画像をギャラリーにダウンロードせずに表示したいと考えています。しかし、私はこれを行う方法を理解することはできません。 誰かが私を助けてくれますか?
*ダウンロードしないで画像を表示したい(リモート) – Selvin
どうしてですか?あなたはこのイメージを保存することは自由であるか、または –
をダウンロードすることはできません!=保存...はい、あなたは保存せずにメモリに画像を保存できます(遅かれ早かれメモリ問題を引き起こすでしょう)... – Selvin