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.
Related
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.
I'm developing a small Android app and am having trouble with one small feature. I want to have a button invoke a series of Dialogs that the user can select a series of options for. For example, pressing the button will bring up a Dialog with 2 choices, pressing either of those choices will open another dialog with 2 more choices. When the user presses a button there, I want the 2 choices to be remembered somewhere.
I initially approached it by making 2 classes that extend DialogFragment and then showing DialogFragment #2 after a choice has been made in #1 but it seems a bit messy and I can't seem to save the 'path', ie: I want an int ranging from 0 to 4 representing the possible paths they could have done with 2 buttons in Dialog #1 and 2 buttons in Dialog #2, so essentially #2 would have to know what choice was made from #1.
Any tips? Cheers.
You can use shared preferences to store say, the text if the button clicked in dialog1, so that you can access that from dialog2, and so on. Just keep appending the text unique to the dialog fragment at each stage to that shared preference.
At any stage, you can retrieve the shared preference, and thus, you would have the path taken by the user amongst the dialogs.
Here is what you looking for (hopefully!) otherwise take it as tips!!
You have best solution for your problem, Just use this WizardPager in your dailogfragment, thats it.
WizardPager:
Just use this Roman nurik's Android-WizardPager
i am doing a search results and once I click on the results, it will display the details. After I click on the back button, it should display the searched results I have done.
E.g.
When I click "back" on image 3, it returned to image 1 instead of image 2. Is there a way to solve it? I simply just did finish(); on image 3
You need to intercept the back button and control the flow of your application. DO NOT use state variables, avoid this approach as this can lead to more unstable problem UNLESS you design your states very carefully and have your states defined WELL. Try to learn the control that is available in the android framework.
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 have several preference screens. When user click on preference named log-of - I have to disable and hide some preference screens. Because of disabled preferences I need to go one level up in screen preferences hierarchy.
Looking for valuable suggestion.
Thanks.
I decomposed preference hierarhy.
Now have 3 different xml layouts for each preference screen.
When user click 'logof' - I make change in app data and call finish activity. This returns me one level up :) This way causes more code, but logic is clear now.