2016-11-14 9 views
0

MainActiviyから始めるとうまくいきますが、別のアクティビティを追加してボタンをクリックしてメインアクティビティに移動すると、残念なことに作業が停止します。新しいアクティビティをランチャーアクティビティとして定義します。アプリケーションの起動時にその表示されますが、私は私の主な活動のためのボタンをクリックすると、ここで働いて停止は私のmanifistアンドロイドの次のアクティビティでエラーが発生しました

<?xml version="1.0" encoding="utf-8"?> 

<!-- 
    The ACCESS_COARSE/FINE_LOCATION permissions are not required to use 
    Google Maps Android API v2, but you must specify either coarse or fine 
    location permissions for the 'MyLocation' functionality. 
--> 

<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true"/> 

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="com.myapp.android.locationapi.maps.permission.MAPS_RECEIVE"/> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 

<permission 
    android:name="com.myapp.android.locationapi.maps.permission.MAPS_RECEIVE" 
    android:protectionLevel="signature"/> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <uses-library android:name="com.google.android.maps"/> 

    <activity 
     android:name=".chek" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme.NoActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN"/> 

      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 
    </activity> 
    <activity android:name=".SignIn"/> 
    <!--   <activity android:name=".MainActivity"></activity> --> 
    <activity android:name=".Signup"/> 
    <!-- 
     The API key for Google Maps-based APIs is defined as a string resource. 
     (See the file "res/values/google_maps_api.xml"). 
     Note that the API key is linked to the encryption key used to sign the APK. 
     You need a different API key for each encryption key, including the release key that is used to 
     sign the APK for publishing. 
     You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    --> 
    <meta-data 
     android:name="com.google.android.geo.API_KEY" 
     android:value="AIzaSyDauI14NETaUpIitn9lfYvkar11cKKNhIc"/> 

    <activity android:name=".MainActivity"> 
    </activity> 
</application> 

されており、ここでの活動を開始するために私のコードです:ここ

startactivity(new Intent(chck.this,MainActivity.class)); 

は私のlogcat

です
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nexurs/com.example.nexurs.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. 
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455) 
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2517) 
                    at android.app.ActivityThread.access$800(ActivityThread.java:162) 
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412) 
                    at android.os.Handler.dispatchMessage(Handler.java:106) 
                    at android.os.Looper.loop(Looper.java:189) 
                    at android.app.ActivityThread.main(ActivityThread.java:5529) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at java.lang.reflect.Method.invoke(Method.java:372) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) 
                   Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead. 
                    at android.support.v7.app.AppCompatDelegateImplV9.setSupportActionBar(AppCompatDelegateImplV9.java:199) 
                    at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:133) 
                    at com.example.nexurs.MainActivity.onCreate(MainActivity.java:38) 
+0

はあなたのLogcatの出力を投稿してください。 – rhari

+0

あなたのlogcatを表示してください –

+0

私は私のポストを更新 –

答えて

0

は、@スタイル/ AppTheme.NOactionBar内側の2行

<style name="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    </style> 

を追加それ以外の場合はアンドロイドを削除:テーマ= "@スタイル/ AppTheme.NoActionBar"

+0

まだ動作していません。 。ツールバーを削除すると=(ツールバー)findViewById(R.id.toolbar); setSupportActionBar(ツールバー); mainactivityの作品から、しかし私のナビゲーション引き出しのアイコンが表示されない –

関連する問題