I want to capture a frame buffer with a preview of the surface of the camera and send these buffers to another function that will be processed / POSTed somewhere on the Internet.
The Android Dev manual shows an example:
http://developer.android.com/reference/android/os/AsyncTask.html
private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
protected Long doInBackground(URL... urls) {
int count = urls.length;
long totalSize = 0;
for (int i = 0; i < count; i++) {
totalSize += Downloader.downloadFile(urls[i]);
publishProgress((int) ((i / (float) count) * 100));
}
return totalSize;
}
protected void onProgressUpdate(Integer... progress) {
setProgressPercent(progress[0]);
}
protected void onPostExecute(Long result) {
showDialog("Downloaded " + result + " bytes");
}
}
Here's how you did it:
new DownloadFilesTask().execute(url1, url2, url3);
Is this whole operation one big AsyncTask (in other words, this loop will sit there and wait for each file to load synchronously) while the whole task is running in the background, or will this trigger multiple threads for each URL that was transferred?
As for my project, would it be wise to just create a brand new AsyncTask every time I want to capture a frame buffer? Sort of:
new FrameProcessorTask().execute(byte[]);