How to embed a project inside another project? - java

I have a source code for android project and I want to integrate and embed this app inside another app ...
In other words, I need to mix 2 apps with different packages inside one app ...
Thanks for your help and waiting your review..

It depends on what you mean by "mixing two apps":
If you want to store the two projects in the same repository, you can do that without any problems.
If you want to have them in the same project to be able to edit them at the same time, why not open them both simultanously in two separate windows? When opening the project, Android Studio will ask you whether you want to open the project in this window or in a new window. Just click "New window" and you will be able to edit the projects side by side without any fancy mixing going on.
If you wish to reuse the code from one project in the other project, consider creating an android library module. That way, changes in the common code will automatically be reflected in both projects whereas when you copy-paste the code, you will have to copy changes back and forth, too.

Related

GitHub collaboration using Android Studio

My friends & I are trying to collaborate via GitHub on a basic Android- Studio project. I know how to connect our GitHub accounts through the website and through Android- Studio, that's not the issue. In other words, we've tested out test comments to commit to see if it goes through, it does successfully. The changes are reflected on the website when navigating to the appropriate .java file (i.e. the test comment).
Which files should & shouldn't be pushed to reduce the chances of errors being thrown at us? My assumption is, some of the files that are being pushed don't need to be pushed to everyone because it pertains to configurations that's related to their computer. For example, if someone decides to add a search bar and that person commit/pushed his code, how can I pull that in a way where what he's contributed appears on my machine without running the risk of tampering with my configurations?
Github defaults into a master branch (i.e. everytime you commit and push your updated project will be saved into this branch). However, Github enables you to create separate branches, which I believe is the solution you are looking for. If you want to make edits to your project but you are unsure you want to have those edits show in your actual project, create a separate branch and make those edits there. Note that Github enables you to merge branches.

If I'm using NBMS to update my application, can I make it deactivate a module that was previously installed?

I built our application using the Netbeans Framework. It's working great, we have a bundle of modules that we update using NBM (NetBeans module files).
When we ship out our product, our customers install it, and it comes default pointed to our update center web server. There it pulls the current updates.xml, containing the version number etc and downloads the relevant NBM file to update a module. It works well.
However, we have a module that's out, and I would like to push an update that would deactivate it, or even uninstall it.
I accomplished a quick fix by closing it immediately with this.close(). It's a top component so it opens by default, and it's basically a useless module right not. It causes clutter initially.
That to me is a total hack, there must be a graceful way to accomplish this in the Netbeans NBM delivery system.
I can provide some code, but I'm unsure what is helpful. This is OOB Netbeans framework functionality, so there's not a lot to show.
Thank you
Some ideas:
Post to one of NetBeans mailing lists where you can get answer from developers (https://netbeans.org/community/lists/index.html)
Add a ModuleInstall class to another module that will run a code as a part of startup procedure. Search lookup for ModuleInfo representing module that should be disabled and call ModuleManager.disable() (likely requires dependency on some internals / non-public API)
Keep the module as it is but add another one depending on it and override the top component there (make it non-vosible by default, hide action to show it, ...)

Play! framework. create a new view

I created a new project using the play console
now, by default I got in my views directory two files:
main.scala.html
index.scala.html
I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:
views.html.forums.render("Forums");
the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:
class_managed/views.html/index.class
class_managed/views.html/main.class
but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?
thanks
Your new views are compiled to managed sources after next browser hit if you are using play run for starting Play in dev mode.
If you'll use play ~run it will try to compile it as soon at it will recognize change in the file.
Finally if you started your app in production mode ie. via play start you have to stop it with ctrl+c and run again. Anyway, developing application in production mode is just a bad idea :)
Depending on your IDE most probably you'll need to refresh file structure to allow it find freshly created managed sources.
right click on ther project and click refresh, that worked for me - found it in another thread.
Found the solution.
running "compile" command did the work.
I understood that intelliJ do it auto, so I will probably use it instead of eclipse.
cheers!
If you want to program in scala, my recommendation is to forget about intellisense. Eclipses scala-ide is quite buggy, dont know about netbeans. And because of nonstandard layout of play2 application, non std development tools (play console), it becames even more handy to use simple text redactor (like sublime or textmate) with good old open-folder-as-project feature.

eclipse plug-in development in java: how to run a run configuration from another running one?

I have created two views for eclipse. Each of this views is launched using a different run configuration (meaning a different one for each view).
What I want to do:
In the first view I have a list of elements. When I double click one element I want to start the other view (maybe from its run configuration) and only then to start all the bundles.
Any clue of how to do this?
Besides, I would like to send some parameters from the first view to the second one when launching.
I hope anyone can help.
The Eclipse run configuration is list of complex settings including Main class, VM arguments, JRE paths, and Classpath. The Eclipse view, in your words, is the perspective which contains various window panes; I think that's what you mean. The 2 concepts of run configuration and perspective/view are separate implementations of Eclipse, and not related.
So…what you’re asking seems impossible for Eclipse to do and not fitting to its design.
I propose you include your source folders into the Package Explorer workspace, which is basically just a file system. Afterwards, open/close the project folder when you want to change the views, using your words. I myself switch between 2 rather different projects between pure Java and Swing, and both contain their own Main function, for testing code in StackOverflow. I think this is similar to your goal.
I am not sure what you meant by “list of elements” in Eclipse. And I may not understand your exact problem.

How to achieve modularity structure of app subcomponents on Android?

My Android main application will consist in a main program, with a few pre-installed modules.
Then I want to offer different modules later, best would be as separate files. Modules like: location, weather, agenda.
How would you accomplish this?
I want to keep in the database the modules that are installed/present. So I must put sometimes the modules into database, maybe by detecting if there are present at launch time. The main app will work based on these modules.
How can I build these modules as separate files? They won't be an entry point in my application. So they must not be an application in the navigation menu.
Is this possible?
How do I have to create this using Eclipse?
In what format will I offer the modules?
How will the user add/remove modules?
Android allows you to loosely couple applications together with Intents and ContentProviders, so it should be possible to achieve what you're looking for. The hard part will be planning everything up front, so you have logical divisions of functionality (and so things plug together easily).
I want to keep in the database the modules that are installed/present. So I must put sometimes the modules into database, maybe by detecting if there are present at launch time. The main app will work based on these modules.
You can register a BroadcastReceiver for ACTION_PACKAGE_ADDED, which will fire whenever a new application is installed. Your main application should be able to use this to determine when additional modules are installed.
In what format will I offer the modules?
You probably want to still package the modules as apks so they can be uploaded to the marketplace. If you want them to not appear in the launcher (the app drawer), you can always remove the default <intent-filter> and the app will not be launchable (but still be removable).
How do I have to create this using Eclipse?
Your modules would still be standalone applications.
How will the user add/remove modules?
From the marketplace or direct downloads off of the web (if you want).

Categories

Resources