0

こんにちは、このスプラッシュ スクリーンを自分のプロジェクトに追加する前に、問題なく動作していたプロジェクトを作成しました。可能な限りすべてのことを確認しようとしましたが、アプリケーションが起動しません。アイコンをクリックしてアプリケーションを起動すると、「アプリケーションが動作を停止したため、終了する必要があるというメッセージが表示されます」助けてください


Androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="hellog.diwesh.NugaBest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="helog.diwesh.NugaBest.MyApplication" 
        android:debuggable="true"
        android:icon="@drawable/nuga"
        android:label="@string/app_name" >
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>





         <activity
            android:name="helog.diwesh.NugaBest.SplashActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="helog.diwesh.NugaBest.CLEARSCREEN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>






        // 4. Layout Management

        <activity
            android:name="helog.diwesh.NugaBest.FileSiganlDisplay"
            android:label="FileSiganlDisplay" />
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_WebJoinActivity"
            android:label="NUGA_WebJoinActivity"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_MainMenuActivity"
            android:label="NUGA_MainMenuActivity" />
        <activity
            android:name="helog.diwesh.NugaBest.BTSmartSlavemodule"
            android:configChanges="orientation|keyboardHidden"
            android:label="SmartSlavemodule" />
        <activity
            android:name="helog.diwesh.NugaBest.BTDeviceListActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/select_device"
            android:theme="@android:style/Theme.Dialog" />

        <activity
            android:name="helog.diwesh.NugaBest.SnapActivity"
            android:label="@string/title_activity_snap" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.ImagesActivity"
            android:label="@string/title_activity_images" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.HelpActivity"
            android:label="@string/Help" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.AboutDevice"
            android:label="@string/aboutus" >
        </activity>
    </application>

</manifest>

Intro.java : これは以前の私の最初の画面でした

public class NUGA_HealthCareActivity_Intro extends Activity {

    SoundPool mpool;
    int mlogon;
    int mValue;
    ProgressDialog mProgress;

    TextView mAnimTarget1;
    EditText mAnimTarget2;
    TextView mAnimTarget3;
    EditText mAnimTarget4;
    Button mAnimTarget5;
    TextView mAnimTarget6;
    Button mAnimTarget7;
    ProgressBar mProgCircle;

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
    }

    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
    }

    @Override
    protected void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
    }

    @Override
    protected void onStop() {
        // TODO Auto-generated method stub
        super.onStop();
    }

    Animation anim = null;

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splash_screen);
        Thread logoTimer=new Thread(){

            public void run(){

                try
                {
                    int logoTimer=0;
                    while(logoTimer<5000){
                        sleep(100);
                        logoTimer=logoTimer+100;

                    }
                    startActivity(new Intent("helog.diwesh.NugaBest.CLEARSCREEN"));

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                finally{
                    finish();
                }
            }


        };

        logoTimer.start();


        Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        long[] pattern = { 0, 300, 100, 100, 100, 300, 300, 100, 100, 100, 100, 100, 100, 100, 100, 100, 0 };

        vibe.vibrate(pattern, -1);

        mAnimTarget1 = (TextView) findViewById(R.id.Tvpass);
        mAnimTarget2 = (EditText) findViewById(R.id.EtID);
        mAnimTarget3 = (TextView) findViewById(R.id.TvID);
        mAnimTarget4 = (EditText) findViewById(R.id.Etpass);
        mAnimTarget5 = (Button) findViewById(R.id.BtnLogin);
        mAnimTarget6 = (TextView) findViewById(R.id.Tvjoin);
        mAnimTarget7 = (Button) findViewById(R.id.BtnJoin);
        mProgCircle = (ProgressBar) findViewById(R.id.progcircle);

        findViewById(R.id.BtnLogin).setOnClickListener(mClickListener);
        findViewById(R.id.BtnJoin).setOnClickListener(mClickListener);

        mpool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
        mlogon = mpool.load(this, R.raw.logon, 1);

        anim = new AlphaAnimation(0, 1);
        anim.setDuration(1500);

        mAnimTarget1.startAnimation(anim);
        mAnimTarget2.startAnimation(anim);
        mAnimTarget3.startAnimation(anim);
        mAnimTarget4.startAnimation(anim);
        mAnimTarget5.startAnimation(anim);
        mAnimTarget6.startAnimation(anim);
        mAnimTarget7.startAnimation(anim);
        mpool.play(mlogon, 1, 1, 0, 0, 1);

    }

    Button.OnClickListener mClickListener = new View.OnClickListener() {

        Animation anim = null;

        @Override
        public void onClick(View v) {
            Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            vibe.vibrate(60);

            switch (v.getId()) {
            case R.id.BtnLogin:
                mpool.play(mlogon, 1, 1, 0, 0, 1);
                anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                anim.setDuration(100);
                mAnimTarget5.startAnimation(anim);
                mProgCircle.setVisibility(View.VISIBLE);
                mValue = 0;
                new AccumulateTask().execute(100);



                //Intent intent0 = new Intent(NUGA_HealthCareActivity_Intro.this, NUGA_MainMenuActivity.class);
                //startActivity(intent0);

                //finish();
                overridePendingTransition(R.anim.fade, R.anim.hold);

                break;

            case R.id.BtnJoin:

                mpool.play(mlogon, 1, 1, 0, 0, 1);
                anim = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                anim.setDuration(100);
                mAnimTarget7.startAnimation(anim);
                mProgCircle.setVisibility(View.INVISIBLE);

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

                overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);

                break;

            default:
                break;
            }

        }
    };

    class AccumulateTask extends AsyncTask<Integer, Integer, Integer> {
        private String title = "Thank you for your patience";
        private String msg = "Loading";

        protected void onPreExecute() {
            mValue = 0;

            mProgress = new ProgressDialog(NUGA_HealthCareActivity_Intro.this);
            mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            mProgress.setTitle(title);
            mProgress.setMessage(msg);
            mProgress.setCancelable(false);
            mProgress.setProgress(0);

            mProgress.setButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    cancel(true);
                }
            });
            mProgress.show();
        }

        protected Integer doInBackground(Integer... arg0) {
            while (isCancelled() == false) {
                mValue++;
                if (mValue <= 100) {
                    publishProgress(mValue);
                } else {
                    break;
                }
                try {
                    Thread.sleep(40);
                } catch (InterruptedException e) {
                    ;
                }
            }
            return mValue;
        }

        protected void onProgressUpdate(Integer... progress) {

            if (mValue == 30) {
                title = "Initializing";
                msg = "Please Wait";
                mProgress.setTitle(title);
                mProgress.setMessage(msg);
            }
            if (mValue == 75) {
                title = "Initializing";
                msg = "Extracting, Finalizing";
                mProgress.setTitle(title);
                mProgress.setMessage(msg);
            }

            mProgress.setProgress(progress[0]);

        }

        protected void onPostExecute(Integer result) {
            mProgress.dismiss();
            mProgCircle.setVisibility(View.INVISIBLE);
            // 
            Intent intent = new Intent(NUGA_HealthCareActivity_Intro.this, NUGA_MainMenuActivity.class);
            startActivity(intent);

            finish();
            overridePendingTransition(R.anim.fade, R.anim.hold);
            // overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
        }

        protected void onCancelled() {
            mProgress.dismiss();
            mProgCircle.setVisibility(View.INVISIBLE);
            Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            vibe.vibrate(60);
        }
    }

    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        String LOGTAG = null;
        Log.i(LOGTAG, "=== onConfigurationChanged is called !!! ===");

        if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {                                                                          // Àüȯ½Ã

            Log.i(LOGTAG, "=== Configuration.ORIENTATION_PORTRAIT !!! ===");
        } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { 


            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
            Log.i(LOGTAG, "=== Configuration.ORIENTATION_LANDSCAPE !!! ===");
        }
    }

SplashActivity.java これは私が追加したもので、以前の Intro Java クラスのレイアウトであった intro.xml への参照を与えました

import hellog.diwesh.NugaBest.R;
import android.app.Activity;
import android.os.Bundle;

public class SplashActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.intro);

}

}

ここにlogCatの詳細があります

09-11 22:27:35.304: D/dalvikvm(800): GC_FOR_ALLOC freed 71K, 7% free 2543K/2732K, paused 139ms, total 149ms
09-11 22:27:35.374: I/dalvikvm-heap(800): Grow heap (frag case) to 5.455MB for 2998216-byte allocation
09-11 22:27:35.464: D/dalvikvm(800): GC_FOR_ALLOC freed <1K, 4% free 5471K/5660K, paused 87ms, total 87ms
09-11 22:27:36.034: D/AndroidRuntime(800): Shutting down VM
09-11 22:27:36.034: W/dalvikvm(800): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-11 22:27:36.044: E/AndroidRuntime(800): FATAL EXCEPTION: main
09-11 22:27:36.044: E/AndroidRuntime(800): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro}: java.lang.NullPointerException
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.os.Looper.loop(Looper.java:137)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread.main(ActivityThread.java:5103)
09-11 22:27:36.044: E/AndroidRuntime(800):  at java.lang.reflect.Method.invokeNative(Native Method)
09-11 22:27:36.044: E/AndroidRuntime(800):  at java.lang.reflect.Method.invoke(Method.java:525)
09-11 22:27:36.044: E/AndroidRuntime(800):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-11 22:27:36.044: E/AndroidRuntime(800):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-11 22:27:36.044: E/AndroidRuntime(800):  at dalvik.system.NativeStart.main(Native Method)
09-11 22:27:36.044: E/AndroidRuntime(800): Caused by: java.lang.NullPointerException
09-11 22:27:36.044: E/AndroidRuntime(800):  at helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro.onCreate(NUGA_HealthCareActivity_Intro.java:129)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.Activity.performCreate(Activity.java:5133)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-11 22:27:36.044: E/AndroidRuntime(800):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-11 22:27:36.044: E/AndroidRuntime(800):  ... 11 more
09-11 22:27:42.604: D/dalvikvm(822): GC_FOR_ALLOC freed 36K, 6% free 2543K/2696K, paused 96ms, total 144ms
09-11 22:27:42.644: I/dalvikvm-heap(822): Grow heap (frag case) to 5.455MB for 2998216-byte allocation
09-11 22:27:42.724: D/dalvikvm(822): GC_FOR_ALLOC freed <1K, 3% free 5471K/5624K, paused 78ms, total 78ms
09-11 22:27:43.464: D/AndroidRuntime(822): Shutting down VM
09-11 22:27:43.464: W/dalvikvm(822): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-11 22:27:43.474: E/AndroidRuntime(822): FATAL EXCEPTION: main
09-11 22:27:43.474: E/AndroidRuntime(822): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro}: java.lang.NullPointerException
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.os.Looper.loop(Looper.java:137)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread.main(ActivityThread.java:5103)
09-11 22:27:43.474: E/AndroidRuntime(822):  at java.lang.reflect.Method.invokeNative(Native Method)
09-11 22:27:43.474: E/AndroidRuntime(822):  at java.lang.reflect.Method.invoke(Method.java:525)
09-11 22:27:43.474: E/AndroidRuntime(822):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-11 22:27:43.474: E/AndroidRuntime(822):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-11 22:27:43.474: E/AndroidRuntime(822):  at dalvik.system.NativeStart.main(Native Method)
09-11 22:27:43.474: E/AndroidRuntime(822): Caused by: java.lang.NullPointerException
09-11 22:27:43.474: E/AndroidRuntime(822):  at helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro.onCreate(NUGA_HealthCareActivity_Intro.java:129)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.Activity.performCreate(Activity.java:5133)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-11 22:27:43.474: E/AndroidRuntime(822):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-11 22:27:43.474: E/AndroidRuntime(822):  ... 11 more

私はこの MyApplication.java も持っていますが、これはマニフェストにも記載されています...これはどこかで中断していますか?

public class MyApplication extends Application {

    private static Context context;

    public void onCreate() {
        super.onCreate();
        MyApplication.context = getApplicationContext();
    }

    public static Context getAppContext() {
        return MyApplication.context;
    }

}

4

2 に答える 2