Alok,

I'm not sure what "application end (time in ms)( my splash application)" means.

You can create an Intent for starting a new activity in one line, like this:

Intent intent = new Intent(this, ActivityClassName.class);
startActivity(intent);

or even

startActivity(new Intent(this, ActivityClassName.class));

-- Kostya

02.11.2010 17:39, alok upadhyay пишет:
Thanks!
i am just going on handler tutorial and try what you have suggest.I also want to ask one thing:
if i simply create a splash.java class and do some stuff like :
not code but algorithm like this
application end (time in ms)( my splash application)
and then open new activity as:
intentobj.setclass(this,Trial.class)

can it be done so?

On Tue, Nov 2, 2010 at 4:29 PM, Kostya Vasilyev <[email protected] <mailto:[email protected]>> wrote:

    Alok,

    Using a thread for this is wrong - calling UI methods is only
    allowed from the UI thread (main application thread, which is
    where onCreate and other callbacks is called).

    Do something like this instead:

    http://developer.android.com/resources/articles/timed-ui-updates.html

    private Handler mHandler = new Handler();
    private Runnable mSplashTask = new Runnable() {
    public void run() {

    finish();
    Intent i = new Intent();
    i.setClass(Splash.this,Trial.class);
    startActivity(i);
    }
    };

    mHandler.postDelayed(mSplashTask, 5000);

    -- Kostya

    02.11.2010 11:21, Alok Upadhyay пишет:

        Hii,
        i want to display a splash screen followed by my trial.class.I
        am not
        getting any error but warning as:

        Warning: Activity not started, its current task has been
        brought to
        the front

        i have different-2 approches for this each time this warning
        is being
        displayed.
         public class Splash extends Activity
        {
               @Override
               public void onCreate(Bundle savedInstanceState)
               {
                       super.onCreate(savedInstanceState);
                       setContentView(R.layout.splash);
                       Thread splashThread = new Thread() {
                        @Override
                        public void run() {
                           try {
                              int waited = 0;
                              while (waited<  5000) {
                                 sleep(100);
                                 waited += 100;
                              }
                           } catch (InterruptedException e) {
                              // do nothing
                           } finally {
                              finish();
                              Intent i = new Intent();
                              i.setClass(Splash.this,Trial.class);
                              startActivity(i);
                           }
                        }
                     };
                     splashThread.start();
                  }
               }
        Thanks



-- Kostya Vasilyev -- WiFi Manager + pretty widget --
    http://kmansoft.wordpress.com


-- You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




--
Thanks & Regards
Alok Upadhyay
9555758721
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to