I am fetching my songs from the SD card and putting him to the list view.
I am using this method. but its taking some time and if path is different I didn\'t get tha
this will help you to make a listview using that playlist
public class PlayListActivity extends ListActivity {
public ArrayList> songsList = new ArrayList>();
private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.playlist);
EditText search = (EditText) findViewById(R.id.et_search_music);
ListView lv = (ListView) findViewById(android.R.id.list);
context = PlayListActivity.this;
ArrayList> songsListData = new ArrayList>();
this.songsList = MusicPlayerActivity.songsList;
if (this.songsList.size() > 0) {
final SimpleAdapter adapter = new SimpleAdapter(this,
this.songsList, R.layout.playlist_item,
new String[] { "songTitle" }, new int[] { R.id.songTitle });
setListAdapter(adapter);
lv.setTextFilterEnabled(true);
lv = getListView();
search.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count) {
adapter.getFilter().filter(s);
}
@Override
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view,
int position, long id) {
int CurrentSongIndex = position;
Intent in = new Intent();
in.putExtra("songIndex", CurrentSongIndex);
setResult(100, in);
finish();
}
});
}
}
}