0

I want to make sure that when I press a Button, a sound store in the application will be put as the default notification on the smartphone.

I've search on a lot of websites and i've only find tutorials to do this with the default rington, but I want to do this with the default notification sound.

As you can see below my onClickListener is empty.

package com.cariboustail.wtfsoundbox;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Pop extends Activity {

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.popup);



    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);

    int width = dm.widthPixels;
    int height = dm.heightPixels;
    getWindow().setLayout((int) (width * .8), (int) (height * .5));
    getWindow().setBackgroundDrawableResource(android.R.color.transparent);

    TextView txtLabel = (TextView)findViewById(R.id.textView);
    txtLabel.setText("En savoir plus sur ce Son");

    Button youtube = (Button)findViewById(R.id.youtube);
    youtube.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {
            Intent viewIntent = getIntent();
            String url=viewIntent.getStringExtra("SoundName");
            Uri uri = Uri.parse(url);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
        }
    });

    Button notif = (Button)findViewById(R.id.notif);
    notif.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {

        }
    });
  }
}

Thanks for your time

Ravindra Kushwaha
  • 7,846
  • 14
  • 53
  • 103
Thomas Oumar
  • 85
  • 1
  • 2
  • 8

0 Answers0