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 9217907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:44:21+00:00 2026-06-18T02:44:21+00:00

I have a javascript interface set on my DroidGap class, mc = new MyClass(this,

  • 0

I have a javascript interface set on my DroidGap class,

mc = new MyClass(this, appView);
appView.addJavascriptInterface(mc, "MyCls");

From which i’m starting the media player

  public void playAudio(String audioFile){
      copyFileToDir(audioFile);
      File dest = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC + "/" + audioFile + ".mp3");
      Uri r = Uri.fromFile(dest);         
      Intent viewMediaIntent = new Intent();   
      viewMediaIntent.setAction(android.content.Intent.ACTION_VIEW);                                 
      viewMediaIntent.setDataAndType(r, "audio/*");   
      viewMediaIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);          
      Intent i = Intent.createChooser(viewMediaIntent, "Play Music");
        mGap.startActivity(i);

  }

But when i do that, when i press back, my app is not running anymore and i get sent to the home screen.
I tried setting the keepRunning to true but didn’t help much.

super.setBooleanProperty("keepRunning", true);

How can I keep it running even when I start another Activity?

Update

Now it gets weirder. The activity does not get destroyed on a nexus 7 running 4.2, on a HTC desire/Htc Bravo running 2.2 but it fails on my galaxy s3 running 4.1.2. Any ideas on how to find out why?

  • 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-06-18T02:44:22+00:00Added an answer on June 18, 2026 at 2:44 am

    My issue was self inflicted. There is an option on Settings -> Developer Options -> Apps called do not keep activities. And it destroys every activity as soon as the user leaves it. So once I unticked that lovely checkbox, my problem was solved.

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

Sidebar

Related Questions

I have a javascript interface class to receive some values from javascript. I toasted
I have a webview with javascript-interface. From within this webview i do certain javascript
I have javascript code some thing like this -- var count=3; var pl=new Array(count);
When I'm writing some JavaScript I have a set of interface buttons that have
I have added a JavaScript Interface to WebView. I am able to use all
A lot of JavaScript libraries have user interface widgets. Usually they are created after
I have created tab style interface using css and javascript with only two tabs
I have Javascript function defined in the main index.html file. One part of this
I have an UpdatePanel on my page which I would like to set up
I'm new to Javascript. I have a script with lots of calculations. Everything is

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.