Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Java
package manish.yadav;

import java.util.ArrayList;
import java.util.HashMap;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class recorded_audiofiles extends ListActivity {
	// Songs list
	public ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();

	@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.playlist);

		ArrayList<HashMap<String, String>> songsListData = new ArrayList<HashMap<String, String>>();

		audio_recorder_manager plm = new audio_recorder_manager();
		// get all songs from sdcard
		this.songsList = plm.getPlayList();

		// looping through playlist
		for (int i = 0; i < songsList.size(); i++) {
			// creating new HashMap
			HashMap<String, String> song = songsList.get(i);

			// adding HashList to ArrayList
			songsListData.add(song);
		}

		// Adding menuItems to ListView
		ListAdapter adapter = new SimpleAdapter(this, songsListData,
				R.layout.playlist_item, new String[] { "songTitle" }, new int[] {
						R.id.songTitle });

		setListAdapter(adapter);

		// selecting single ListView item
		ListView lv = getListView();
		// listening to single listitem click
		lv.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// getting listitem index
				int songIndex = position;
				
				// Starting new intent
				Intent in = new Intent(getApplicationContext(),
						recorded_audiofiles.class);
				// Sending songIndex to PlayerActivity
				in.putExtra("songIndex", songIndex);
				setResult(100, in);
				// Closing PlayListView
				finish();
			}
		});

	}
}


//Any suggestions would Be Greatly Helpful
Posted
Updated 5-Feb-13 20:33pm
v3
Comments
Sandeep Mewara 9-Jan-13 3:03am    
You need to clearly mention what issue are you facing while trying ?
Manish Yadav 9-Jan-13 3:10am    
I m not getting any error but i want to use audio player when any file is clicked Plz suggest any solution
Manish Yadav 6-Feb-13 2:11am    
Can i share u the whole code :)

Well to start with you can look for media player class on android developer site and more you can find on androidhive.com where in there is example of music player...hope this will solve your problem
 
Share this answer
 
Comments
Manish Yadav 6-Feb-13 2:16am    
I have tried .mp4 files(i.e) the recorded files are showing in the array list but how to trigger the intent for playing them (Plz help me)



Thanx in Advance
Manish Yadav 6-Feb-13 2:18am    
I m not doing the mp3 player bro i m working with the audio recorder with format (.mp4 & .3gp) PLZ HELP me
Manish Yadav 6-Feb-13 2:35am    
here is the link--->https://www.youtube.com/watch?v=M7zdjnjBeDM

plz share ur ideas to improve it
I think in your PlayActivity you maybe write this code get the songIndex in your function onActivityResult(...)
Java
Intent in = data;
int songIndex = in.getIntExtra("songIndex", -1);


So you can pass this songIndex to the formatActivity by Intent ,I think you maybe use the String[] filePath to find the file the filePath[songIndex] find the file in Sdcard
in formatActivity So you can Format it.

hope this will solve your problem.
---------------------------------------------------------

by the way.
find a job in New York.
I have 3 year Experience about andorid.
And have few Experience about game server
in MS 2005 server C++.
Thanks.
----------------------------------------------------------
 
Share this answer
 
Comments
Manish Yadav 12-Feb-13 6:39am    
Thanx Steven i will try this may it helps :)
Manish Yadav 12-Feb-13 6:40am    
@Steven--->What the job are you talking about?
Contact me on manishyadav987@gmail.com

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900