I'm creating an application with a rather dynamic UI that allows users to add/change the positions of its views and layouts dynamically. If the user decides that current UI design satisfies him he would be able to save all views(buttons/labels/switches/etc.) of the activity into a list of "saved" activities. Is there a possible way to clone an activity or at least save the positions of all views and layouts? I saw that views have functions .getX() and .getY() but as far as I understood it is only within a layout.
Update
I found a solution that works. I created a simple Sqlite Database the stored the XY locations/names/text/id of all my views in to a table dynamically and then displayed them in a list of 'saved' configurations. The hard part is creating dynamically again all the views after you get the DB. If there is a request, I can also put some code up.
I'd create a base-activity, that has the functionality that both of your Activities need. This functionality would have to be slightly abstracted so that both activites could use this functionality by extending this BaseActivity and use it for their individual purposes.
If you post some code (the part of code both of your activities should have), I could update my answer to show you how that would look like in your case.
Further,
Step #1: Open the old project in Android Studio.
Step #2: Open the new project in Android Studio, choosing to open it in a new window (rather than the window you have from Step #1).
Step #3: Drag and drop the Java class files from the old project into the new project.
Step #4: Drag and drop the resources used by those Java classes from the old project into the new project.
Step #5: Find the elements from the manifest of the old project and copy those into the same basic location in the manifest of the new project.
Related
I am developing several song book apps with basically the same functionality. I have developed "Evening Light Songs" and "Wahrheits Lieder". The main things that change between the two apps are the images and the database.
Right now I have them in separate projects. When I find a bug or make an update, I have to go to each project and change my code. Is there a way to bundle the code that is the same in both apps into one place so I only have to change it once? Then I could have other classes specific to each app that I would change separately.
Thanks!
i am trying to create an activity for users to input data in an android application. Many inputfields are required and i therefore wanted to make them into multiple fullscreen scrollable pages.
Like this only with input fields in each slide
I have downloaded the code from this git: https://github.com/akrajilwar/Android-Intro-Slider-Screen, but i dont know how to put input fields in each of this views. As you can see in the git; each of the sliding pages are different xmls but they have no corresponding java files. All code is in a java file which has a viewPage in it.
I am struggeling to come up with any ideas on how to do this. I cant find something similar any place on the internet and need some advice for how to do this, either building on what they already have done in the git or something completely different.
I have looked quite a few places but can't seem to find this specific solution. I am interested in creating a menu that will always be visible across every layout/view of the application. This menu would act much like the header/menu of a website that is fixed and always exists across all pages of the site. I assume I can simply create a menu and have it's visibility shown from initialization but I'm not sure if that's the best way. I don't want the user to have to click any other buttons to open the menu, I just want it fixed and constantly visible from the start of the app.
Thank you.
Any help is appreciated.
Fragments, they are a way to define parts of the user interface. They are similar to activities, they have their own lifecycle. They are also closely tied to the life cycle of their parent activity.
You can add them statically by declaring them in your xml manifest and in your layout file
-or-
you can add them dynamically in runtime by creating them as java objects and xml layout files and then add them using the FragmentManager class.
check out the Documentation on the android developer website
https://developer.android.com/guide/components/fragments.html
also, check out some tutorials on youtube, I like these ones especially:
https://www.youtube.com/watch?v=6GyGtCMoR_U&list=PLonJJ3BVjZW4lMlpHgL7UNQSGMERcDzHo
Good Luck!
I've recently setup eclipse and the android SDK on a new computer but I fear something has gone wrong when setting it up.
When I create a new android project with a blank activity two files I've never seen before appear:
fragment_main.xml
and
appcompat_v7_2
What are they and do I need to worry about them?
appcompat-v7 :
As stated in Android's Support Library Overview, it is considered good practice to include the support library by default because of the large diversity of devices and the fragmentation that exists between the different versions of Android (and thus, of the provided APIs)
Reference : Why does Eclipse automatically add appcompat v7 library support whenever I create a new project?
Fragment_main :
fragment_main.xml is the Layout for the fragment.
Refer this : Building a Dynamic UI with Fragments
hope this helps
The first, let read code in MainActivity!
You can see fragment_main is layout of one fragment in it.
when application running, fragment will be added to layout and show this layout.
Let read more about here for understanding about fragment. It is very important if you want to make android app.
i am iOS app developer. Now when i created an app on iOS i want to do the same on android. With java i was familiar just now need some time to remember.
i was looking at some tutorial how to do one or other things. But what i can't find is the basics how everything works. How classes is interacting with each other.
For example i want to create registration window with few buttons and alerts.
I want registration window to be called just once when app is installed and just that.
Should i create new java class and few layouts, one for View with buttons and other for Alerts ?
Or should i create other class for alerts if i need them in other flow of my app ?
And how i should call that window with registration from my main class, which is
extends Activity
Also if there are some developers who came this road from objective-c (iOS) to java (android). It would be nice for some share experience how they did that.
Thank you for any help :)
Very few of the concepts in iOS and Android are similar. On Android you have Activites, Intendts the Manifest. When you design your layout it should be resolution independent. You have a search, back and a menu button and variable hardware. All of this has no equivalent in iOS.
That said, I think you just have to read the basic concepts and the getting started guide no matter if you come from iOS or never have done mobile development before.
EDIT
To answer your concrete question. Take a look at the lifecycle of an Activity and Preferences. With this, you could do some action on the first start of your main Activity and store some flag in the preferences when it's done. On the next start you just test that preference and skip the logic.
You can create one activity (.java file) and one layout(.xml file with buttons and input boxes) , alerts could be toast notifications:
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
All you require for this is a activity and a layout xml for that activity, this activity will be your main ie the entry point to your application, in that activity oncreate method you can check if it is registered or not by setting a flag or something which will direct to the next activity if its registered.
GOOD LUCK...
Just like your nibs in iPhone you create xml layouts in Android. And for view controllers here you make activity. One important thing is AndroidManifest.xml file, it contains all information of your app (like plist) plus all the activity information(Intent type and launcher methods).