启动画面错误

时间:2017-03-02 11:00:32

标签: java android android-manifest

我创建启动画面它在第一次安装apk时工作正常但是当我 关闭我的应用程序并重新启动然后它显示错误“应用程序未安装”,当我检查Android监视器时,它显示“getServiceInstance失败!”错误我不知道该怎么做,请帮助我。

这是我的SplashScreen代码:

Intent yoursecAct= new Intent();
yourSecAct.putExtra("","");
setResult(yourSecAct);
finish();

这是AndroidManifest代码:

   public void onAcitivityResult(...){super()}

这是LogCat:

    package com.example.kamran.ebloodbank;


    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;

    public class SplashScreen extends Activity {


        /** Duration of wait **/
        private final int SPLASH_DISPLAY_LENGTH = 3000;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle icicle) {
            super.onCreate(icicle);
            setContentView(R.layout.splash_screen);

            /* New Handler to start the Menu-Activity
             * and close this Splash-Screen after some seconds.*/
            new Handler().postDelayed(new Runnable(){
                @Override
                public void run() {
                    /* Create an Intent that will start the Menu-Activity. */
                    Intent mainIntent = new Intent(SplashScreen.this,MainActivity.class);
                    SplashScreen.this.startActivity(mainIntent);
                    SplashScreen.this.finish();
                }
            }, SPLASH_DISPLAY_LENGTH);
        }
    }

2 个答案:

答案 0 :(得分:0)

好的,发现了问题。 Android支持存储库丢失了。安装并重新启动Android Studio后,它可以正常工作。

答案 1 :(得分:0)

Update yourAndroid repository and use invalidate caches / restart option in android studio.

public class SplashScreen extends Activity {

    ImageView imglogo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Sellerregistration_Pref=getSharedPreferences(HttpUrls.Sellerregistration_Pref, MODE_PRIVATE);
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        /*getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);*/
        setContentView(R.layout.splashscreen);
        imglogo=(ImageView)findViewById(R.id.imglogo);
        Thread timerThread = new Thread() {
            public void run() {
                try {
                    sleep(2000);
                }
                catch (InterruptedException e) {
                    e.printStackTrace();
                }
                finally {
                    String User_Email_id=Sellerregistration_Pref.getString("seller_name","");
                    if(User_Email_id.isEmpty())
                    {
                        Intent intent = new Intent(SplashScreen.this, LoginActivity.class);
                        startActivity(intent);
                        finish();
                    }
                    else
                    {
                        Intent intent_landingpage = new Intent(SplashScreen.this, LandingPage.class);
                        startActivity(intent_landingpage);
                        finish();
                    }
                }
            }
        };
        timerThread.start();
    }
    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        finish();
    }

}
相关问题