2013-04-21 44 views
-1

內的參考圖書館我這樣做兩步瑪吉二級項目,工作區

額外的Android方式 兩個步驟是必須的:你想使用的庫項目 參考標記的項目

馬克項目 標記圖書館項目

右鍵單擊您的項目並選擇屬性。選擇左側的Android並勾選IsLibrary複選框。完成。

參考標記的項目

右鍵點擊你的項目並選擇屬性。選擇左側的Android並添加...標記的項目。它將被添加到列表中並準備使用。現在您可以從引用的已標記項目訪問所有類和資源(例如,可繪製,字符串)。真棒,呃? :)

提及這裏Eclipse Android project, how to reference library within workspace?通過poitroae 但是...我recive中找到:

04-21 18:31:13.539: E/AndroidRuntime(19255): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.uploadvideo/com.examples.youtubeapidemo.FullscreenDemoActivity}; have you declared this activity in your AndroidManifest.xml? 

和活動崩潰...

我要做的就是在主要項目中,我添加

     Intent intent1 = new Intent(this,FullscreenDemoActivity.class); 
      intent1.putExtra("current_url",current_url); 
      startActivity(intent1); 

,並在庫項目我添加

Intent intent= getIntent(); 
current_url = intent.getStringExtra("current_url"); 

我希望我可以使用意圖這個項目

感謝之間傳遞......

+0

http://developer.android.com/tools/projects/projects-eclipse.html – Raghunandan 2013-04-21 15:47:44

+0

謝謝你,我在你的文章中找到答案...坦克你。 – idan 2013-04-21 16:25:44

回答

0

我試試這個答案,這是行不通的..

Unable to start intent from application containing library

「你需要指定調用庫中定義的應用程序時的應用程序包:「

Intent serviceIntent = new Intent(); 
serviceIntent.setAction("org.example.library.MY_ACTION"); 
serviceIntent.setPackage("org.example.application"); 
startService(serviceIntent);