4
我的麪包只有在文件完成下載後才顯示(我評論了下載功能)。任何想法爲什麼?爲什麼我的吐司不出現?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView main_image_view = (ImageView)this.findViewById(R.id.main_image_view);
TextView text_view = (TextView)this.findViewById(R.id.main_text_view);
Context context = getApplicationContext();
CharSequence text = "File Not Found. Downloading... Please be patient, it's a large file!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
// This function fetches a file from a URL.
brain = get_frame_fl(file_name, mActive_slice);
brain_slice = Bitmap.createBitmap(brain_pixels, frame_width, frame_height, Bitmap.Config.ARGB_8888);
// display
main_image_view.setImageBitmap(brain_slice);
}
的確如此。看到這個答案爲`AsyncTask`的例子:http://stackoverflow.com/questions/4828676/preventing-internet-accessing-method-from-delaying-a-toast-popup/4829593#4829593 – binnyb 2011-02-01 20:05:37