观看它时无法看到闪屏

时间:2012-09-26 09:44:36

标签: android android-asynctask splash-screen

我正在尝试等待,直到spalsh屏幕将超过abd然后当从Splash得到结果时,去我的代码而不是为了飞溅(AsyncTask)只是为了什么之后的意图。 希望你能帮忙。

 lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {

            String nextActivity=new String();
            Thread splashTread = new Thread() {
                @Override
                public void run() {
                    try {
                        splash  splash=(tools.splash) new splash(first.this).execute();
                        int waited = 0;
                        while(splash.running && (waited< getResources().getInteger(R.integer.splashTimeOut)))
                        {
                            sleep(100);
                            if(splash.running) {
                                waited += 100;
                            }
                            // nextActivity=splash.newActivity;
                        }
                        Intent intent = new Intent(first.this,Class.forName("activities.third"));
                     startActivity(intent);
                    } catch(InterruptedException e) {
                        // do nothing
                    } catch (ClassNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } finally {
                        finish();

                    }
                }
            };
            splashTread.start();


            try {
                Intent intent = new Intent(first.this,Class.forName("activities.third"));
                 startActivity(intent);

1 个答案:

答案 0 :(得分:0)

使用此代码

 Intent intent = new Intent(first.this,Class.forName("activities.third"));
                 startActivity(intent);
finally之前的finish()内,而不是开始尝试阻止;