package sra.dialer;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class AndroidPhoneDialer extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Intent Dialintent=new Intent(Intent.DIAL_ACTION,Uri.parse("9912326989"));
// Intent.DIAL_ACTION method is deprecated
// ACTION_DIAL -- Display the phone dialer with the given number filled in.
Intent DialIntent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:5551212"));
// The ACTION_DIAL Intent
// takes in data as a URI. Thus, you need to use Uri.parse to parse out your phone number.
// Using Uri.parse will ensure that the DIAL_ACTION Intent understands the number you
// are trying to dial. You pass Uri.parse a string that represents the phone number you want to dial
startActivity(DialIntent);
// Notice that you pass to startActivity( ) your Intent. The Intent is then passed to
// Android, and the action is resolved.
}
// here simply it displays no register network , why beacause it's has no connection
}
// for Explanation :
//As you can see, you have now opened the phone’s Dialer Activity. The Dialer is
//displaying the phone number that you passed to it, 5551212. Using the Emulator, click
//the Send button, and the phone should now call 555-1212—virtually of course.
//Just displaying the Dialer Activity is useful only if you want to create an application
//that allows the user to edit the number before calling it, or even confirm that they really
//want to make the call.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class AndroidPhoneDialer extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Intent Dialintent=new Intent(Intent.DIAL_ACTION,Uri.parse("9912326989"));
// Intent.DIAL_ACTION method is deprecated
// ACTION_DIAL -- Display the phone dialer with the given number filled in.
Intent DialIntent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:5551212"));
// The ACTION_DIAL Intent
// takes in data as a URI. Thus, you need to use Uri.parse to parse out your phone number.
// Using Uri.parse will ensure that the DIAL_ACTION Intent understands the number you
// are trying to dial. You pass Uri.parse a string that represents the phone number you want to dial
startActivity(DialIntent);
// Notice that you pass to startActivity( ) your Intent. The Intent is then passed to
// Android, and the action is resolved.
}
// here simply it displays no register network , why beacause it's has no connection
}
// for Explanation :
//As you can see, you have now opened the phone’s Dialer Activity. The Dialer is
//displaying the phone number that you passed to it, 5551212. Using the Emulator, click
//the Send button, and the phone should now call 555-1212—virtually of course.
//Just displaying the Dialer Activity is useful only if you want to create an application
//that allows the user to edit the number before calling it, or even confirm that they really
//want to make the call.
No comments:
Post a Comment