Click here to Skip to main content
15,885,757 members
Home / Discussions / Android
   

Android

 
GeneralRe: Android connect to MS SQL Server Pin
Peter_in_278018-May-17 20:56
professionalPeter_in_278018-May-17 20:56 
AnswerRe: Android connect to MS SQL Server Pin
Richard MacCutchan18-May-17 21:48
mveRichard MacCutchan18-May-17 21:48 
GeneralRe: Android connect to MS SQL Server Pin
Member 1190014018-May-17 21:56
Member 1190014018-May-17 21:56 
GeneralRe: Android connect to MS SQL Server Pin
Richard MacCutchan18-May-17 22:12
mveRichard MacCutchan18-May-17 22:12 
QuestionRe: Android connect to MS SQL Server Pin
David Crow19-May-17 3:11
David Crow19-May-17 3:11 
AnswerRe: Android connect to MS SQL Server Pin
Richard MacCutchan19-May-17 6:33
mveRichard MacCutchan19-May-17 6:33 
GeneralRe: Android connect to MS SQL Server Pin
David Crow19-May-17 6:35
David Crow19-May-17 6:35 
Question(Short Video Demo) Fragment back navigation issue and overlapping fragments using a frame layout Pin
Daniel Antony Ali17-May-17 18:41
Daniel Antony Ali17-May-17 18:41 
Short Video Demonstration of the issue(s)

I have developed a recipe search application that obtains data from an API and it allows the user to view and save the data.
My android application uses multiple fragments within one activity. They share one container and when a new fragment is loaded it replaces the old fragment.

My application has the following fragments: Home, Search, Filters, RecipeView and more.

I am experiencing multiple issues with popping the fragment back stack once a search has been carried out or a favourite recipe has been displayed. The search fragment is a grid view that uses a custom adapter, and to perform a search the user uses a toolbar search view which executes code upon pressing the submit (return) button.

The home fragment is displayed first allowing a user to click a quick search button such as breakfast, clicking the button displays the search fragment with results from the API. The user can then click on an item which opens the RecipeView fragment, pressing the back button on these fragments does not cause an issue and a user can navigate back to the previous fragments including the home one that was displayed initially.

Additionally, a user can navigate to the search fragment using the navigation drawer. The search fragment allows the user to perform a search or click a filter via buttons on the toolbar. Clicking the search icon/button allows a user to enter text and once they press enter/return the search is perform and the grid view is populated.

Prior to performing a search or clicking the search button, pressing the filter button displays the filters fragment and from there, pressing the back button will allow a user to navigate back to the search view fragment.

If the user presses the search button which will open the search view menu item (allowing text input on the toolbar) and then presses the filters button, the filters activity is displayed. However, pressing the back button does not navigate to the previous fragment, it removes the focus from the toolbar. Pressing the back button again still does not navigate back and changes the toolbars text back to the search fragments specified title ("Recipe Search"). Pressing the back button again will then navigate back to the search fragment, removing the filters fragment from sight.

I have tried removing the focus from the toolbar so that pressing back is not removing toolbars focus and the app still requires three back button presses.

Furthermore, I am having another issue with fragments overlaying each other. From the home fragment that is loaded on create, if a user navigates using the side menu to the favourites fragment, a list of the saved favourites in a grid view are shown using the search fragment. Pressing the back button from the search fragment does not cause any issues and the app will navigate back to the home fragment; additionally, clicking a recipe will open the RecipeView fragment displaying a recipes information.

The issue arises from here. If the back button is pressed the app will navigate backwards loading the home fragment not the search fragment and the recipe fragment stays on screen causing both fragments to overlap. Pressing the back button again will remove the home fragment and leave the recipe fragment in the container; pressing the back button again will close the application (The search fragment is not shown and the order is incorrect).

Attempts
1. I have tried implementing this ([Avoid fragments overlapping][2])
2. I have tried calling classes using a new instance method rather than creating new ones in the MainActivity
3. I have tried to add fragments rather than replace them
4. I have tried overriding the back button press
5. I have tried addToBackStack(null) & addToBackStack(FragmentTag)
6. I have tried to remove all views from the frame layout within my fragment handler method

Thank you for taking the time to read my post

java - (Short Video Demo) Fragment back navigation issue and overlapping fragments using a frame layout - Stack Overflow[^]
Daniel Ali

QuestionAnyone can help Pin
wseng16-May-17 21:58
wseng16-May-17 21:58 
AnswerRe: Anyone can help Pin
Richard MacCutchan16-May-17 22:46
mveRichard MacCutchan16-May-17 22:46 
QuestionAndroid media player won't start Pin
Pavlex413-May-17 2:08
Pavlex413-May-17 2:08 
AnswerRe: Android media player won't start Pin
Pavlex413-May-17 5:13
Pavlex413-May-17 5:13 
QuestionAndroid read file from url Pin
Pavlex412-May-17 6:39
Pavlex412-May-17 6:39 
QuestionRe: Android read file from url Pin
David Crow12-May-17 10:06
David Crow12-May-17 10:06 
QuestionAndroid Shopping Cart Pin
Member 1319622012-May-17 2:52
Member 1319622012-May-17 2:52 
AnswerRe: Android Shopping Cart Pin
Richard MacCutchan12-May-17 3:13
mveRichard MacCutchan12-May-17 3:13 
QuestionRe: Android Shopping Cart Pin
David Crow12-May-17 9:48
David Crow12-May-17 9:48 
QuestionCorrect MVVM implementation to manually login to website, go to certain link in the website, read information from html element and display it in another View. Pin
JoJo8210-May-17 6:15
JoJo8210-May-17 6:15 
AnswerRe: Correct MVVM implementation to manually login to website, go to certain link in the website, read information from html element and display it in another View. Pin
Richard MacCutchan10-May-17 6:41
mveRichard MacCutchan10-May-17 6:41 
GeneralRe: Correct MVVM implementation to manually login to website, go to certain link in the website, read information from html element and display it in another View. Pin
JoJo8210-May-17 12:07
JoJo8210-May-17 12:07 
QuestionPrevious fragment visible under the new fragment issue Pin
Pavlex46-May-17 7:59
Pavlex46-May-17 7:59 
SuggestionRe: Previous fragment visible under the new fragment issue Pin
David Crow8-May-17 6:53
David Crow8-May-17 6:53 
QuestionHelp Pin
Member 1302311825-Apr-17 14:06
Member 1302311825-Apr-17 14:06 
QuestionRe: Help Pin
Richard MacCutchan25-Apr-17 21:28
mveRichard MacCutchan25-Apr-17 21:28 
AnswerRe: Help Pin
Member 1302311826-Apr-17 0:22
Member 1302311826-Apr-17 0:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.