Click here to Skip to main content
15,887,888 members
Home / Discussions / Android
   

Android

 
QuestionAndroid chat application message notification receive issue Pin
Pavlex426-May-17 20:46
Pavlex426-May-17 20:46 
SuggestionRe: Android chat application message notification receive issue Pin
Richard MacCutchan26-May-17 21:57
mveRichard MacCutchan26-May-17 21:57 
QuestionNeural Network Algorithms Pin
Member 1320852321-May-17 20:30
Member 1320852321-May-17 20:30 
AnswerRe: Neural Network Algorithms Pin
David Crow22-May-17 3:28
David Crow22-May-17 3:28 
GeneralRe: Neural Network Algorithms Pin
Member 1320852323-May-17 2:32
Member 1320852323-May-17 2:32 
AnswerRe: Neural Network Algorithms Pin
Richard MacCutchan22-May-17 6:48
mveRichard MacCutchan22-May-17 6:48 
Questionhow can I make my android app location aware? Pin
Member 1320194920-May-17 8:38
Member 1320194920-May-17 8:38 
AnswerRe: how can I make my android app location aware? Pin
Afzaal Ahmad Zeeshan20-May-17 9:47
professionalAfzaal Ahmad Zeeshan20-May-17 9:47 
AnswerRe: how can I make my android app location aware? Pin
David Crow20-May-17 10:16
David Crow20-May-17 10:16 
QuestionAndroid connect to MS SQL Server Pin
Member 1190014018-May-17 18:31
Member 1190014018-May-17 18:31 
AnswerRe: Android connect to MS SQL Server Pin
Peter_in_278018-May-17 18:53
professionalPeter_in_278018-May-17 18:53 
GeneralRe: Android connect to MS SQL Server Pin
Member 1190014018-May-17 19:38
Member 1190014018-May-17 19:38 
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 

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.