0

我正在尝试将启动屏幕活动添加到我的 android 应用程序中,我正在做我在互联网上的课程中看到的所有内容,但它不起作用。它总是说“很遗憾,*已停止”。可能是什么原因?

谢谢..

我的主要活动

<code>package com.fckirbay.istatistikelkitap;

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

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.acilis);

        Thread thread = new Thread() {

            @Override
            public void run() {

                try {
                    synchronized (this) {
                        wait(4000);
                    }
                } catch (InterruptedException e) {

                    // Hata yönetimi

                } finally {

                    finish();

                    // Yeni açılmak istenen Intent
                    Intent intent = new Intent();
                    intent.setClass(getApplicationContext(), acilis.class);
                    startActivity(intent);

                }

            }
        };

        // Thread başlatılıyor
        thread.start();

    }
}</code>

我的启动画面

package com.fckirbay.istatistikelkitap;

import com.fckirbay.istatistikelkitap.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;


public class acilis extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button tablolar=(Button)findViewById(R.id.tablolar);   
        Button istatistikciler=(Button)findViewById(R.id.istatistikciler);   
        Button unite1=(Button)findViewById(R.id.unite1);   
        Button unite2=(Button)findViewById(R.id.unite2);
        Button unite3=(Button)findViewById(R.id.unite3);   
        Button unite4=(Button)findViewById(R.id.unite4);
        Button unite5=(Button)findViewById(R.id.unite5);
        Button unite6=(Button)findViewById(R.id.unite6);
        Button devam=(Button)findViewById(R.id.devam);

        devam.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.EKRANIKI"));
            }
        });

        tablolar.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.TABLOLAR"));
            }
        });

        istatistikciler.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.ISTATISTIKCILER"));
            }
        });

        unite1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE1"));
            }
        });

        unite2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE2"));
            }
        });

        unite3.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE3"));
            }
        });

        unite4.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE4"));
            }
        });

        unite5.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE5"));
            }
        });

        unite6.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE6"));
            }
        });





    }



    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

和活动清单

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.fckirbay.istatistikelkitap.MainActivity"
            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="com.fckirbay.istatistikelkitap.acilis"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.ACILIS" />

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

     </application>

</manifest>
4

2 回答 2

0

问题是您已经定义了两个启动器活动。将您的 Splash 活动设置为您的 LAUNCHER 和您的 MainActivity DEFAULT。

对于您的 Splash 活动:

<category android:name="android.intent.category.LAUNCHER" 

对于您的主要活动:

<category android:name="android.intent.category.DEFAULT"
于 2013-12-16T00:08:55.173 回答
0

在您的清单文件中,应用程序入口点应该是 MainActivity。

您的清单文件中应该有类似这样的内容。

<activity
        android:name="com.example.MainActivity"
        android:label="@string/app_name" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

好的试试这个:

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

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.fckirbay.istatistikelkitap.MainActivity"
        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="Acilis" />

    </activity>

 </application>

</manifest>
于 2013-05-18T01:04:40.130 回答