Set ringtone from raw resource?

by Bryan Vincent » Mon, 16 Nov 2009 12:52:13 GMT


Sponsored Links
 So I'm having a hard time setting a ringtone from a raw resource. My
code is below. Any help would be much appreciated.

RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(),
RingtoneManager.TYPE_NOTIFICATION, Uri.parse("android.resource://
net.thebosskey.gijoepsasoundboard/" + this.resource));

However, when I play back the default notification sound using the
line below, it is not my sound.
RingtoneManager.getRingtone(getApplicationContext(),
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)).play
();

I know the uri for my sound is correct because the following line
plays it:
RingtoneManager.getRingtone(getApplicationContext(), Uri.parse
("android.resource://net.thebosskey.gijoepsasoundboard/" +
this.resource)).play();

What am I doing wrong?

--



Set ringtone from raw resource?

by Open » Fri, 18 Dec 2009 07:38:46 GMT


 Did you solve this problem?

I'm having the same trouble when using a 2.0 emulator.  The Ringtone
manager doesn't play my raw resource sound, it plays the default phone
ringtone.





--


Sponsored Links


Other Threads

1. does cupcake recognise (anti)clockwise rotatiions of the device

hi
I was told that Cupcake distinguishes both clockwise and
anti-clockwise rotations of the device and that it sets UI layouts
accordingly. Is this true? Or have I misunderstood something?

Also, what happens when the device is flipped upside down? Does
cupcake deal with it at all?

thanks

--~--~---------~--~----~------------~-------~--~----~

2. Webview not working like in Chrome

Hi guys,
I'm trying to make an android app, working with Facebook.

The first step to do that (after creating a new facebook-app on
facebook) is asking access to the user's informations.

We can do that from this url : 
http://m.facebook.com/code_gen.php?v=1.0&api_key=[your
api_key]

You're going on this page, giving your account information, allowing
the app, and facebook is giving you a token key. Then, the token key
is used by the application to get informations.

So I'm loading this page on a WebView, with a EditText under it, and a
button. You have to enter your token key on this EditText, then
clicking the button.

I'm having trouble with the WebView. First of all, we have to connect
two times to Facebook. Then, we're clicking on the "Generate" button
(on the facebook page), but it's still loading this page again and
again.

I tried it on the Chrome navigator, and it works just fine!
I just don't get it! Maybe someone already had the problem and could
help me.

Here's some of my code :

the .xml view:
[...]
<WebView
                android:id="@+id/facebookview"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
            />
[...]

the .java file:
[...]

WebView webview;
webview = (WebView) findViewById(R.id.facebookview);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new FacebookWebViewClient());
webview.loadUrl("http://m.facebook.com/code_gen.php?v=1.0&api_key=
[my_api_key]");

[...]

private class FacebookWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String
url) {
            view.loadUrl(url);
            return true;
        }
}

[...]

and of course, on the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />

Does anyone have any ideas?
--~--~---------~--~----~------------~-------~--~----~

3. What do people think of Cupcake?

4. Help required to get Android userland to boot on Gumstix Overo (TI OMAP 3503) + Palo43 LCD expansion board

5. Help required to get Android userland to boot on Gumstix Overo (TI OMAP 3503) + Palo43 LCD expansion board

6. using the ARM toolchain on FreeBSD to compile a .so for Android

7. How to start Porting