Introduction to Android CALL SendMes Test

Source: Internet
Author: User

Intent: When the Activity with the same Intent limit is found, startActivity () will start the Activity.
Phone BROADCASTER:
Intent. setAction ("android. intent. action. CALL ");
Intent. addCategory ("android. intent. category. DEFAULT ");
Intent. setData (Uri. parse ("tel:" + strmobile ));
StartActivity (intent); // The method automatically adds category: android. Intent. category. DEFAULT to intent.

Text message sender:
SmsManager manager = SmsManager. getDefault ();
ArrayList <String> texts = manager. divideMessage (comtent );
For (String text: texts ){
Manager. sendTextMessage (number, null, text, null, null); // parameters 4 and 5 are the sending status of the SMS, and whether the recipient receives the SMS status;
}
Toast. makeText (getApplicationContext (), R. string. success, Toast. LENGTH_LONG). show ();
Tuxi dialog box // Toast. makeText (MainActivity. this, resId, duration); // internal class access external class;

**************************************** ************************

FindViewById (R. id. button); // query the display control by id;
View. OnClickListener (){
@ Override
Public void onClick (View arg0 ){
// Arg0 is the clicked object
}
}

@ + Id/button: In the internal class of the id of the R file, add a constant whose id is "button" and use the value of this constant as the id value of this control;
@ Android: access the R file under the android package;
@ Id/label: access the file whose id is label (relative layout)

Unit test:
Inheritance class: AndroidTestCase
<Instrumentation
Android: name = "android. test. InstrumentationTestRunner"
Android: targetPackage = "com. hellokity"/>

<Application
Android: icon = "@ drawable/ic_launcher"
Android: label = "@ string/app_name">
<Uses-library android: name = "android. test. runner"/>
</Application>

Actual = function ();
Assert. assertEquals (3, actual); Judge whether actual is 3;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.