Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:23:00+00:00 2026-05-22T20:23:00+00:00

If you open an mp3 url in the Android’s browser, you get a Complete

  • 0

If you open an mp3 url in the Android’s browser, you get a “Complete action using…” dialog window with two options: “Music player”, or “Browser”. If you choose “Browser” it will download the mp3 to the device.

I’m trying to achieve the same from within my application.
I use a WebView with setWebViewClient to a WebViewClient class that has a shouldOverrideUrlLoading method (like in all of the examples). The method checks for an “mp3” extension and startActivity(intent) with a ACTION_VIEW intent on the mp3 url.

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
   String lowcaseurl = url.toLowerCase();
   if (lowcaseurl.endsWith(".mp3")) {
       Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
       view.getContext().startActivity(intent);
       return true;
    }
    else {
       view.loadUrl(url);
    }
    return super.shouldOverrideUrlLoading(view, url)
}

This does show the “Complete action using” dialog window – but, if I choose “Browser” then the browser opens but doesn’t get the url! it just opens the browser and goes to the default “homepage url” (which is google.com in this case)…

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:23:01+00:00Added an answer on May 22, 2026 at 8:23 pm

    Couldn’t find a direct solution, but used a workaround.
    I’ve figured out how to either force the music player to load the url (without giving you a choice of opening it via the browser), or initiate a direct download of the file.

    To force the music player to load a url:

    //...considering url contains the url string...
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.parse(url), "audio/*");
    startActivity(intent);
    

    To force the initiation of a download:

    You need to implement this technique on the server-side…
    but with a few exceptions:

    The content-type header should actually contain the right mime-type of the file (and not “application/octet-stream”). Also it is best to also send a “content-length” header with the file size – otherwise there might be problems with the download.

    If using aspx: Response.TransmitFile is better than Response.WriteFile – and in that case Response.Buffer should be set to false.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to open an mp3 file in Python (possible using Popen )
I've setup a script to download an mp3 using urllib2 in Python. url =
in my application,i just wanna open a url contain media,e.g. http://www.test.com/test.mp3,or rstp://www.test.com/test.3gp,so i need
Open Ankh seems to be using Subversion 1.6.2 and Tortoise uses Subversion 1.6.0. After
The Open button on the open file dialog used in certain windows applications includes
I open a connection like this: Using conn as New OdbcConnection(connectionString) conn.Open() //do stuff
There is an Open Source mp3 player that is flash based. I was wondering
Using code from open source MusicDroid with the following code that I found during
I've created a Control Bar/Menu Bar/Media Player which will open up an initial MP3
This is how I display an open panel as a floating window. Can someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.