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.
Related
My application has a defined flow, starting on 1 fragment and always moving to a 2nd, 3rd, 4th, 5th, and final 6th fragment. Due to the nature of the flow, it is common to move back through fragments too.
I don't implement a back button within the app because I remember reading design theory from Google which recommended to never implement a back button because Android devices implement their own back buttons.
I'm still in development and I've tested the app with users, and I've received feedback that I should implement a back button.
My first thought is to reject the feedback because of the theoretical principle I referred to above, but I can't remember enough detail about the principle to be able to find it again, so I wonder whether my memory is inaccurate.
Is this principle correct? Is it against Google design principles to implement a back button?
I think what you've read is this.
Your app should not add a Back button to the UI.
That doesn't mean you can't override the onBackPressed and add your desired behavior.
This only means you should use the back button provided by Android and not add another button with the same functionality. Still I've seen loads of apps that use the home button, for instance, with the same behavior as the back button.
A simple implementation of this override behaviour is given by google in the above link:
override fun onBackPressed() {
if (mWebView.canGoBack()) {
mWebView.goBack()
} else {
// Otherwise defer to system default behavior.
super.onBackPressed()
}
}
In here they use it to provide back button behaviour to a WebView. The same can be done to navigate through your fragments in the backstack.
Moreover, the users should be the ones to decide about your UX, Google gives you guidelines that have been proven right. Sometimes those guidelines get outdated as phones and UX evolve. So if your users need a back behaviour you should add one.
I am new to Android development, I need to show user manual like Flip-kart app on start-up of app.
Please refer the image below, You will get an idea about, What actually I want to achieve....
Is there any standard way to achieve this?
You can do the whole stuff manually.
Or use a prebuilt library called ShowcaseView.
You'll find details, code and guide here http://www.xda-developers.com/android/create-holo-themed-demo-overlays-with-showcaseview/
Here is my suggestion
Get the semi-transparent images of manual pages. Keep the Images in your res/drawable.
Use sharedpreference to maintain the status whether this manual is shown to user on startup or not (Depending on your requirement). Check the status when the app is launched, to decide whether to show this to user or bypass it.
Use a fragment or Activity to display this manual images in sequence one after another.
for this you can use viewpager, swipe animation or simple buttons.
just use one Gallery view and skip button on it.Show that gallery on the first installation.For that you can set flag value in sharedpreference.Also shows a button for virtrual tour in Left drawer,
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.