My application for the most part prefers to be online, I have of
course added an offline mode so that it works perfectly well when not
attached and then re-syncs when connected again. I do, however, have
an issue with the initial start of the main activity "black screening"
on me while (i assume) it is waiting on a TCP timeout. It would be
nice to query and skip the download step if the network is super slow.
Here is pseudo code for what I am doing:
public void OnCreate(...) {
if( !loggedin )
showLoginActivity()
else {
new downloadData().doInBackground();
showDataList(m_datalist ); //keep in mind that m_datalist is
displayable
}
}
public class downloadData extends AsyncTask<String, Integer, Integer>
{
protected Integer doInBackground(Integer... params) {
//http get of JSON data
m_datalist = getJSONDataFromServer();
}
}
The showDataList function creates rows in my list and populates the
list from the content in m_datalist which has the last valid dataset
in it at all times. The issue is that it just black screens while
downloading data even though I have it getting this data in an
AsyncTask.
The preferred experience would be for the application to draw the list
and be usable while the download thread retrieves any new
information. This then gets to my question, if I could detect a slow
or unresponsive internet connection I could possibly skip the HTTP
calls until a time where the internet was more healthy.
Ideas?
--G
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en