Here is the code for the main activity which is to be loaded after onCreate method is fully executed.
Refered This for closing one activity from another
public class DictionarySscWords extends AppCompatActivity implements View.OnClickListener, TextToSpeech.OnInitListener
{
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
context = this;
Intent myIntent = new Intent(DictionarySscWords.this,LoadingIt.class);
startActivity(myIntent);
setContentView(R.layout.activity_main);
//all this activity work
LoadingIt.fa.finish(); //close Loading activity
}
}
Now here is the code of my loadingIt activity
public class LoadingIt extends AppCompatActivity {
Context context;
public static LoadingIt fa;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_it);
context=this;
fa = this;
ProgressDialog dialog=new ProgressDialog(context);
dialog.setMessage("Loading Please wait!!");
dialog.setCancelable(false);
dialog.setInverseBackgroundForced(false);
dialog.show();
}
}
Problem is LoadingIt activity is never finished and app is stuck on Loading screen i want to finish thisactivity as the previous acivity onCreate method is fully executed
thanks