Im kinda new on developing for Android, and now i have decided to make a simple apps for my frens and me.
I know how to design the layout, but when it comes to the "activity" I always messes things up..
So now to my question - I'm creating a app to show my college schedule so I have 6 buttons (monday tuesday wednesday etc.) Then when I click each button I want to get to another screen with todays schedule..
How to I create new screens in an easy way? please answer steps by steps with screenshot...
Here are the steps:
What you are calling a new screen is Activity. Read what is Activity and its Life Cycle.
Read How to create activities: Best way to add Activity to an Android project in Eclipse?
Since you've mentioned that you've already created the Buttons do this:
See How to set a listener on Buttons, so that you can perform some action on it (eg: start Activity) when Button is clicked. Read Android: how to handle button click
See How to start a new Activity: How to start new activity on button click
Its turns out that rather than steps by step pictures, what is required is breaking the problem into multiple small problems and try to search if anyone has solved it before.
This would be the starting point. Hope it helps.
Related
I'm looking to have a window pop up at the very start of my android app with two options on it.
I have two functional buttons already in my app and I'd like the user to pick one of the two buttons before they get in to the app.
Lets say the screen pops up at launch and I'd like it to say "Please choose either 'button1' or 'button2'"
I've found a few solutions but none that I can actually get working...think that might be might novice status though.
Thanks for any help.
You should create a splash screen (many tutorials can be found on this, here is an example). After having this activity, you can create a Dialog with 2 buttons (example here).
You can set a positive and negative button on the dialog to do this, and also use a callback for the click behavior (example here).
What i want is to build an app that reads very long text from database and display it into lot of pages. And i also wanted to have onTouchEvent i think for the First screen. And will be shown like this, http://imgur.com/BZ6FC3m,ja0qNX5#1. When its touched it will like this http://imgur.com/BZ6FC3m,ja0qNX5#0. Can you help me with this, i just wanted to know where should i start from here. Maybe some link which is just like this or something like this one, just something i can refer to and get started
u can use "SystemUiHider"
for example create new project in android studio , in "Add an Activity " Select FullScreen Activity and run :)
I was really confused about this topic, so I had to ask. Being new on Android, I was thinking of creating an introductory sort of tutorial like page for the app I am working on, like the one's you see on various apps that is used for the first time in which they point out various features of the app, what functionality does this button perform when pressed, what does the menu item do, in a sort of a dynamic way.
What are these actually ?? Are they splash screens? Or are they something really different?
I just made a tutorial screen for my app. What I did in my case was to :
1) Create snapshots of all the activities and their functions.
2) Then I used photoshop to put different markers defining the different areas in the snapshot and what they do. (which look similar to the link posted in the above comments)
3) Then I used an Imageswitcher with a next button at its bottom. At the start of the app if the user wants to view the tutorial I just start an activity with the Imageswitcher.
4) I then cycle through all the snapshots with the help of the next button below the ImageSwitcher.
5) On the last image of the ImageSwitcher I just launch an Intent to open the main screen of the actual app.
Hope this helps!!!
I am going to code a walkthrough tutorial for my app.
I wish the user will follow the step of the tutorial. So I want to force the user to click on a specific button but not other parts of the app.
My app has many UI components and some of them are added programmatically so disabling them one by one is not practical.
One immediate solution is that I make a transparent Activity to cover the original Activity.
But I don't know how should I detect the touch event through the overlay Activity to operate the original Activity.
Or are there any better way to make a walkthrough tutorial on android apps without much affects to the original code? Tutorial is an adhoc feature and I dont want these adhoc features to ruin my coding with a lot of if-statement on every Activity.
Thank you.
Activity won't work. Only the one at the top of the stack can process infos.
Simply add a semi-opaque view above the screen using a relativelayout
Then simply monitor the ontouch event of this view. If the touch is in the accepted zone of the tutorial, then let it bubble up to underneath control. If if is outside the accepted zone consume the event.
Button btn = new Button(getActivity());
btn.setText("Next");
// Adding button to bottom
lv.addFooterView(btn);
This is a bit difficult to explain, so I'll try to give a simple example to what I'd want to implement.
A. When the menu button is pressed in the Market app there are some kind of tabs on the buttom, how can I implement this ?
B.now press the settings (after you press the menu button in the Market app),
Is there a way to create this kind of a layout or I have to start from scratch (I would really appreciate code example for this if there is no 'easy' way to do this).
What you are referring to here is not a layout. This is the standard way of creating menues in Android applications.
Have a look at the following topic in the Android developer guide: http://developer.android.com/guide/topics/ui/menus.html
And regarding your second question: for settings/preferences, you can use a PreferenceScreen/PreferenceActivity. This is shown pretty well here: http://www.javacodegeeks.com/2011/01/android-quick-preferences-tutorial.html
If, by tabs you mean the buttons that pop up after clicking menu, you will have create your own options menu.
http://developer.android.com/guide/topics/ui/menus.html
EDIT: For B, check out the PreferenceScreen/PreferenceActivity, as mention in an answer to this post. Just updating here with link for convinience.
http://developer.android.com/reference/android/preference/PreferenceScreen.html
http://developer.android.com/reference/android/preference/PreferenceActivity.html