Android onactivityresult returns null if picked using default picker -
i had strange problem, i've checked on , on web found nothing , code has no problems @ all, want pick audio file fragment here code:
public void onclick(view arg0) { switch (arg0.getid()) { case r.id.upload_btn_select_file: intent musicintent = new intent(ringtonemanager.action_ringtone_picker); //musicintent.putextra(ringtonemanager.extra_ringtone_type, ringtonemanager.type_notification); startactivityforresult(musicintent, req_music); break; } }
and
@override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); log.v("activity result" , "first enter"); //handle music if( requestcode == req_music && resultcode == activity.result_ok ) { log.v("activity result" , "ok"); log.v("data" , data.getdata()+""); } }
now if pick song android default picker get
03-10 17:55:40.160: v/activity result(32644): first enter 03-10 17:55:40.160: v/activity result(32644): ok 03-10 17:55:40.160: v/data(32644): null
but if pick same song es explorer picker get
03-10 17:48:46.400: v/activity result(32644): first enter 03-10 17:48:46.400: v/activity result(32644): ok 03-10 17:48:46.400: v/data(32644): content://com.estrongs.files/mnt/sdcard/music/01%20-%20first%20strike%20is%20deadly.mp3
i'm using android 4.0 on xperia-neo-v, there can in code fix this? or it's sony's build?
i've added check received intent , found has keys
iterator<string> keyset= data.getextras().keyset().iterator(); while( keyset.hasnext()) log.v("key" , keyset.next());
then grabbed contains uri
log.v("uri" , data.getextras().get(ringtonemanager.extra_ringtone_picked_uri)+"");
Comments
Post a Comment