I have a library module and Main module and I try to start the activity that is defined in library module from other android application. I tried many ways but I didn't succeed. I tried to...
set Component name
set class name
class for Name
Also, I declared activity tag in my manifest.
What should I do?
Related
I need to add an activity tag for an external library I'm using, per their documentation, but when I do that using this code
<activity
android:name="com.adityaanand.morphdialog.MorphDialogActivity"
android:theme="#style/MorphDialog.Custom.Light">
</activity>
in my application tag, I get the error
Unable to find explicit activity class {com.jggdevelopment.simpleweather/in.adityaanand.morphdialog.MorphDialogActivity}; have you declared this activity in your AndroidManifest.xml?
How can I include an external library's activity in my manifest file?
This is the library.
All I had to do was change the activity name to in.adityaanand.morphdialog.MorphDialogActivity and it worked. I thought I had tried that already, but I guess not.
I'm writing a custom Android native module that needs to create an activity. I've added the activity to my ForgeModule project AndroidManifest.xml, but when I run the ForgeInspector project, ForgeInspector cannot find the activity when I start the intent.
Is there something special I need to do to get my module's manifest to get incorporated in the final product?
Here is the error when the intent is used to start the activity.
12-05 13:44:56.493: D/Forge(3867): Returned: {"content":{"message":"Forge Java error: ActivityNotFoundException: Unable to find explicit activity class {io.trigger.forge.android.inspector/io.filepicker.FilePicker}; have you declared this activity in your AndroidManifest.xml?","type":"UNEXPECTED_FAILURE","subtype":null,"full_error":"android.content.ActivityNotFoundException: Unable to find explicit activity class {io.trigger.forge.android.inspector/io.filepicker.FilePicker}; have you declared this activity in your AndroidManifest.xml?\n\tat android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1556)\n\tat android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)\n\tat android.app.Activity.startActivityForResult(Activity.java:3391)\n\tat android.app.Activity.startActivityForResult(Activity.java:3352)\n\tat io.trigger.forge.android.modules.filepicker.API.importFile(API.java:26)\n\tat java.lang.reflect.Method.invokeNative(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:511)\n\tat io.trigger.forge.android.core.ForgeApp.callJavaFromJavaScript(ForgeApp.java:316)\n\tat io.trigger.forge.android.core.ForgeJSBridge$1.run(ForgeJSBridge.java:25)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)\n\tat java.lang.Thread.run(Thread.java:856)\n"},"callid":"3AF217BD-F5B7-4873-A47F-CE3BF6D53214","status":"error"}
Did you correctly define the intent-filters and actions in the ForgeModule project AndroidManifest.xml file?
I am working on a project that has one main module(here I have the activities and the controllers..) and some secondary modules where I have some calendar and other implementations.
In the main module I have a Application singleton class where I store the application context and I can get the app context statically from everywhere within my main module.
The question is how can I make another application class in the secondary module? Currently I am using circular dependencies between the main module and the module where I want the app context, and I don't like too much to use this approach.
#David Wasser wrote:
Why can't the code in the secondary modules call MainApp.getInstance() to get the application context? Obviously the secondary module is dependent on the main module so I don't see how this is a circular dependency.
If not, then pass the singleton application context from the main module to the secondary modules (either as a parameter in method calls or as a parameter in the constructor of the component in the secondary module. Then you won't have code in the secondary modules calling MainApp.getInstance(). In any case you cannot have another application class as there is only one application class.
I have copied an activity class from the internet : get user input
When I had the activity class inside the project, as a class file - it worked fine.
When I inserted the class +layout file into a different project (my dialogs.jar file) I could not start the activity.
The activity (TextEntryActivity) is under "com.xyz.dialogs"
My project is under "com.xyz.thisproject"
First I got the "activity class not found" error:
"AndroidRuntime(487): android.content.ActivityNotFoundException: Unable to find explicit activity class ..."
Then I read in an article that I should insert the startActivityForResult into a try/catch and I did.
The result is :
Activity is not shown
onActivityResult is fired without any action from the user
Notes:
I put the activity in both manifests (first only in jar,then in my project, then both)
I have another class (not activity!) in that JAR file and its working fine (a OK only dialog I build with dialog builder)
My questions are:
Is it at all possible to put an activity in an external library ?
Is it ok that that the layout file is in the jar (its only a textbox with two commands ok/cancel)
Where should I declare the activity (which manifest or both?)
How should I declare the activity (I saw samples with "ActivityName" and some other samples with ".ActivityName" where should I use what method...)
Thanks in advance
Guy
I have at least a workaround:
Make an Eclipse library project with your activity (there is an is-library property in the Android properties of an Android project) and make your second project use the library project. Here is more information on that topic: http://developer.android.com/guide/developing/projects/projects-eclipse.html
Then subclass your activity and declare the subclass in the manifest. This works around the package issue.
Assuming I have a shared activity class defined in a Library project, which does not change for any application using it and thus does not need to be subclassed, can I get a way with creating applications without subclassing this activity for them?
To better explain my question, say I have a single activity in a Library project:
public class LibActivity extends Activity {
...
}
And now I am creating an application using that Library project. Do I really need to create
public class AppActivity extends LibActivity {
// totally empty!
}
Only so that the application have its own activity to be referenced in its own AndroidManifest.xml?
Can I get a way with a minimalistic approach, in which I subclass the activity only if I need to modify the library's activity core behavior?
Here is the fully qualified answer:
Yes, an activity based application doesn't have to derive an activity from the library's activity. The application simply uses the library's activity verbatim, unmodified.
Yes, I can get a way with a minimalistic approach, in which I subclass the activity only if I need to modify the library's activity core behavior.
I have been able to verify this with an AndroidManifest.xml that is identical in both the library and the application. It would be interesting to see whether some of this redundancy can be eliminated. I will experiment with this and report back.
UPDATE: Sure enough, it is possible to create a perfectly running application in which the only activity is defined in the library and the library's AndroidManifest.xml doesn't have any <application> or <activity>! This is possible if the application's AndroidManifest.xml has them.
You can reference library Activity classes directly from your application AndroidManifest.xml. Just specify the fully qualified name like so android:name="com.example.LibActivity"