tags:

views:

54

answers:

1

I'm using eclipse, and I have two android projects which have different topics. And I want to connect these project. I mean, I want to run one android project from other.

I tried to reference one project to other, and then run but it didn't work. Also I looked related questions and answers but it didn't work either.

Thanks

According to BennySkogberg's answer I edit my content:

The sample code in order to call different project as starting an activity is like that:

Intent intent = new Intent(this, FBFeedActivity.class);
startActivityForResult(intent, MESSAGEPUBLISHED);

And xml code:

<activity android:name="com...fbconnect.FBFeedActivity" />

I created 3 test project to try this code. two of them android project and one of them java project. When I use this code with android project and java project it works. However when I tried with two android project I get these errors: It says it couldn't find the class but there is, and I did the same thing.

08-03 14:37:23.803: ERROR/dalvikvm(1131): Could not find class 'com.androidref.ReferenceAndroidSub', referenced from method android.reference.ReferenceAndroidMain.onCreateOptionsMenu
08-03 14:37:23.823: ERROR/AndroidRuntime(1131): Uncaught handler: thread main exiting due to uncaught exception
08-03 14:37:23.873: ERROR/AndroidRuntime(1131): java.lang.VerifyError: android.reference.ReferenceAndroidMain
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at java.lang.Class.newInstanceImpl(Native Method)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at java.lang.Class.newInstance(Class.java:1472)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.os.Looper.loop(Looper.java:123)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at android.app.ActivityThread.main(ActivityThread.java:4203)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at java.lang.reflect.Method.invokeNative(Native Method)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at java.lang.reflect.Method.invoke(Method.java:521)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-03 14:37:23.873: ERROR/AndroidRuntime(1131):     at dalvik.system.NativeStart.main(Native Method)
08-03 14:37:23.903: ERROR/dalvikvm(1131): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
A: 

If you download the no longer official fbconnect for Android, you'll see how the two projects are connected to each other.

BennySkogberg
Thank you.With the help of "fbconnect for Android" code, I make a progress. However, I couldn't solve the exact problem.Because there are two separate project one of them is "api" and the other one "sample". Project named "sample" is an adroid project but project named "api" is not an android project. Therefore there is no error. When I try the same code for android to android application I get error. I edit the content of my question.
Mustafa
Thats to bad. I found this on the current site (http://developer.android.com/guide/developing/eclipse-adt.html) under the section "Working with Library Projects":An Android library project is a development project that holds shared Android source code and resources. Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.You also have example code at the right. Helped?
BennySkogberg
Thats a good resource but there is a problem that I didn't figure it out. It says make one of the project library, and use from other one. I tried as they told, but main project couldn't recognize the library. I mean, I couldn't use the method of library, because it doesn't appear at the list.I think I give up, I will try to merge two project into one manually. Thank you for helping.
Mustafa