How to set Alarm Tone from My Application?
<p>How to set Alarm Tone from My Application?</p>

<p>The Main Problem is I am Set Alarm More then one time but only second alarm is working, sorry for bad English.</p>

<p>Thanks in advance.</p>

<pre><code>if(day.equals("Daily")){
    System.out.println("Daily Alarm");
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() +(seconds * 1000) , (24 * 60 * 60 * 1000) ,pendingIntent);
    Toast.makeText(this, "Alarm set for Daily", Toast.LENGTH_LONG).show();
}else{
    System.out.println("Weekly Alarm");
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() +(seconds * 1000) , (7 * 24 * 60 * 60 * 1000) ,pendingIntent);
    Toast.makeText(this, "Alarm set for "+day, Toast.LENGTH_LONG).show();
}
</code></pre>

<p>following code I used for Pick tone:-</p>

<pre><code>String uri = null;
intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_NOTIFICATION);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");

if (uri != null) {
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,Uri.parse(uri));
} else {
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,(Uri) null);
}
startActivityForResult(intent, 0);
</code></pre>

<p>startActivityForResult Method :-</p>

<pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
            if (uri != null) {
                @SuppressWarnings("unused")
                String ringTonePath = uri.toString();
            }
        }
}
</code></pre>

<p>Please Help Me.</p>
