Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mysite.news;
- import com.mysite.datasources.ArticlesDataSource;
- import com.mysite.models.Section;
- import android.app.Activity;
- import android.content.Context;
- import android.content.Intent;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.util.Log;
- import android.widget.Toast;
- //new DownloadArticlesTask(null).execute();
- //Intent myIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
- //SplashScreenActivity.this.startActivity(myIntent);
- public class SplashScreenActivity extends Activity
- {
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.splashscreen);
- LoadApplication loadApplication = new LoadApplication(this);
- loadApplication.execute("");
- }
- private class LoadApplication extends AsyncTask<String, Void, String> {
- Context context;
- //ProgressDialog waitSpinner;
- private ArticlesDataSource articlesDataSource;
- //ConfigurationContainer configuration = ConfigurationContainer.getInstance();
- public LoadApplication(Context context) {
- this.context = context;
- //waitSpinner = new ProgressDialog(this.context);
- }
- @Override
- public String doInBackground(String... params)
- {
- //IMPORTS THE ARTICLES FROM THE RSS FEED (adds or updates)
- articlesDataSource = new ArticlesDataSource(context);
- try {
- articlesDataSource.importArticles(Section.currentSection, false);
- } catch (Exception e) {
- Toast toast = Toast.makeText(
- getBaseContext(),
- "NOTICE: Could not import/update " + Section.currentSection.toString() + " articles.",
- Toast.LENGTH_LONG);
- toast.show();
- }
- return null;
- }
- @Override
- protected void onProgressUpdate(Void... value) {
- //Things to be done while execution of long running operation is in progress
- //(for example updating ProgressDialog)
- }
- @Override
- protected void onPostExecute(String result) {
- Intent myIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
- SplashScreenActivity.this.startActivity(myIntent);
- finish(); //makes it so you can't click the back button to get to it
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement