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 /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

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

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 /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - My ProgressDialog suffers from ANR timeouts?

My ProgressDialog suffers from ANR timeouts?

Put your problem here if it does not fit any of the other categories.

My ProgressDialog suffers from ANR timeouts?

Postby dsukhram » Fri Mar 19, 2010 4:42 pm

I am downloading a 230MB database file from a server. I am displaying the progress of the download in a progressDialog. However about 12% into the download I get the ANR "wait" or "force close" popup.

the logs indicate:
03-18 19:55:58.943: WARN/WindowManager(67): Key dispatching timed out sending to Downloading Database

I have tried doing the download and progressDialog updates in both a Asyntask and using a Handler method but I'm still getting the same errors. Is my file just to big? It works fine for smaller sized files.
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

Top

Postby dsukhram » Fri Mar 19, 2010 4:47 pm

this is my inner class that handles the downloading and progressbar

public class DownloadDBTask extends AsyncTask<Object, Integer, Object>
{
private int mProgress;

public Object doInBackground(Object ...urls)
{
//download file
int totalSize =0;

try
{
URL urlFile = new URL("http://www.xxx.com/test.db");
URLConnection conn;
conn = urlFile.openConnection();
totalSize = conn.getContentLength();

Log.i("INFO","total size of file "+totalSize);
BufferedInputStream bis = new BufferedInputStream(urlFile.openStream());
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(PATH+DB_NAME),1024);
byte data[] = new byte[1024];
int bufferSize =0;
int currentSize = 0;

while((bufferSize = bis.read(data)) != -1 )
{

currentSize +=bufferSize;
bout.write(data,0,bufferSize);

publishProgress((int) ((currentSize / (float) totalSize) * 100));


}
Log.i("INFO","Done downloading");

bout.flush();
bis.close();
bout.close();

}
catch(IOException e)
{
Log.e("ERROR",e.toString());
}

return (new Object());
}

public void onPostExecute(Object result) {

mProgressDialog.dismiss();
}

protected void onProgressUpdate(Integer... progress) {


mProgressDialog.setProgress(progress[0]);

}

protected void onPreExecute(){


showDialog(2);
}
}
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

problem solved

Postby dsukhram » Sat Mar 20, 2010 12:25 pm

problem solved!

increasing the buffer size did the trick.
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 14 guests