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. TextView showing tops of 2nd line when lines="1" or maxLines="1" in 3.0

I am using a ListView to create a specialized grid of images.
The xml for the list items is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/cover_art"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
        <RelativeLayout
                android:id="@+id/album0"
                android:layout_width="150dip"
                android:layout_height="170dip"
                android:layout_marginLeft="1dip"
                android:layout_marginTop="1dip"
                android:background="@drawable/cover_art_background">
                <ImageButton
                        android:id="@+id/cover_art0"
                        android:layout_marginTop="10dip"
                        android:layout_width="130dip"
                        android:layout_height="130dip"
                        android:scaleType="fitCenter"
                        android:src="@drawable/mce_logo_small"
                        android:layout_centerHorizontal="true">
                </ImageButton>
                <TextView
                        android:id="@+id/album_title0"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:maxLines="1"
                        android:textColor="#000"
                        android:textSize="14dip"
                        android:textStyle="bold"
                        android:gravity="center_horizontal"
                        android:layout_below="@id/cover_art0"
                        android:layout_centerHorizontal="true">
                </TextView>
        </RelativeLayout>

followed by more RelativeLayouts to give a row of items.
As you can see, the TextView is set to maxLines="1". This works fine
in an Android 2.2 device (EVO), On the Xoom, the only 3.0 device I
have available, I am getting the very tops of what would be a second
line, if the text is long enough to go to a second line. I have tried
android:lines="1" also. The only way I can get rid of the vestigial
part of the second line is to change android:layout_height to
="20dip".
Sorry, I have not run it on the emulator. Don't ask!

-- 

2. Security Fixes in Gingerbread MR2

android-security-discuss,

My Nexus S has been prompted to OTA from 2.3.3 to 2.3.4. The note on
my phone mentions an 'important security fix'. Are there any details
on what this fix is? Any particular reason why the security fix isn't
listed on: 
http://www.google.com/support/forum/p/Google+Mobile/thread?tid=3812c1acf93b482f&hl=en
?

Thanks,

Jacob

-- 
.

3. Where is Platform Developer Guide (http://pdk.android.com) ?

4. Android - Socket Client side

5. WebView with custom headers (in pre-Froyo)

6. Android Display service restart

7. musb_hdrc - gadget composite customization