I'm making an Android app. I have to make a fragment where (for example) the user can see his info, like his name, email, birthdate, etc. I want to allow the user to edit this info, but i don't know which approach is better. I thought to put all the infos in some editTexts with setEditable = false and make a button EDIT that when the user click on it I set the visibility of this button to GONE and make the visibility of the hidden button UPDATE to VISIBLE and the editTexts to setEditable = true. When the user click on UPDATE if is all correct i send the updated infos to the backend and I set again the visibility of UPDATE button to GONE and the visibility of button EDIT to VISIBLE and all the editTexts to setEditable = false.
Is it a good solution or i can do it better?
Your best approach would be to to display user profile in the fragment and then provide a button for the user to click on to Edit. On button click you can launch a new activity to allow editing - this is the approach i generally use. It is less complicated in the beginning. On the other hand, it would be nice to implement both and then use A/B testing to figure out what works best for your users, in your context. This is more a UI/UX issue rather than a programming one... all the best.
Related
This isn't so much a question about my specific code as it is a question on what I need to use to accomplish my task.
I'm making a workout logging app for my class. The user needs to be able to create a workout routine, filled with various exercises of their choice.
On the home page, there is an "Add Workout" button. Clicking this should bring them to a screen where they name the workout and fill it in with said exercises. When they click save, I need to be able to create a new button on the home page with simply the name of their new workout. This new button when clicked will bring them to that workout, where they can start the workout and put in their reps, sets, weight, etc.
What do I need to be looking at to achieve this? Do I need to be saving the workouts to a database and using a function to go through the database and populate the home screen with respective buttons each time I enter the app / add a new workout? Or is there a different way to do this? I'm not sure that I'm even asking the right question or framing this problem the correct way.
Thanks!
you should put the button on the home page from the beginning but make it invisible at first.
yes you should put the workout information in a database and if there is a workout saved, make the button visible in the home page.
use android:visibility="gone" in XML and birthday.visibility = View.VISIBLE in the activity to modify the visibility
I have an action bar with a button to flip between two different views (list and tree). Should the button show (a) the current view or (b) the view that will be shown if the user clicks the button?
This is an age-old UI problem with no "right answer", only UI standards, so I'm trying to understand if there's any standard on this in Android.
I agree on the 'age-old' part. Myself I'm still questioning - when acting as a user, not a developer ;-) - what the button in front of me will do when I click it: turn on Shuffle or turn it of.
Now very pleased to come up with a feasible answer.
Since the user has a clear visual clue on the state the current presentation is in (List or Tree) the button would show the alternate option. Then the user knows that there is an alternate option and hopefully the button displays where it will take the user.
For more unclear situations I would still go with this approach. The user either knows or perhaps can deduce the current 'state' of the app ("hey it plays a whole different song now, so it is in shuffle"). So the button will bring me to another state, the one displayed.
Why display what the app is already doing and not displaying where a buttonpress will take the user?
Please don't delete it because its a duplicate. I am an android developer with little experience. I have an app with 2 screens. The first has a bunch of options in a TableLayout each selected using a RadioButton.
What I want to do is, when I select one option and click a Button which appears below, the View should switch to the next screen showing some related data and when a Button is clicked I want it to come back to the same screen but then the rest of the options should be available to me so as to repeat the same process with another one of the options selected.
In short I want to be able to maintain the state of the first screen. I can't seem to be able to decide between using ViewSwitcher, ViewFlipper, or multiple Activities or using a single Activity which is what I am doing right now. But as my app gets bigger its very difficult to handle it. Please suggest the best way to do this. I am confused and desperately in need of help because my job depends on it. Thanks in advance
Use 2 activities. Launch the 2nd activity when the user clicks the button. When the user clicks the "back" button (or some other button you offer him) the 2nd activity finishes and the first activity (which was underneath it) is shown.
Note: You've not given us much information, so I can't guarantee that this is the best solution. From what you've said this is the solution I would recommend though. As they say in advertising "Your mileage may vary" ;-)
I'm working on the preference activity. The matter is about the possibility of add a button that allow to confirm, and eventually (that would be nice) a discard button in order to discard the changes applied at the preferences.
Let me explain better.
As far as I've seen it is possible using the common techniques that i've found in the tutorial to set different preferences using checkboxes and so on. The normal use case that involve preferences require that the user performs selections and after that click the BACK button in order to return to the old view.
However in the usability test i've done, it seems that this step is not always straightforward for all the users, and moreover a lot of them are not sure about the fact that the changes on the preferences are comfirmed.
Now we arrive at the question. is it possible somehow to have in the preference view selections (in particular one just composed by a group of checkboxes) to have an OK and eventually CANCEL button?
You have 4 options:
1) Design a layout and use a normal activity similar to the preferences screen where you give the user 2 buttons: Save and Discard.
2) Add a menu to the preferences activity with save/discard (and of course you will have to save the previous state and revert back to it if the user decided to discard).
3) Handle back button press on the preference activity where you popup a dialog asking if they want to save the changes
4) Add 2 "actions" to the preferences where 1 is save and 1 is discard and each goes to its own activity... Complicated and ugly in my opinion...
On a side note, I really believe users are familiar with Android's UI as 99% of the apps using preferences don't have this save button so it should be straightforward to the users that when they click on a checkbox - it is saved.
I apologize if I'm just missing the obvious. I'm fairly new to Android development, and while I searched for this particular topic, I wasn't exactly sure what to look for (in terms of a "name").
In an application I'm writing, I have a section where the user can enter the names of players. However, this can range anywhere from 1 to whatever, no limit. However, I'm not sure what the best approach for this kind of feature is, or if there's a component that already does something like it.
Basically, the functionality I'm looking for is similar to what you can see in the Edit Contact screen of the phone book; for the phone numbers and email addresses, you can push a little plus button to add a new number/address, or hit the little minus button to remove a number/address.
I can think of several ways to potentially implement this, but in the end I think wrapping it in a custom component would be best (so that you could call "Get Players" and have it return a list of strings by going through each of the inputs and getting the values).
Am I just overthinking this? Is there a component that does that already? Is there some example code that demonstrates a good way to do this?
Thanks!
Could you just use ListView and add a menu with a "Add Players" option? You could customize the list view to have a little checkbox, for example, and then begin the game by pressing the menu ... or add new players dynamically by pressing another menu button.
After playing around with some ideas, I came across a solution that I think will suit what I'm doing. I created a custom component extending LinearLayout. As part of the creation of the component, it creates a row that says "Add new..." with a plus-sign button. Pressing the plus sign button then creates a new row containing an EditText and a minus-button which will remove the row.
I then created a method for this component called getTexts() which returns a List that has all the non-empty Text values from all the components. Testing it in a dummy app, it seemed to work fine.
I think I need to make tweaks to make it more robust (like the ability to add rows programatically, listeners to alert other components when a row is added/removed, and the ability to set the individual EditText values, for instance), but this functions as I imagined.