Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
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 8-Jan-13 19:21pm
Edited 5-Feb-13 20:33pm
v3
Comments
Sandeep Mewara at 9-Jan-13 3:03am
   
You need to clearly mention what issue are you facing while trying ?
Manish Yadav at 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 at 6-Feb-13 2:11am
   
Can i share u the whole code :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
Manish Yadav at 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 at 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 at 6-Feb-13 2:35am
   
here is the link--->https://www.youtube.com/watch?v=M7zdjnjBeDM plz share ur ideas to improve it
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I think in your PlayActivity you maybe write this code get the songIndex in your function onActivityResult(...)
		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.
----------------------------------------------------------
  Permalink  
Comments
Manish Yadav at 12-Feb-13 6:39am
   
Thanx Steven i will try this may it helps :)
Manish Yadav at 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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 680
1 OriginalGriff 379
2 Manas Bhardwaj 350
3 Abhinav S 293
4 Sampath Lokuge 245
0 Sergey Alexandrovich Kryukov 7,647
1 OriginalGriff 4,287
2 Peter Leow 3,681
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid