您好我正在寻找一种方法在平板电脑上存储50个mp3(而不是应用程序)并将它们放入Array的MediaPlayer中,如下所示。 当我按下按钮时,我的应用程序需要播放随机歌曲。如果我把歌曲放到应用程序中我有这个问题:有时我的应用程序崩溃没有任何规则。我想是因为这些歌曲大约是8 / 9Mb而且很重。
public void loadingSongs (){
mpList [0] = MediaPlayer.create(Activity_Ascolta.this, R.raw.a24k_magic);
mpList [1] = MediaPlayer.create(Activity_Ascolta.this, R.raw.abbaon_fat_tracks);
mpList [2] = MediaPlayer.create(Activity_Ascolta.this, R.raw.after_the_afterlife);
mpList [3] = MediaPlayer.create(Activity_Ascolta.this, R.raw.amalia);
mpList [4] = MediaPlayer.create(Activity_Ascolta.this, R.raw.amerimacka);
mpList [5] = MediaPlayer.create(Activity_Ascolta.this, R.raw.angels);
mpList [6] = MediaPlayer.create(Activity_Ascolta.this, R.raw.anymore);
mpList [7] = MediaPlayer.create(Activity_Ascolta.this, R.raw.baby_gurl_original_mix);
mpList [8] = MediaPlayer.create(Activity_Ascolta.this, R.raw.back_home);
mpList [9] = MediaPlayer.create(Activity_Ascolta.this, R.raw.beautiful_escape_feat_zak_a);
mpList [10] = MediaPlayer.create(Activity_Ascolta.this, R.raw.better_with_you);
mpList [11] = MediaPlayer.create(Activity_Ascolta.this, R.raw.black_jeans_vocal_mix);
mpList [12] = MediaPlayer.create(Activity_Ascolta.this, R.raw.body_music);
mpList [13] = MediaPlayer.create(Activity_Ascolta.this, R.raw.born_to_run);
mpList [14] = MediaPlayer.create(Activity_Ascolta.this, R.raw.brother_john);
mpList [15] = MediaPlayer.create(Activity_Ascolta.this, R.raw.bye_bye_boy);
mpList [16] = MediaPlayer.create(Activity_Ascolta.this, R.raw.cloud_9);
mpList [17] = MediaPlayer.create(Activity_Ascolta.this, R.raw.daddy_s_groove);
mpList [18] = MediaPlayer.create(Activity_Ascolta.this, R.raw.don_t_go);
mpList [19] = MediaPlayer.create(Activity_Ascolta.this, R.raw.down_the_road_irfane_remix);
mpList [20] = MediaPlayer.create(Activity_Ascolta.this, R.raw.down_to_the_sound);
mpList [21] = MediaPlayer.create(Activity_Ascolta.this, R.raw.eye_of_the_tiger);
mpList [22] = MediaPlayer.create(Activity_Ascolta.this, R.raw.fly_feat_kelsey);
mpList [23] = MediaPlayer.create(Activity_Ascolta.this, R.raw.glad_edit);
mpList [24] = MediaPlayer.create(Activity_Ascolta.this, R.raw.i_can_see_clearly_now);
mpList [25] = MediaPlayer.create(Activity_Ascolta.this, R.raw.i_don_t_wanna_live_forever_fifty_shades_darker);
mpList [26] = MediaPlayer.create(Activity_Ascolta.this, R.raw.jump);
mpList [27] = MediaPlayer.create(Activity_Ascolta.this, R.raw.kill_it_tonight_feat_ice_mc);
mpList [28] = MediaPlayer.create(Activity_Ascolta.this, R.raw.kindling_for_the_master_majo);
mpList [29] = MediaPlayer.create(Activity_Ascolta.this, R.raw.lady_divine);
mpList [30] = MediaPlayer.create(Activity_Ascolta.this, R.raw.life_round_here);
mpList [31] = MediaPlayer.create(Activity_Ascolta.this, R.raw.make_you_feel);
mpList [32] = MediaPlayer.create(Activity_Ascolta.this, R.raw.melt_away_original_mix);
mpList [33] = MediaPlayer.create(Activity_Ascolta.this, R.raw.midnight_feast);
mpList [34] = MediaPlayer.create(Activity_Ascolta.this, R.raw.palace_posy);
mpList [35] = MediaPlayer.create(Activity_Ascolta.this, R.raw.pirates_of_samba_oxio_radio);
mpList [36] = MediaPlayer.create(Activity_Ascolta.this, R.raw.pledge_allegiance_the_rimsho);
mpList [37] = MediaPlayer.create(Activity_Ascolta.this, R.raw.queen_of_the_night_feat_nik);
mpList [38] = MediaPlayer.create(Activity_Ascolta.this, R.raw.set_me_free_feat_alexandra_p);
mpList [39] = MediaPlayer.create(Activity_Ascolta.this, R.raw.sister_welcome);
mpList [40] = MediaPlayer.create(Activity_Ascolta.this, R.raw.space_walk);
mpList [41] = MediaPlayer.create(Activity_Ascolta.this, R.raw.the_sweetest);
mpList [42] = MediaPlayer.create(Activity_Ascolta.this, R.raw.to_get_up_with_you_remix);
mpList [43] = MediaPlayer.create(Activity_Ascolta.this, R.raw.towers_feat_szjerdene);
mpList [44] = MediaPlayer.create(Activity_Ascolta.this, R.raw.traveling_miles);
mpList [45] = MediaPlayer.create(Activity_Ascolta.this, R.raw.tricks_main_vocal_original);
mpList [46] = MediaPlayer.create(Activity_Ascolta.this, R.raw.ugly_brotha_real_nices_pri);
mpList [47] = MediaPlayer.create(Activity_Ascolta.this, R.raw.wanting_you);
mpList [48] = MediaPlayer.create(Activity_Ascolta.this, R.raw.we_just_couldnt_say_goodbye);
mpList [49] = MediaPlayer.create(Activity_Ascolta.this, R.raw.you_d_be_so_nice_to_come_home);
return ;
}