What should I do?
intro.java
publicclassintroextendsAppCompatActivity{protectedstaticfinalintTIMER_RUNTIME=5000;protectedbooleanmbActive;protectedProgressBarmProgressBar;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);this.requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.intro);mProgressBar=(ProgressBar)findViewById(R.id.barrinha);finalThreadtimerThread=newThread(){@Overridepublicvoidrun(){mbActive=true;try{intwaited=0;while(mbActive&&(waited<TIMER_RUNTIME)){sleep(5);if(mbActive){waited+=5;updateProgress(waited);}}}catch(InterruptedExceptione){//Casoerro!!f}finally{onContinue();}}};timerThread.start();}publicvoidupdateProgress(finalinttimePassed){if(null!=mProgressBar){finalintprogress=mProgressBar.getMax()*timePassed/TIMER_RUNTIME;mProgressBar.setProgress(progress);}}publicvoidonContinue(){Log.d("messagemFinal", "Sua barra de loanding acabou de Carregar!");
TimerTask task=new TimerTask() {
@Override
public void run() {
Intent mainIntent=new Intent().setClass(intro.this,main.class);
startActivity(mainIntent);
finish();
}
};
Timer timer=new Timer();
}
}