2013-04-12 3 views
0

에뮬레이터에있는 첫 번째 앱을 만들었습니다. 그래서 두 번째 테스트하면서, 나는 그것을 실행합니다. 스플래시 화면에서는 작업을 수행 한 다음 테스트중인 앱의 주요 활동으로 이동하지 않고 앱이 종료되고 메시지가 표시되면 테스트중인 첫 번째 앱 또는 두 번째 앱을 선택하여 작업을 완료합니다. . 그래서 이것을 피하거나 앱이 사용자에게 옵션을주지 않게하려면 어떻게해야합니까?두 앱 사이의 충돌

EDIT :

APP 1

MANIFEST :

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

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="15" /> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" >  
    <activity 
    android:name="com.google.ads.AdActivity" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >   
    </activity> 

    <activity 
     android:name="com.hellhog.tfreq.Splash" 
     android:label="@string/app_name" 
     android:screenOrientation="landscape" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.hellhog.tfreq.MainActivity" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAINACTIVITY" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
</application> 

스플래시 스크린 CODE :

package com.hellhog.tfreq; 

import com.hellhog.tfreq.R; 

import android.app.Activity; 
import android.content.Intent; 
import android.media.MediaPlayer; 
import android.os.Bundle; 
import android.view.Window; 
import android.view.WindowManager; 

public class Splash extends Activity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    // TODO Auto-generated method stub 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    setContentView(R.layout.splash); 
    MediaPlayer hog = MediaPlayer.create(Splash.this, R.raw.smusic); 
    hog.start(); 

    Thread timer = new Thread(){ 
     public void run(){ 
      try{ 
       sleep(6000); 
      }catch (InterruptedException e){ 
       e.printStackTrace(); 
      }finally{ 
       Intent openSplashLayout = new Intent("android.intent.action.MAINACTIVITY"); 
       startActivity(openSplashLayout); 
      } 
     } 
    }; 
    timer.start(); 
} 

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



} 

APP 2 MANIFEST :

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

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="10" /> 
<uses-permission android:name="android.permission.CAMERA" /> 
<uses-feature android:name="android.hardware.camera" android:required="false" /> 
<uses-feature android:name="android.hardware.camera.front" android:required="false" /> 
<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.hellhogone.multitools.Splash" 
     android:label="@string/app_name" 
     android:screenOrientation="landscape" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.hellhogone.multitools.MainActivity" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAINACTIVITY" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.hellhogone.multitools.FlashLight" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" > 
     <intent-filter> 
      <action android:name="android.intent.action.FLASHLIGHT" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.hellhogone.multitools.Mirror" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" > 
     <intent-filter> 
      <action android:name="android.intent.action.MIRROR" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 
</application> 

스플래시 스크린 :

package com.hellhogone.multitools; 

import com.hellhogone.multitools.R; 

import android.media.MediaPlayer; 
import android.os.Bundle; 
import android.app.Activity; 
import android.content.Intent; 
import android.view.Window; 
import android.view.WindowManager; 

public class Splash extends Activity{ 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    setContentView(R.layout.splash); 

    MediaPlayer yo = MediaPlayer.create(Splash.this, R.raw.smusic); 
    yo.start(); 

    Thread timer = new Thread(){ 
     public void run(){ 
      try{ 
       sleep(6000); 
      }catch(InterruptedException e){ 
       e.printStackTrace(); 
      }finally{ 
       Intent h1 = new Intent("android.intent.action.MAINACTIVITY"); 
       startActivity(h1); 
      } 
     } 
    }; 

    timer.start(); 
} 

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



    } 
+0

자세한 정보가 필요합니다. – Zyerah

+0

두 패키지의 변경 패키지 ... –

+0

좋아, 뭐라구? – WhiplashOne

답변

1

그 이유는, (다른 패키지 이름으로 의미) 모두 앱이 다른 모두 응용 프로그램을 당신의 당신의 AndroidManifest를 파일에있는 동안 MainActivity에 동일한 인 텐트 필터를 지정했습니다. 두 앱에 서로 다른 인 텐트 필터를 추가하는 것을 고려해보십시오. 위의 예에서와 같이

<activity android:name="MainActivity" 
       android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="com.example.yourcustom.intent"/> 
     </intent-filter> 
    </activity> 

com.example.yourcustom.intentMainActivity에 등록 된 텐트 필터는 당신이 의도를 발생에 대한 intent-resoltuion을하고 당신의 옵션을 줄 것이다 의도 안드로이드를 처리 할 때마다 해당 인 텐트를 처리 할 수있는 모든 응용 프로그램, 즉 응용 프로그램 선택기 대화 상자를 가져 오는 이유입니다.