android学习记录
1 ) 一般顺序
?
功能清单:添加电话服务权限
<uses-permission android:name="android.permission.CALL_PHONE"/>
?
?
布局
界面布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
??? android:orientation="vertical"
??? android:layout_width="fill_parent"
??? android:layout_height="fill_parent" >
??? <TextView?
??? android:layout_width="fill_parent" android:layout_height="wrap_content"
??? android:text="@string/inputmobile"/>
???
??? <EditText android:layout_width="fill_parent" android:layout_height="wrap_content"
??? android:id="@+id/mobile"/>
???
??? <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
??? android:text="@string/button"
??? android:id="@+id/button"/>
</LinearLayout>
?
?
?
Activity:
public class DialerAction extends Activity {
??? @Override
??? public void onCreate(Bundle savedInstanceState) {
??????? super.onCreate(savedInstanceState);
??????? setContentView(R.layout.main);
??????? Button button = (Button)findViewById(R.id.button);
??????? button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
??????? EditText editText = (EditText)findViewById(R.id.mobile);
??????? Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+ editText.getText()));
?????? DialerAction.this.startActivity(intent);
}
??????? });
??? }
}
?
??????
?
测试步骤:
?1>在Eclipse中运行此应用
?2>在Dos窗口中进入android SDK安装路径的tools目录,输入以下命令再开启一个Android模拟器:
? emulator -data itcast?
?? 注:itcast为用户数据存取文件,如果该文件不存在,默认在tools目录创建该文件
?
?
word为自己不断增加的笔记 。
其它为未看完的资料。