I have an android library project.
Two projects-A and B are using that library project code.
I have this code in the shared android library project
RequestAdFromAdmob(constantAdId)
I wish to use a different ad id for project A and project B, so what is the best practice to do it?
Thanks
Pass the hashed name of your class/project to the library
Related
Actually We've two apps.
Both the apps are almost same functionality.So, I want to reuse the code in both the apps by creating some common modules .
Can you please suggest the way?
Build one Project i.e. Project A and add modules in this project which are common to both projects
1.
Now, when you create Project B and Project C which have same
funtionality, add Project A's JAR file in B and C. This way you will
able to re-use your code Project A
2.
Another way is to create library Project A and include library to B
and C
I will recommend 1 to use because you will be reusing java code mostly which is implemented in Project A
I am going to make application with library project. My application project referred a library project.
When we build the dependent application project, library projects are compiled and merged with the application project, so application project has all the resources which library have.
But my requirement is slightly reverse from above. I want application project resources reference into library project. I want to access R.java of application project into reference library project.
Is there any way to get reference of dependent project into library project?
Thanks in advanced.
No, there is no way as far as I know. And it is also not the idea of "Lib" projects that they depend on a App Project. It is only made for a vice versa dependency.
I am building series of android projects with almost the same classes, only some sources like images are different.
I want to make it like a source or library, so that I can create projects by only referring to that source/library, inherit the class, and put in images.
For example, I create a project call "Prototype", which is the template. Then I build new projects, adding "Prototype" in Build Path -> projects. Then I extend the classes in "Prototype", it compiles. But when I run it, it says "Could not find Prototype.apk!"
Am I doing correctly? Or I need the Prototype.apk? If so, where should I put it?
Are you using Eclipse as the IDE for your Android projects? If so, you can create library projects as described in: http://developer.android.com/tools/projects/projects-eclipse.html
You can then use a library project as your Prototype.
I am having 2 android projects.Can anyone help in integrating both these project into a single one.
Actually I am trying to operate both projects from a single page which contain an option in its user interface to run either of these projects(application).
That should not be a problem if you declare these two applicatiosn as libraries and connect the new one to them. The final application will include both projects in its .apk file.
Here is how to set up a project as a library: http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject
Note that TikTakToe project in Eclipse is an example how to use libraries.
I have developed an Android library project that contains all the common code and resources
need to 2 other projects.
The problem is that in a class of common library I need to load a different resource if it is used on project A or project B, respectively.
If I type R.string.myId it doesn't find the resource because it isn't on CommonLib, but it is defined on projects A and B.
How I can resolve this problem? What is the right way to obtain a kind of 'polymorphism' on this type of projects? Maybe I put in common library a code such as
if (ctx.getPackageName().equals("packageName A")
else if (ctx.getPackageName().equals("packageName B"))
Thanks in advance.
You can add some kind of stub resource to your library project and "override" them in application projects. Or you can add default values for resources to your library project and add some of this resources to application projects if necessary.