I'm sure you can help such a newbie like I am.
I created a project in android and I want to use it as a model for next 10 and more apps, just changing the raw sources.
I mean I want to make some products i.e. 10 videocharts about norway, I make one project with the needed activity and resources so each app will differ only for the content value.
I will keep of course the same file name too if needed.
How can I save the project?
Cause I tried to make a new project from resource but I get an error on top of the tab saying Manifest is not present in the folder while manifest is actually there, and I cannot proceed further.
Thank you
ANgelo
This sounds like a place to use an Android library project.
Related
I'm a newbie to Android studio and is going to start with my first project.
As per a tutorial, I created an empty activity project. But when my project screen opens, I can neither see any main file that is created after making a new project nor I can see the editing area where buttons, text, etc are dragged to make the UI.
I can only see a black screen on the right side with some tips and 2 folders on the left side - Gradle files and project.
So where's the problem? And how to fix it. I searched this question on many sites but was unable to find an easy and understandable answer. Pls if anyone can answer, I'll be obliged...
EDIT
As this was my first question on SO, the question was poorly stated and formatted. Apologies for that...
Although, I have solved what the problem was (was a silly first-time thing), I am attaching a screenshot of the problem(it's not the exact same as what I was encountering 2 years ago but similar to it) image.
One needs to wait for all the Gradle background tasks to finish and needs to expand the app folder to see java classes or layout files, drawable etc..
Take a look at the docs on how to make a new project and the project folders hierarchy
here https://developer.android.com/training/basics/firstapp/creating-project
Mainly after you create a new project and open it, you will get two main folder app and Gradle scripts, so in order to access your project packages you only need to expand the app folder then you will find the manifest file, java folder where you will find your project activities, and a res folder, here you will find your main ressources folders like drawable, layout and values.
In order to change and add UI elements you need to access the layout folder and that's what you are asking for.
So to resume, to access the java code
app > java > com.example.myfirstapp > MainActivity
To change and create your UI
app > res > layout > activity_main.xml
I would like to rename all of my java classes and layouts that starts with the prefix tranp_ to event_. I can do that one by one using the combination Shift+F6 but it is taking too much time (there are more than 20 files). Is there a quicker way to do that in bulk?
Although is an old question, I feel it's worth answering as there is a valid solution.
Open the project with AndroidStudio, then right click on the main project's folder, select "replace in path" and enjoy it. I just replaced 400 occurrences in less than 40 seconds, just make sure you really need to replace all statements!
There seems to be no feature implemented to rename multiple files at once through refactoring provided within the Android Studio.
I also feel the need to have such feature as I keep changing my decision to name elements of certain category to some specific manner and thus have to tediously do it one by one. Which in many cases causes the bug.
I hope the future version will have it but till then what I am doing best at the moment is use the 'ctrl+r' feature to search all the occurrences of the item and replace it with what I want to rename to. And then do it again on all places where the element has been referenced. And then at last to make sure that there are no errors caused by the recent renaming I just run it. If any errors like "resources not found" then the Android Studio does point me to the location of the error, which generally is the place I left to rename.
Although this is not a sure way but it has helped me quite a lot when you have to rename lots of elements instead of 'shift+f6'.
So since I have tried the reply before me and it didn't help, I actually did find useful to open the direct path of the files I want to change, selected all of them and just pressed on rename(On MAC). It gave me the option to replace specific letters in all of the files. Made my life much easier after changing about 30 files, and noticing I have another 250 to change at least.
I'm having a lot of doubts and after two days of searching I still haven't found a good answer for my problem.
I have an app's project that is already in the store and this project have lots of Activities, Fragments, Services, IntentServices, Layouts, and resources (images, strings, integers, colors, styles, raws, drawables, etc...).
Now, I need to implement a new app that is almost a copy of the first one where I need only to change the background, some resources (but almost 99% stay the same), and maybe in one or two fragments I'll need to change some code (implement different logic statements).
I decided and I think it's natural to convert the all project in an library project.
I did:
1º Create a new project called framework and configured as library. Copied all code and resources (with the exception of assets folder) from the original project to here.
2º In the original project I leave only the manifest, proguard file. I change the manifest and proguard file to reference the classes of the new library.
I tested the app to see if was still working and it was Ok. Until now I did only the separation.
Now, came the problem. I need to create a solution reusable,and scalar for the library that allows me to use it in different apps.
In my original project I created a subclass of Application class that I use for global variables.
Without any others ideas, I decided the following:
1º Convert my MyApplication class in an abstract class. Also, I create an interface ApplicationInterface with some methods like isBackgroundOverlayed() or getBackgroundResource() that I use in the fragments to change the backgrounds or any other logic from the originally defined.
2º In the App's project, I created a new Application class that extends the abstract class MyApplication and implements the interface ApplicationInterface and which is declared in the Application tag in the manifest file.
Conclusion: This all works and I was able to have two app's projects with different background and other images like logos and even change some code logic. An example is in the original App when the user press one certain button, the App shows a dialog choice. In the new app when the user press the button it execute one fragment (without choice).
My concerns: I don't feel this is the best solution for the problem or best practice or good "pattern".
Do you have any ideas?
Thank you in advance!
ps: Sorry if I haven't use this forum properly. I search for an answer but I didn't found any.
I think you have achieved what you wanted, but that was a lengthy and time consuming process. One more thing I would like to mention is you should not change library projects for different applications
As said on Android developers guide :
Library projects contain shareable Android source code and resources that you can reference in Android projects. This is useful when you have common code that you want to reuse.
you can read more from here
Also you have to figure out,which lib is doing which work in case you forget what changes you have made
I would suggest you to keep a separate copy of original project and then import it into new work space in Eclipse (by checking copy project into current work space so that you have a new copy of your project) and consider changing its package name to get a new project
you can refer ans on this link to see how to change package name`
I've created an app which pulls data from a JSON file and displays it.
Now that app is specific for one sports team. I want to create the same app for 10 other teams.
Plus there will be an accompanying pro version of the app.
I'll be doing the same thing for the iOS version.
The only difference between the apps will be colors, logos and url of the data source.
I wanted to know if there was a better way to create apps. Instead of individually creating 40 different projects.
It will help me in updating the app as opposed to copy pasting the same code 40X.
Are there any special features available in eclipse and xcode to do that?
Thanks
I would simply swap out the resources for each team and rebuild the app.
For example, with Android, maintain an AndroidManifest.xml and a res/ subdirectory tree for each team. When it is time to build, simply copy over the resources into the project, overwriting the previous team.
I don't know of any existing tool to do this automatically, however.
Have you looked into using PhoneGap and just create a "mobile site" that detects the app that is connecting and adjusts the data/styles accordingly.
There's always the possibility of creating ONE app allowing the user to set the team preference upon first load, and swapping out resources programmatically.
With Titanium Studio you can write code using Javascript and it convert your code in native objective-c code, native android code, native html 5 code and soon also in windows phone code. It`s the best free cross platform IDE
Upon reviewing your responses, you seem to want a strategy to manage your resources. Since different OS has different resource requirements (screen-size, iOS 2x png for example). The most common strategy is to keep a separate resource structure and setup build target to copy/xcopy replace these image resources before build. Source control + an OSX build server would be most beneficial.
After creating these apps I've found the following way to be the most easiest way to create a similar app.
Android:
1. Select the project from the project explorer sidebar copy it and then paste it. Give it a new name.
Select the new project and then right click > Android Tools > Change Package Name.
Give it a new package name. Eclipse will give you an option to refactor the code, say yes.
Go to res/values and change all strings.
Change the icons and other images.
Go to src click the package and then refactor it. Give it the new package name.
Go to manifest file and rename any old names which might still be lingering.
I am fairly new at developing for Android and was hoping to get some help with something.
First, just a brief idea of what I am trying to achieve.
Within the app I am developing, the user can create a project profile for each new project he starts. I have already created the code to create a new XML file for each new project which is stored on the SD Card.
Now I want to create a list of the various projects on the main screen for the user to select from, but I'm not 100% sure how to go about this. My first thought was to have an XML file called Projects List which lists all the projects that have been created. But I just can't seem to figure out a way to update an XML file every time a new project is created, and this is where I was looking for some help.
Can someone please help me to understand how to update an XML file?
Thanks in advance for any replies.
My first thought was to have an XML file called Projects List which
lists all the projects that have been created.
Instead of doing this, why not simply see how many xml files there were created(corresponding to projects created)? I assume that, now, you're saving those project in a folder created by you on the SD Card so when it's time to show that information to the user simple check your projects folder, see how many there are(get the names, get a reference to those xml files so you could open them on a user action etc) and present them to the user.
This would be a lot simpler then implementing the logic to update a xml each time the user does some changes to the projects, not to mention the case when the user might delete those xml files when your app is not running.
I would do the following.
The user create some projects - and for each project you have an xml file.
You check for all xml files - grab a bit of info from each, and build a ListView :
Android listview example
From here you can create a custom adapter which would do the hard work of working out what information you need from each XML file and then when the user clicks the 'browse projects button' they can see all projects in a listview?