How i can pick mp3 file from sdcard in android preferenceScreen menu..
here is my preferenceScreen:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/app_setting">
<Preference android:title="@string/ChooseRingtone"
android:key="sdPref" />
</PreferenceCategory>
</PreferenceScreen>
here my SettingActivity:
public class SettingsActivity extends AppCompatPreferenceActivity{
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
if(savedInstanceState == null){
android.app.Fragment infoFragment = new MyPreferenceFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.fragment_container, infoFragment);
ft.commit();
}
public static class MyPreferenceFragment extends PreferenceFragment {
private AppSettings settings;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref);
Preference sdPrefs = findPreference("sdPref");
sdPrefs.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return false;
}
});
}
}
what i dont know is how to open sdcard and choose only .mp3 extension files from whole sdcard. and how to store that mp3 file to my asset/raw directory if it possible