Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Thursday, 18 October 2012

Create an application to call specific entered number by user in the EditText

Pro14Activity.java
package ps.pro14;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Pro14Activity extends Activity implements OnClickListener {
    /**
     *  www.master-gtu.blogspot.com
     *  pankaj sharma(8460479175),
     *  chavda vijay(8460420769) 
     */
 EditText num;
 Button dial;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        num=(EditText) findViewById(R.id.editTextnum);
        dial=(Button) findViewById(R.id.buttondial);
        
        dial.setOnClickListener(this);
    }
 @Override
 public void onClick(View v) {
  // TODO Auto-generated method stub
  if(v.getId()==dial.getId())
  {
   Intent myintent=new Intent(Intent.ACTION_DIAL, Uri.parse("tel:"+num.getText()));
   startActivity(myintent);
  }
 }
}

No comments:

Post a Comment