基于Android CALL && SendMes Test的相关介绍
Intent:当找到与设置的Intent限制相同的Activity时候通过startActivity()就会启动该Activity
电话播号器:
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("tel:" + strmobile));
startActivity(intent);//方法内部会自动为Intent添加类别:android.intent.category.DEFAULT
短信发送器:
SmsManager manager = SmsManager.getDefault();
ArrayList<String> texts = manager.divideMessage(comtent);
for (String text : texts) {
manager.sendTextMessage(number, null, text, null, null);// 4和5参数分别为短信发送状态,对方是否收到短信状态;
}
Toast.makeText(getApplicationContext(),R.string.success,Toast.LENGTH_LONG).show();
吐西对话框// Toast.makeText(MainActivity.this, resId, duration);//内部类访问外部类;
****************************************************************
findViewById(R.id.button);// 根据id查找显示控件;
View.OnClickListener() {
@Override
public void onClick(View arg0) {
//arg0 就是被点击的对象
}
}
@+id/button:在R文件的id内部类里面,添加一个id为button的常量,使用该常量的值作为此控件的id值;
@android:表示访问android包下的R文件;
@id/label:表示访问id为label的文件;(相对布局)
单元测试:
继承类: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);判断actual是否为3;
相关文章
Android开发之在程序中时时获取logcat日志信息的方法(附demo源码下载)
这篇文章主要介绍了Android开发之在程序中时时获取logcat日志信息的方法,结合实例形式较为详细的分析了实时获取logcat日志的原理、步骤与相关实现技巧,并附带相应的demo源码供读者下载参考,需要的朋友可以参考下2016-02-02


最新评论