How To Make A Splash Screen And Run Listview Processes At Background?
I have an app which loads the data from sqlite db, does some calculations with it and presents it using listview with adapter. So this part is ready and is working. In case when th
Solution 1:
public class SplahActivity extends Activity {
public static final int Tick = 1000;
public static final int Complete = 5000;
ArrayList<String> data;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
data = new ArrayList<>();
AsyncTaskRunner runner = new AsyncTaskRunner();
String sleepTime = time.getText().toString();
runner.execute(sleepTime);
}
private class AsyncTaskRunner extends AsyncTask<String, String, String> {
private String resp;
@Override
protected void onPreExecute() {
// Things to be done before execution of long running operation. For
// example showing ProgessDialog
}
@Override
protected String doInBackground(String... params) {
// data and save it in array
// data = Reveice data from db
return resp;
}
@Override
protected void onPostExecute(String result) {
// execution of result of Long time consuming operation
Intent i = new Intent(ActivityName.this,SecondScreen.class);
startActivity(i);
}
}
}
Post a Comment for "How To Make A Splash Screen And Run Listview Processes At Background?"