基于Android CALL && SendMes Test的相關(guān)介紹
Intent:當(dāng)找到與設(shè)置的Intent限制相同的Activity時(shí)候通過(guò)startActivity()就會(huì)啟動(dòng)該Activity
電話播號(hào)器:
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("tel:" + strmobile));
startActivity(intent);//方法內(nèi)部會(huì)自動(dòng)為Intent添加類別:android.intent.category.DEFAULT
短信發(fā)送器:
SmsManager manager = SmsManager.getDefault();
ArrayList<String> texts = manager.divideMessage(comtent);
for (String text : texts) {
manager.sendTextMessage(number, null, text, null, null);// 4和5參數(shù)分別為短信發(fā)送狀態(tài),對(duì)方是否收到短信狀態(tài);
}
Toast.makeText(getApplicationContext(),R.string.success,Toast.LENGTH_LONG).show();
吐西對(duì)話框// Toast.makeText(MainActivity.this, resId, duration);//內(nèi)部類訪問(wèn)外部類;
****************************************************************
findViewById(R.id.button);// 根據(jù)id查找顯示控件;
View.OnClickListener() {
@Override
public void onClick(View arg0) {
//arg0 就是被點(diǎn)擊的對(duì)象
}
}
@+id/button:在R文件的id內(nèi)部類里面,添加一個(gè)id為button的常量,使用該常量的值作為此控件的id值;
@android:表示訪問(wèn)android包下的R文件;
@id/label:表示訪問(wèn)id為label的文件;(相對(duì)布局)
單元測(cè)試:
繼承類: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;
相關(guān)文章
30條android項(xiàng)目開(kāi)發(fā)技巧與經(jīng)驗(yàn)總結(jié)
本文為大家總結(jié)了30條android項(xiàng)目開(kāi)發(fā)技巧與經(jīng)驗(yàn),,需要的朋友可以參考下2018-04-04Android事件分發(fā)機(jī)制(下) View的事件處理
這篇文章主要介紹了Android事件分發(fā)機(jī)制下篇, View的事件處理的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01Android學(xué)習(xí)之BottomSheetDialog組件的使用
BottomSheetDialog是底部操作控件,可在屏幕底部創(chuàng)建一個(gè)支持滑動(dòng)關(guān)閉視圖。本文將通過(guò)示例詳細(xì)講解它的使用,感興趣的小伙伴可以了解一下2022-06-06Android自定義View繪制貝塞爾曲線中小紅點(diǎn)的方法
貝塞爾曲線的本質(zhì)是通過(guò)數(shù)學(xué)計(jì)算的公式來(lái)繪制平滑的曲線,分為一階,二階,三階及多階。但是這里不講數(shù)學(xué)公式和驗(yàn)證,那些偉大的數(shù)學(xué)家已經(jīng)證明過(guò)了,所以就只講講Android開(kāi)發(fā)中的運(yùn)用吧2023-02-02