作為初學者,入門android開發(fā),我們首先需要了解常見的android應用,例如,拔打電話,發(fā)送短信等諸如此類的功能,由于android系統(tǒng)提供了很完善的函數(shù)或接口,這些功能實現(xiàn)起來都比較簡單,在此百恒軟件開發(fā)工程向廣大初學者全面介紹短信發(fā)送的實現(xiàn)過程及相關代碼,希望對廣大初學者有所幫助。若在學習過程中遇到代碼錯誤的同行也可以與此代碼進行對照,找出錯誤原因。
1.跟開發(fā)WEB程序一樣,先做出UI界面,因為這里我們是要實其功能,界面不作過多的美化。代碼如下:
Activity_main.xml???
android:id="@+id/tv_input_number"?????????? //這個是提示用戶輸入電話號碼的TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_input_number"
android:textSize="20px" />???
android:id="@+id/et_number"??????????????? //這個是輸入電話號碼的文本框
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_input_number"
android:ems="10"
android:inputType="phone" >
android:id="@+id/tv_input_content"????????? //提示輸入內(nèi)容的文本
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/et_number"
android:layout_below="@+id/et_number"
android:text="@string/please_input_content"
android:textSize="20px"
android:textColor="#333333"
/>???
android:id="@+id/et_content"???????????????? //這是輸入文本內(nèi)容的文本編輯器
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_input_content"
android:singleLine="true"
android:lines="5"
android:inputType="textMultiLine" />