continue Media Player in Fragment (playing the song) from Main Activity even when going to different ActitvityAndroid Intent for media player plays mp3 but does not display information(Title, Artist, Album Art)Media player not reading from socketWhy fragments, and when to use fragments instead of activities?Store last played songs Android media player appDilemma: when to use Fragments vs Activities:choose song from list , navigate to media player on item click listener and play song with media playerPlay song on default music player - androidAndroid - Can not cast called activity from fragmentHow to stop old song when new song is playing in Android?Fragment loses focus in ViewPager
Why is one of Madera Municipal's runways labelled with only "R" on both sides?
How can electric fields be used to detect cracks in metals?
Trapping Rain Water
Why would future John risk sending back a T-800 to save his younger self?
Payment instructions allegedly from HomeAway look fishy to me
What is the highest possible permanent AC at character creation?
Winning Strategy for the Magician and his Apprentice
How to deal with apathetic co-worker?
Project Euler #7 10001st prime in C++
Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?
What do abbreviations in movie scripts stand for?
Fixing obscure 8080 emulator bug?
Is the term 'open source' a trademark?
How can I get an unreasonable manager to approve time off?
When conversion from Integer to Single may lose precision
Should I give professor gift at the beginning of my PhD?
1980s live-action movie where individually-coloured nations on clouds fight
How is water heavier than petrol, even though its molecular weight is less than petrol?
Déjà vu, again?
What is the fastest method to figure out which keys contain certain notes?
Grover algorithm for a database search: where is the quantum advantage?
Generate a Graeco-Latin square
Why did the Tesseract "burn" a hole through Red Skull's plane but not Nick Fury's desk?
Are there any instruments that don't produce overtones?
continue Media Player in Fragment (playing the song) from Main Activity even when going to different Actitvity
Android Intent for media player plays mp3 but does not display information(Title, Artist, Album Art)Media player not reading from socketWhy fragments, and when to use fragments instead of activities?Store last played songs Android media player appDilemma: when to use Fragments vs Activities:choose song from list , navigate to media player on item click listener and play song with media playerPlay song on default music player - androidAndroid - Can not cast called activity from fragmentHow to stop old song when new song is playing in Android?Fragment loses focus in ViewPager
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a Media Player UI in a Fragment in Main Activity which plays all songs from the emulator. Below this fragment I have List of Playlists. I can click on any of the playlists name and second activity opens with names of songs in that playlist. What I want is that after navigating to new Activity I should still be able to see the same fragment from Main Activity playing the song with Title and Artist name. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can this be achieved without having to create a new Fragment (and thus have fragment to fragment data sharing) in second Activity and instead load the Fragment from Main Activity as it is? If new Fragment needs to be created in Second Activity how should I pass the song detail like Album art, Title, Artist etc. from first fragment to second fragment?
java
add a comment |
I have a Media Player UI in a Fragment in Main Activity which plays all songs from the emulator. Below this fragment I have List of Playlists. I can click on any of the playlists name and second activity opens with names of songs in that playlist. What I want is that after navigating to new Activity I should still be able to see the same fragment from Main Activity playing the song with Title and Artist name. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can this be achieved without having to create a new Fragment (and thus have fragment to fragment data sharing) in second Activity and instead load the Fragment from Main Activity as it is? If new Fragment needs to be created in Second Activity how should I pass the song detail like Album art, Title, Artist etc. from first fragment to second fragment?
java
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59
add a comment |
I have a Media Player UI in a Fragment in Main Activity which plays all songs from the emulator. Below this fragment I have List of Playlists. I can click on any of the playlists name and second activity opens with names of songs in that playlist. What I want is that after navigating to new Activity I should still be able to see the same fragment from Main Activity playing the song with Title and Artist name. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can this be achieved without having to create a new Fragment (and thus have fragment to fragment data sharing) in second Activity and instead load the Fragment from Main Activity as it is? If new Fragment needs to be created in Second Activity how should I pass the song detail like Album art, Title, Artist etc. from first fragment to second fragment?
java
I have a Media Player UI in a Fragment in Main Activity which plays all songs from the emulator. Below this fragment I have List of Playlists. I can click on any of the playlists name and second activity opens with names of songs in that playlist. What I want is that after navigating to new Activity I should still be able to see the same fragment from Main Activity playing the song with Title and Artist name. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can this be achieved without having to create a new Fragment (and thus have fragment to fragment data sharing) in second Activity and instead load the Fragment from Main Activity as it is? If new Fragment needs to be created in Second Activity how should I pass the song detail like Album art, Title, Artist etc. from first fragment to second fragment?
java
java
edited Mar 25 at 4:23
sakib shaikh
asked Mar 24 at 17:06
sakib shaikhsakib shaikh
155
155
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59
add a comment |
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59
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/3.0/"u003ecc by-sa 3.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%2f55326314%2fcontinue-media-player-in-fragment-playing-the-song-from-main-activity-even-whe%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
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%2f55326314%2fcontinue-media-player-in-fragment-playing-the-song-from-main-activity-even-whe%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
Have you ever tried out to minimise the fragment in the main activity?, just give it a shot!
– Tot
Mar 24 at 17:18
Do what most players do, create the player in a foreground service (notification), then switching through different activities doesn't touch the service. Then you can update your UI from the service with intents.
– Pierre
Mar 24 at 17:49
But can the UI elements like Play, Next buttons and album art, artist name etc also be put foreground service. I have a service class to play song in background. Should I put the UI in that service class. Also I have to maintain the current state of player like seekbar progress irrespective doing back and forth between multiple activities. Can you guide me about this?
– sakib shaikh
Mar 25 at 4:22
@Pierre I have not been able to see an example of media player in foreground service but connected to the app. Can you share such an example source?
– sakib shaikh
Mar 29 at 7:43
@sakibshaikh Have a look at telegrams source code, maybe you can get some insight on how to proceed: MediaController [:1742]- github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/… then the AudioPlayerCell [:211] - github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/…
– Pierre
Mar 29 at 7:59