Single fragment at top of parent in all activities of app without new instances of fragment in every activityPassing variables between service & activity and vice-versaOnce for all, how to correctly save instance state of Fragments in back stack?Switching between Android Navigation Drawer image and Up caret when using fragmentsConverting Alarm Activity App into ServiceAndroid : Use fragment or change all the view in the activityMediaPlayer on a Service causing an IllegalStateException and the app crashesDagger2 getting instance of activity presenter in fragment presenterOn going back to the previous Activity my media progress get lost (seekBar and media player progress)continue Media Player in Fragment (playing the song) from Main Activity even when going to different Actitvity
Does the Giant Toad's Swallow acid damage take effect only at the start of its next turn?
Opportunity profits vs. opportunity costs
Is future tense in English really a myth?
Types of tablet... a tablet secretion
What is the justification for Dirac's large numbers hypothesis?
Is there a neutral term for people who tend to avoid face-to-face or video/audio communication?
What are the map units that WGS84 uses?
Remaining in the US beyond VWP admission period
Why did Tony's Arc Reactor do this?
French equivalent of "my cup of tea"
What drugs were used in England during the High Middle Ages?
How should Thaumaturgy's "three times as loud as normal" be interpreted?
Why does the UK Prime Minister need the permission of Parliament to call a general election?
How does the UK House of Commons think they can prolong the deadline of Brexit?
Translate English to Pig Latin | PIG_LATIN.PY
Can you fix a tube with a lighter?
My Friend James
What fraction of 2x2 USA call signs are vanity calls?
Draw the ☣ (Biohazard Symbol)
Phrase request for "work in" in the context of gyms
Global variables and information security
What can we do about our 9 month old putting fingers down his throat?
What's this constructed number's starter?
What are the solutions of this Diophantine equation?
Single fragment at top of parent in all activities of app without new instances of fragment in every activity
Passing variables between service & activity and vice-versaOnce for all, how to correctly save instance state of Fragments in back stack?Switching between Android Navigation Drawer image and Up caret when using fragmentsConverting Alarm Activity App into ServiceAndroid : Use fragment or change all the view in the activityMediaPlayer on a Service causing an IllegalStateException and the app crashesDagger2 getting instance of activity presenter in fragment presenterOn going back to the previous Activity my media progress get lost (seekBar and media player progress)continue Media Player in Fragment (playing the song) from Main Activity even when going to different Actitvity
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
It is basically for a mediaplayer that show the current playing song in the single fragment through out the app. I have service that handles the song in background. But the fragment UI with play and next button has to show the current playing song name, artist etc. no matter which activity i am in. Creating new instances of fragment in every activity doesn't help as the new instance does not show the currently playing info. If I play the song in Main Activity with the fragment at top then even if I move to another activity the fragment from Main Activity should show up with the currently playing song info. Have thoroughly checked SO at One common fragment to display on top of whole application everywhere but could not decipher the suggestion as I am new in Java. Please help.
java android android-fragments
add a comment |
It is basically for a mediaplayer that show the current playing song in the single fragment through out the app. I have service that handles the song in background. But the fragment UI with play and next button has to show the current playing song name, artist etc. no matter which activity i am in. Creating new instances of fragment in every activity doesn't help as the new instance does not show the currently playing info. If I play the song in Main Activity with the fragment at top then even if I move to another activity the fragment from Main Activity should show up with the currently playing song info. Have thoroughly checked SO at One common fragment to display on top of whole application everywhere but could not decipher the suggestion as I am new in Java. Please help.
java android android-fragments
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37
add a comment |
It is basically for a mediaplayer that show the current playing song in the single fragment through out the app. I have service that handles the song in background. But the fragment UI with play and next button has to show the current playing song name, artist etc. no matter which activity i am in. Creating new instances of fragment in every activity doesn't help as the new instance does not show the currently playing info. If I play the song in Main Activity with the fragment at top then even if I move to another activity the fragment from Main Activity should show up with the currently playing song info. Have thoroughly checked SO at One common fragment to display on top of whole application everywhere but could not decipher the suggestion as I am new in Java. Please help.
java android android-fragments
It is basically for a mediaplayer that show the current playing song in the single fragment through out the app. I have service that handles the song in background. But the fragment UI with play and next button has to show the current playing song name, artist etc. no matter which activity i am in. Creating new instances of fragment in every activity doesn't help as the new instance does not show the currently playing info. If I play the song in Main Activity with the fragment at top then even if I move to another activity the fragment from Main Activity should show up with the currently playing song info. Have thoroughly checked SO at One common fragment to display on top of whole application everywhere but could not decipher the suggestion as I am new in Java. Please help.
java android android-fragments
java android android-fragments
asked Mar 28 at 5:00
sakib shaikhsakib shaikh
155 bronze badges
155 bronze badges
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37
add a comment |
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390470%2fsingle-fragment-at-top-of-parent-in-all-activities-of-app-without-new-instances%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390470%2fsingle-fragment-at-top-of-parent-in-all-activities-of-app-without-new-instances%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You cannot do this. Fragments attach to Activities and so you need to create a new Fragment. Creating a POJO for the current playing song and passing that around activities and recreating the fragments is the simplest solution I can think of.
– Saurabh
Mar 28 at 10:37