i have a splash screen at start up. with the following coding
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread logoTimer = new Thread(){
public void run(){
try{
int logoTimer = 0;
while (logoTimer<5000){
sleep(100);
logoTimer=logoTimer+100;
}
startActivity(new Intent("com.package.MAIN"));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}}
now i just want to add a horizontal progress bar to the above splash activity say at the bottom of the screen.. so as the splash screen appears simultaneously the progress bar should load and when it finishes the next activity should appear.
searched few examples on progress bar but was not able to do what i want. there were many examples for progress bar with a dialog box. but here i don't want any dialog box. i just need a plain horizontal progress bar on my splash screen.
so can someone help me out with required coding and stuffs? pls ! :)
Go to app > java > first package name > right-click > New > Activity > Empty Activity and create another activity and named it as SplashScreen. Edit the activity_splash_screen. xml file and add image, text in the splash screen as per the requirement. Here we are adding an image to the splash screen.
You can go to android → app → src → main → res → drawable and there you can add any images and do the XML configuration to get rid of the default white/black splash screen in Flutter.
Here you go, wrote a tutorial how to create a SplashScreen with a progress bar:
http://blog.blundellapps.com/tut-splashscreen-with-progress-bar/
Basically instead of your thread it starts an ASyncTask, you pass a reference to your progressSpinner into the ASyncTask and this will update it as the thread is downloading resources (or whatever you want to do)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With