2013-04-21 51 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);