事情是這樣的。我有一個帶有在後臺解壓縮的圖像的zip文件(使用線程)我從我的主要文件開始一個新的活動來顯示這些圖像。爲了表明我呼籲的onResume這個函數的第一個圖像:吐司和圖片未顯示
public boolean showImage(String validFile){
File page = new File(validFile);
System.err.println("Attempting to show " + validFile);
boolean found = false;
if (page.exists()){
System.err.println("Page exist");
found = true;
}
else{
System.err.println("Page does not exist");
long start = System.currentTimeMillis();
//ProgressDialog loading = ProgressDialog.show(this, "", "Loading....",true);
Toast.makeText(this, "Loading...", Toast.LENGTH_LONG);
while (((System.currentTimeMillis() - start) < 5000) && (!found)){
if (page.exists()){
found = true;
//t.cancel();
System.err.println("Page found");
}
else{
System.err.println("Page does not exist");
}
}
}
if (!found){
return false;
}
else{
System.err.println("Setting up image");
ims.setImageDrawable(new BitmapDrawable(BitmapFactory.decodeFile(validFile)));
return true;
}
}
所有我想要做的是顯示敬酒,說加載進度對話框或東西...而第一圖像進行解壓。但是,無論是烤麪包還是圖像都不會顯示。現在我知道該圖像是有兩個原因的:1設置圖像和文件找到消息出現,我可以使用fling在圖像中移動並且工作得很好。
這是發生了什麼事。我的活動開始並輸入上面的代碼,但第一個圖像從不顯示。我扔掉,看到第二個圖像和第三個圖像等等。
那麼我做錯了什麼?
感謝您的幫助!
ü應添加.show()來顯示你的吐司, – Houcine