I have an app through which I can make a call to a number. What I want
is to send an prerecorded message or audio file which the receiver
will hear once he receive the call. Can any one help me.?....

here is my code...

package com.DialANumber;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;

public class DialANumber extends Activity {
        EditText mEditText_number = null;
        LinearLayout mLinearLayout_no_button = null;
        Button mButton_dial = null;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                mLinearLayout_no_button = new LinearLayout(this);

                mEditText_number = new EditText(this);
                mEditText_number.setText("9830...132"); // my number
                mLinearLayout_no_button.addView(mEditText_number);

    mButton_dial = new Button(this);
    mButton_dial.setText("Dial!");
    mLinearLayout_no_button.addView(mButton_dial);
    mButton_dial.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
                performDial();
        }
    });

    setContentView(mLinearLayout_no_button);
        }

  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_CALL) {
        performDial();
       return true;
    }
    return false;
}

        public void performDial(){
                if(mEditText_number!=null){
                        try {
                                Log.e("started", "hi");
                                startActivity(new Intent(Intent.ACTION_CALL, 
Uri.parse("tel:" +
mEditText_number.getText())));

                        } catch (Exception e) {
                                e.printStackTrace();
                        }
                }//if
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to