1. Are you ready for the Galaxy S20? Here is everything we know so far!

Apps my app doesnt stop properly after ringtone

Discussion in 'Android Development' started by flyhigh427, Aug 6, 2013.

  1. flyhigh427

    flyhigh427 Member
    Thread Starter

    hey this works fine if the button is pressed.
    how do i set it to finish() when the ringtone is over ,so the app will close if the button is not pressed?
    thanks



    Code (Text):
    1.  
    2. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]private[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] soundalarm() {
    3. setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]alarmstop[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
    4. [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]mediaPlayer[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MediaPlayer();
    5. Uri notification = RingtoneManager.[I]getDefaultUri[/I](RingtoneManager.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TYPE_RINGTONE[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] );
    6. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Ringtone r = RingtoneManager.[I]getRingtone[/I](getApplicationContext(), notification);
    7.  
    8. r.play();
    9.  
    10. Button confirmButton = (Button) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]stopit1[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);
    11.  
    12.  
    13. confirmButton.setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] View.OnClickListener() {
    14. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] onClick(View view) {
    15. r.stop();
    16. finish();
    17. }
    18. });
    19.  
    20.  
    21.  
    22.  
    23.  
    24. [/LEFT]
    25. }
    26. [/SIZE]
     

    Advertisement

Loading...
Similar Threads - app doesnt stop
  1. Rob
    Replies:
    0
    Views:
    14
  2. Rob
    Replies:
    1
    Views:
    21
  3. dorlow
    Replies:
    2
    Views:
    75
  4. jthompff
    Replies:
    2
    Views:
    68
  5. seymourkala
    Replies:
    0
    Views:
    45
  6. dorlow
    Replies:
    2
    Views:
    83
  7. Unforgiven
    Replies:
    1
    Views:
    18
  8. CindysPhonesare4calls
    Replies:
    4
    Views:
    187
  9. Kamilek123
    Replies:
    2
    Views:
    181
  10. Yesevil
    Replies:
    4
    Views:
    1,435

Share This Page

Loading...