2013-07-01 5 views
1

내 안드로이드 프로젝트에서 라이브러리 프로젝트를 열고 싶습니다. 이를 위해 내가 프로젝트 A와 프로젝트 B (라이브러리 프로젝트) 내가 프로젝트 A에 라이브러리로 프로젝트 B를 추가 한Android 프로젝트에서 다른 라이브러리 프로젝트 호출

를 사용하여 데모를 만들었

다음

나는 그것을 호출 오전 방법 :

public class ProjectA extends Activity { 

    Button btn; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_project); 

     btn = (Button)findViewById(R.id.btn_project2); 
     btn.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View arg0) { 
       Intent LaunchIntent = new Intent(arg0.getContext(),ProjectB.class).setAction(Intent.CATEGORY_LAUNCHER); 
       startActivity(LaunchIntent); 
      } 
     }); 
    } 

매니페스트 프로젝트의 여기

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.projecta" 
    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.example.projecta.ProjectA" 
      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.example.projectb.ProjectB" /> 
    </application> 
</manifest> 

나는 문제가 무엇입니까 - 활동이라는지고 있지만, UI는 여전히 ACTI의 경우와 동일하게 유지 vity A.

public class ProjectB extends Activity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_project_b); 
     Toast.makeText(this, "Project B", 0).show(); 
    } 
} 

매니페스트 프로젝트의 B

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


    <application android:allowBackup="true" > 
     <activity android:name="com.example.projectb.ProjectB" /> 
    </application> 

</manifest> 

내 UI 당신은 당신의 코드에서 직접 라이브러리 프로젝트를 호출 할 수 없습니다

답변

1

를 업데이트하지 않는 이유를 알려주세요.

  1. 는 해당 라이브러리 프로젝트의 항아리를 만들 (Android 기기,> 라이브러리 -> 라이브러리 프로젝트를 추가) 프로젝트에 라이브러리 프로젝트를 추가 한 후 프로젝트 에서 빌드 경로를 추가

    당신은 두 가지 옵션이 있습니다 전화해도됩니다.

관련 문제