Initialising large number of widgets in java class

My project has 40 buttons that I have to initialize them in my java class (I mean findViewById all the button in my java class). And then these buttons play a mediaPlayer and I have to use MediaPlayer class too (I mean MediaPlayer mp = MediaPlayer.create(this, and then I have to write setOnClickListener of each button.

It’s really hard and boring to all these works one by one. Is there any faster way to do all these things? I am new to android. Please help!

public class MainActivity extends AppCompatActivity {
    Button b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40;
    MediaPlayer mb1, mb2, mb3, mb4, mb5, mb6, mb7, mb8, mb9, mb10, mb11, mb12, mb13, mb14, mb15, mb16, mb17, mb18, mb19, mb20, mb21, mb22, mb23, mb24, mb25, mb26, mb27, mb28, mb29, mb30, mb31, mb32, mb33, mb34, mb35, mb36;

    protected void onCreate(Bundle savedInstanceState) {
        b1 = (Button) findViewById(;
        b2 = (Button) findViewById(;
        b3 = (Button) findViewById(;
        b4 = (Button) findViewById(;
        b5 = (Button) findViewById(;
        b6 = (Button) findViewById(;
        b7 = (Button) findViewById(;
        b8 = (Button) findViewById(;
        b9 = (Button) findViewById(;
        b10 = (Button) findViewById(;
        b11 = (Button) findViewById(;
        b12 = (Button) findViewById(;
        b13 = (Button) findViewById(;
        b14 = (Button) findViewById(;
        b15 = (Button) findViewById(;
        b16 = (Button) findViewById(;
        b17 = (Button) findViewById(;
        b18 = (Button) findViewById(;
        b19 = (Button) findViewById(;
        b20 = (Button) findViewById(;
        b21 = (Button) findViewById(;
        b22 = (Button) findViewById(;
        b23 = (Button) findViewById(;
        b24 = (Button) findViewById(;
        b25 = (Button) findViewById(;
        b26 = (Button) findViewById(;
        b27 = (Button) findViewById(;
        b28 = (Button) findViewById(;
        b29 = (Button) findViewById(;
        b30 = (Button) findViewById(;
        b31 = (Button) findViewById(;
        b32 = (Button) findViewById(;
        b33 = (Button) findViewById(;
        b34 = (Button) findViewById(;
        b35 = (Button) findViewById(;
        b36 = (Button) findViewById(;
        b37 = (Button) findViewById(;
        b38 = (Button) findViewById(;
        b39 = (Button) findViewById(;
        b40 = (Button) findViewById(;
        mb1 = MediaPlayer.create(this, R.raw.ability);
        mb2 = MediaPlayer.create(this, R.raw.applause);
        mb3 = MediaPlayer.create(this, R.raw.appointment);
        mb4 = MediaPlayer.create(this, R.raw.atthemoment);
        mb5 = MediaPlayer.create(this, R.raw.audience);
        mb6 = MediaPlayer.create(this, R.raw.depression);
        mb7 = MediaPlayer.create(this, R.raw.disaster);
        mb8 = MediaPlayer.create(this, R.raw.dizzy);
        mb9 = MediaPlayer.create(this, R.raw.educated);
        mb10 = MediaPlayer.create(this, R.raw.emotion);
        mb11 = MediaPlayer.create(this, R.raw.entertain);
        mb12 = MediaPlayer.create(this, R.raw.experience);
        mb13 = MediaPlayer.create(this, R.raw.focus);
        mb14 = MediaPlayer.create(this, R.raw.however);
        mb15 = MediaPlayer.create(this, R.raw.humor);
        mb16 = MediaPlayer.create(this, R.raw.impress);
        mb17 = MediaPlayer.create(this, R.raw.inspire);
        mb18 = MediaPlayer.create(this, R.raw.instruct);
        mb19 = MediaPlayer.create(this, R.raw.massage);
        mb20 = MediaPlayer.create(this, R.raw.medication);
        mb21 = MediaPlayer.create(this, R.raw.mental);
        mb22 = MediaPlayer.create(this, R.raw.offer);
        mb23 = MediaPlayer.create(this, R.raw.painkiller);
        mb24 = MediaPlayer.create(this, R.raw.permission);
        mb25 = MediaPlayer.create(this, R.raw.physician);
        mb26 = MediaPlayer.create(this, R.raw.possible);
        mb27 = MediaPlayer.create(this, R.raw.present);
        mb28 = MediaPlayer.create(this, R.raw.psychologist);
        mb29 = MediaPlayer.create(this, R.raw.resemble);
        mb30 = MediaPlayer.create(this, R.raw.sincerely);
        mb31 = MediaPlayer.create(this, R.raw.specialist);
        mb32 = MediaPlayer.create(this, R.raw.speech);
        mb33 = MediaPlayer.create(this, R.raw.splittingheadache);
        mb34 = MediaPlayer.create(this, R.raw.sprain);
        mb35 = MediaPlayer.create(this, R.raw.touch);
        mb36 = MediaPlayer.create(this, R.raw.treat);

Use Recyclerview or ListView to show list of button

You should do something like this, for example, for the button:

Button[] button=new Button[40];

   String buttonName="button"+(i+1);
   int buttonId=getResources().getIdentifier(buttonName,"id",mContext.getPackageName());
   button[i] = (Button) findViewById(buttonId);