摘要:myactivityintent.setAction(ACTION);sendBroadcast(intent);//////////////xml注册<receiver android:name=".service.MyReceiver" android:label="@string/app_name"> <intent-filter ><action android:name="android.provider.Telephony.SMS_RECEIVED"/></intent-filte
阅读全文
摘要:notificationtry{ Log.i(TAG, "service 线程文件下载:"+Thread.currentThread().getId()); showNotification(false); Thread.sleep(10000);} catch (InterruptedException e){ // TODO Auto-generated catch block e.printStackTrace();}showNotification(true);//////////////////////////////private void showNotifi
阅读全文
摘要:AServiceis an application component that can perform long-running operations in the background and does not provide a user interface.Service 后台长时间执行的控件service 声明:<service android:name=".service.ExampleSercice"/>1Started 调用者与服务者没关系oncreate->onstartCommand ->ondestroy2Bound调用者与服务
阅读全文
摘要:Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, calledintents.Intent 一次对即将执行的操作的抽象描述1 Action 之 打电话发短信(注意添加打电话发短信权限<uses-permission android:name="android.permission.CALL_PHONE" /><uses-permission andro
阅读全文
摘要:1.LinearLayout 线性布局(主要分为水平和垂直线性布局)android:layout_width="fill_parent"android:layout_height="fill_parent"fill_parent会使得android:layout_weight="1" 分配的比重均衡android:gravity 表示子控件对齐方式或是内容文本的对齐方式// horizontal表示垂直线性布局 <LinearLayout xmlns:android="http://schemas.android.co
阅读全文
摘要:1.DatePicker 日期控件java.lang.Objectandroid.view.Viewandroid.view.ViewGroupandroid.widget.FrameLayoutandroid.widget.DatePicker//Layout/main.xml<DatePicker android:id="@+id/dp" android:layout_width="fill_parent" android:layout_height="wrap_content" />//MyActivity.java
阅读全文
摘要:Spinner 实现下拉选择java.lang.Object ↳ android.view.View ↳ android.view.ViewGroup ↳ android.widget.AdapterView<T extends android.widget.Adapter> ↳ android.widget.AbsSpinner↳android.widget.Spinner// Layout/main.xml<Spinner android:id="@+id/planets_spinner" android:layout_width="wr..
阅读全文
摘要:1.RadioButton(Button->CompoundButton子类)<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="1"> &l
阅读全文
摘要:Button(textview 子类)----控件能向用户展现文本信息// With text<Button android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="@string/button_text" ... />// Withan icon ( ImageView 子类)<ImageButtonandroid:layout_width="wrap_content"android
阅读全文
摘要:1.EditText(textview 子类)----控件能向用户展现文本信息//在XML布局文件中使用android:singleLine="false" 设置多行android:maxLength="3"限制输入字符数量android:hint="@string/hello"设置提示信息android:inputType="phone"限制EditText输入信息android:drawableLeft="@drawable/title"在EditText中显示图片android:backg
阅读全文
摘要:TextView(view 子类)----控件能向用户展现文本信息//在程序中创建TextView对象TextViewtv=new TextView(this);tv.setText("你好");setContentView(tv);//在XML布局文件中使用----通过解析xml文件构造view类设置字体的大小推荐使用sp作为单位android:layout_width="wrap_content" android:layout_height="fill_parent"android:height设置文本区域的高度,支持度量单位:p
阅读全文
摘要:AnActivityis an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may
阅读全文
摘要:1. 要有java基础 2.安装JDK 官方下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html 当前最新版本是java se 7u5 3.下载Eclipse 官方下载地址: http://www.eclipse.org/downloads/ 根据需要下载 32Bit或64 Bit 版本的(现大多数windows操作系统是32 Bit) 4.安装Android SDK 官方下载地址: http://developer.android.com/sdk/index.html 5.安装Ec...
阅读全文