Eclipse how to add a widget to an existing Android project - android

I have a project that I am almost done with. One thing left that I want to do is add a widget to the project. I see lots of tutorials on creating widgets, but what I don't see is how to add a widget to an existing project. They all start off with "create a new project and call it MyFirstWidget". The bottom line is I want to be able to download one package and have that include the main app and the widgets. What do I do in eclipse to get started?

The App Widgets developer page at android.com seems to do a good job of explaining how to implement a widget, and it's not specific to creating a new project.

Related

Add test package to existing Android Studio project

I have an existing android app and I'm trying to implement some junit tests. Normally (with Android Studio 1.2) the test package is created automatically. If I try to manually create folders to mimic the structure I've seen elsewhere there is either no option to create package under those folders, or I can't name it what I should be able to without it being placed under the existing package. Anyone know how to properly add this just as it would have been when auto created?
Every article covering this assumes its already there... like this one:
http://evgenii.com/blog/testing-activity-in-android-studio-tutorial-part-1/
This may not be the best way to do this, but I just created a new project, let it auto-generate the test package, and moved everything from my old project into the new one. There were a few references after the refactoring that needed to be cleaned up but it worked quite well for the most part.

Can i create an android application as template?

I'm not sure if its the right title but ill explain what i mean.
I'm making more than one android application, but they have the same structure
sliding menu , list view , about me , costume dialog with (copy,share,like)
with some modifications in the styles (colors, backgrounds , fonts , menu strings )
my qustion is : is there any way to use the structure as library or implemntation or anu other way
insted of coping the same codes in every projects ?
Basically what you want to do is to create an Android library. Just develop it like a normal application, with Activities and layout.
Please follow this tutorial to set up your project. http://www.vogella.com/tutorials/AndroidLibraryProjects/article.html
When you'll create a new project with the given library, all your code will be silently included and you'll get access to your Activities and even to your R class.
Try Android studio - Official IDE for android development. Simple to use.
There is an option to save your project as template. Tools > Save project as template
For eclipse I think you need to write plugin https://stackoverflow.com/a/4992150/3020568

How can a widget be created in Android Studio?

I recently started using Android Studio instead of Eclipse. Previously I made a widget in Eclipse and when switching to Android Studio, I could easily open it there.
However, I can't quite figure out how to create a blank widget in Android Studio. When creating a new project in Android Studio I can choose between a Blank Activity, a Fullscreen Activity or a Master/Detail Flow. Since I'm making just a widget and not an activity the first two aren't the right ones and the third one doesn't seem to be what I want either.
Hi I can see this might be an old question but. Hope this helps newbies...
I am using Android Studio 1.0.2 and has some awesome features to generate most of the stuff that if you follow many tutorials out there. Is just a click away. On android studio i'm using just right click, select new and Widget App > then every file needed is generated for you based on the size of widget you want.
Happy coding .... !
When you create a new project, just uncheck the "Create activity box"

Combining several android applications together

I am working on an android group project in college and this is the first big project many of us have worked on.
We worked on implementing several pieces of the project as completely separate projects and now are having trouble putting all of them in one application with a main page.
On the main page of the application we would have a bunch of buttons that would then go to the implemented project that we've completed (example, I click on BMI calculator on the app homepage and it goes the the bmi calculator screen).
Any efficient way of going about this that can be explained in an easy to follow manner? I'm still a newbie programmer :)
Just to clarify, I don't want it so that it just launches a BMI calculator app from the main app, the entire code base is supposed to exist under one app.
Thanks
You can have a main project and several other projects declared as library projects.
In build time, library projects are pulled into the main project and only one apk will exist as the output.
The library projects are almost the same as an usual android project. You can have java packages, res folder, lib folder, etc.
Check here for the official description.
Check here for a tutorial.
Look into making the other applications as Android Library-projects, and listing all necessary components on your AndroidManifest.xml on your parent project.
Another way would just give the option for the user to install these applications as separate and have a logice (PackageManager) check if specific application exists or is installed and then enabling navigation buttons or disabling components and invoke them via Intents.

Android: How do I create reusable components?

I've spent a while scouring the net for some sort of information on this, but to no avail.
I'm working on an app for which I needed to create some components, some of which would be likely to have other applications, so I'd like to put them in their own package or project, but am not sure what the correct way to do this is.
So my main project is called something like...
<companyname>.<productname>
And I've called the package for my widgets...
<companyname>.widget
I created a separate project for the widgets and moved the relevant code, layout, resources etc over. That project seems to compile properly, but the main project no longer recognises any references to the widgets.
I added the new widget project to the main project's Project References, but that made no difference.
Any ideas or links to tutorial on how to do this correctly would be much appreciated.
Have you tried setting up a library project?
https://developer.android.com/guide/developing/eclipse-adt.html

Categories

Resources