Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
public class GridViewMultiThread extends Activity { Button button = null; GridView gridView = null; Context context = null; ImageAdapter imageAdapter; private View mSearchPanel; DownloadPhotosTask downloadPhotosTask; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); gridView = (GridView) findViewById(R.id.showPhotoGridView); imageAdapter = new ImageAdapter(this); gridView.setAdapter(imageAdapter); downloadPhotosTask = (DownloadPhotosTask) new DownloadPhotosTask().execute(); // button.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // button.setEnabled(false); // downloadPhotosTask = (DownloadPhotosTask) new DownloadPhotosTask() // .execute(); // } // }); } class DownloadPhotosTask extends AsyncTask implements PhotoDownloadListener { // @Override // protected void onPreExecute() { // if (mSearchPanel == null) { // mSearchPanel = ((ViewStub) findViewById(R.id.stub_search)) // .inflate(); // // ProgressBar progress = (ProgressBar) mSearchPanel // .findViewById(R.id.progress); // progress.setIndeterminate(true); // // ((TextView) mSearchPanel.findViewById(R.id.label_loading)) // .setText("loading"); // // final View cancelButton = mSearchPanel // .findViewById(R.id.button_cancel); // cancelButton.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // onCancelSearch(); // } // }); // } // } // private void onCancelSearch() { // if (downloadPhotosTask != null // && downloadPhotosTask.getStatus() == AsyncTask.Status.RUNNING) { // downloadPhotosTask.cancel(true); // downloadPhotosTask = null; // } // } @Override protected Void doInBackground(Void... params) { DownLoader.getInstance().downLoadImage(this); return null; } @Override public void onPhotoDownloadListener(Photo photo) { if (photo != null && !isCancelled()) { publishProgress(photo); } } @Override public void onProgressUpdate(Photo... photos) { for (Photo photo : photos) { imageAdapter.addPhoto(photo); gridView.invalidateViews(); // imageAdapter.registerDataSetObserver(observer) } } } } class ImageAdapter extends BaseAdapter { private Context mContext; private List photos = new ArrayList(); public ImageAdapter(Context context) { this.mContext = context; } public void addPhoto(Photo photo) { photos.add(photo); } @Override public int getCount() { return photos.size(); } @Override public Object getItem(int position) { return photos.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { final ImageView imageView; if (convertView == null) { imageView = new ImageView(mContext); } else { imageView = (ImageView) convertView; } imageView.setImageBitmap(photos.get(position).getBm()); return imageView; } } class DownLoader { private static DownLoader downloader = new DownLoader(); private static String[] myImageURL = null; private List photos = new ArrayList(); public static DownLoader getInstance() { initImageURL(); return downloader; } static void initImageURL() { int no = 0; myImageURL = new String[100]; for (int i = 0; i < myImageURL.length; i++) { myImageURL[i] = "http://cp.a8.com/image/128X128GIF/8" + no + ".gif"; no++; if (no % 10 == 0) { no = 0; } } } public List downLoadImage(PhotoDownloadListener listener) { List urls = Arrays.asList(myImageURL); List photos = new ArrayList(); URL aryURI = null; URLConnection conn = null; InputStream is = null; Bitmap bm = null; Photo photo = null; for (String url : urls) { // Log.e("URL:", url); try { aryURI = new URL(url); conn = aryURI.openConnection(); is = conn.getInputStream(); bm = BitmapFactory.decodeStream(is); photo = new Photo(bm); listener.onPhotoDownloadListener(photo); photos.add(photo); } catch (Exception e) { throw new RuntimeException(e); } finally { try { if (is != null) is.close(); } catch (IOException e) { e.printStackTrace(); } } } return photos; } } class Photo { private Bitmap bm; public Photo(Bitmap bm) { this.bm = bm; } public Bitmap getBm() { return bm; } public void setBm(Bitmap bm) { this.bm = bm; } interface PhotoDownloadListener { public void onPhotoDownloadListener(Photo photo); } }