Advertisement
AntonioLinux

ex1

Nov 15th, 2011
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. package testesempio8.com;
  2.  
  3.  
  4. import java.io.IOException;
  5.  
  6. import android.app.Activity;
  7. import android.os.Bundle;
  8. import android.util.Log;
  9. import android.view.View;
  10. import android.view.View.OnClickListener;
  11. import android.widget.Button;
  12.  
  13. public class Testesempio8Activity extends Activity {
  14.     /** Called when the activity is first created. */
  15.     private final static String ACTIVITY_TAG = "activity 1";
  16.  
  17.  
  18.    
  19.     @Override
  20.     public void onCreate(Bundle savedInstanceState) {
  21.         super.onCreate(savedInstanceState);
  22.         setContentView(R.layout.main);
  23.    
  24.         final AudioRecorder recorder = new AudioRecorder("test/tmp.3gp");
  25.    
  26.      
  27.       Button startRecButton = (Button) findViewById(R.id.button1);
  28.      
  29.       startRecButton.setOnClickListener(new OnClickListener() {
  30.        
  31.         public void onClick(View arg0) {
  32.             Log.i(ACTIVITY_TAG, "start "); 
  33.        
  34.      
  35.             try {
  36.                 //recorder
  37.                 recorder.start();
  38.                 } catch (IOException e) {
  39.                 // TODO Auto-generated catch block
  40.                 e.printStackTrace();
  41.                 }
  42.                    
  43.                        
  44.         }
  45.             }  );
  46.      
  47.      
  48.       // secondo bottone
  49.  Button stopRecButton = (Button) findViewById(R.id.button2);
  50.      
  51.  stopRecButton.setOnClickListener(new OnClickListener() {
  52.        
  53.         public void onClick(View arg0) {
  54.             Log.i(ACTIVITY_TAG, "Stop ");  
  55.        
  56.      
  57.             try {
  58.                 recorder.stop();
  59.                 } catch (IOException e) {
  60.                 // TODO Auto-generated catch block
  61.                 e.printStackTrace();
  62.                 }
  63.                    
  64.                        
  65.         }
  66.             }  );  
  67.      
  68.      
  69.      
  70.      
  71.      
  72.      
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement