java - How to add 2 Splashscreen in application -


  1. the first splashscreen hidden after 5 secondes.
  2. i want add second splashscreen first before enter in mainactivity.
  3. in @drawable/background_1 <= first image splashscreen added.
  4. in @drawable/background_2 <= need add image in second splashscreen.

splash.xml

    <?xml version="1.0" encoding="utf-8"?>         <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:background="@drawable/background_1" >          </relativelayout> 

splashscreen.java

    package org.sbynight.app;      import android.app.activity;     import android.os.bundle;     import android.content.intent;     import android.util.log;     import android.view.window;     import android.view.windowmanager;      public class splashscreen extends activity {            private static string tag = splashscreen.class.getname();            private static long sleep_time = 5;    // sleep time             @override            protected void oncreate(bundle savedinstancestate) {               super.oncreate(savedinstancestate);                this.requestwindowfeature(window.feature_no_title);    // removes title bar               this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);    // removes notification bar                setcontentview(r.layout.splash);                // start timer , launch main activity               intentlauncher launcher = new intentlauncher();               launcher.start();            }             private class intentlauncher extends thread {               @override               /**                * sleep time , start new activity.                */               public void run() {                  try {                     // sleeping                     thread.sleep(sleep_time*1000);                  } catch (exception e) {                     log.e(tag, e.getmessage());                  }                   // start main activity                  intent intent = new intent(splashscreen.this, mainactivity.class);                  splashscreen.this.startactivity(intent);                  splashscreen.this.finish();               }            }         } 


problem solved - update of post -
1.i create "splashscreen2.java" + "splash2.xml"
2.i added @drawable>background_2 (the second image of splashscreen)
3.i added in manifest splash2.....

  1. in splashscreen.java, deleted code:
     // start main activity      intent intent = new intent(splashscreen.this, mainactivity.class);      splashscreen.this.startactivity(intent);      splashscreen.this.finish(); 
  1. in splashscreen.java, replace code :
     /**** create thread sleep 5 seconds ****/             thread background = new thread() {         public void run() {              try {                 // thread sleep 1 seconds                 sleep(1*1000);                  // after 1 seconds redirect intent                 intent i=new intent(getbasecontext(),splashscreen2.class);                 startactivity(i);                  //remove activity                 finish();              } catch (exception e) {              }         }     };      // start thread     background.start(); 
  1. in splashscreen2.java, added same code splashscreen.java,

    surely code start mainactivity.class

    // start main activity intent intent = new intent(splashscreen2.this, mainactivity.class); splashscreen2.this.startactivity(intent); splashscreen2.this.finish();

problems solved! have 2 splashscreen!

this use-case goes against android design guidelines.

please think how users user experience using app , access content fast.

designing app

don't show unsolicited help, except in limited cases

naturally, want learn ropes, discover cool features, , out of app. might tempted present one-time introductory slideshow, video, or splash screen new users when first open app. or might drawn idea of displaying helpful text bubbles or dialogs when users interact features first time.

in cases, advise against approaches these because:

they're interruptions. people eager start using app, , put in front of them feel obstacle or possibly annoyance, despite intentions. , because didn't ask it, won't pay close attention it. they're not necessary. if have usability concerns aspect of app, don't throw @ problem. try solve in ui. apply android design patterns, styles, , building blocks, , you'll go long way in reducing need educate users.

source: http://developer.android.com/design/patterns/help.html


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -