[color=indigo]1.调用系统的拨号:[/color]
[color=indigo]2.系统自带的短信发送: [/color]
配置权限:
[color=indigo]3.单元测试:[/color]
(1),单元测试三与单元测试四的区别
单元测试三 方法必须以test开头;
单元测试四 方法添加注解@Test;
(2),android里面的单元测试
mainfest.xml
LogTest.java
Intent inttent=new Intent(Intent.ACTION_CALL,Uri.pars("tel:"+mobile));
[color=indigo]2.系统自带的短信发送: [/color]
配置权限:
String mobile = mobileText.getText().toString();
String content = contentText.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
if (content.length() > 70) {
List<String> contents = smsManager.divideMessage(content);
for (String smsStr : contents) {
smsManager.sendTextMessage(mobile, null, smsStr, null, null);
}
}else {
smsManager.sendTextMessage(mobile, null, content, null, null);
}
Toast.makeText(SmsActivity.this, "短信发送成功!", Toast.LENGTH_LONG).show();
[color=indigo]3.单元测试:[/color]
(1),单元测试三与单元测试四的区别
单元测试三 方法必须以test开头;
单元测试四 方法添加注解@Test;
(2),android里面的单元测试
mainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.hs"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="4" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner" ></uses-library>
<activity android:name=".Activity02"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OtherActivity" android:label="@string/other">
</activity>
</application>
<instrumentation android:name="android.instrumentationTestRunner" android:targetPackage="org.hs" android:label="android Test" ></instrumentation>
</manifest>
LogTest.java
package org.hs;
import android.test.AndroidTestCase;
import android.util.Log;
public class LogTest extends AndroidTestCase {
private static final String TAG="LogTest";//shift+crtl+s 小写变大写
public void testOne() throws Exception{
int i=1+1;
Log.i(TAG, "result="+i);
}
}