摘要: 要监听android打电话和接电话,只需下面2步骤1.第一步,写一个Receiver继承自BroadcastReceiver 1 import android.app.Service; 2 import android.content.BroadcastReceiver; 3 import android.content.Context; 4 import android.content.Intent; 5 import android.telephony.TelephonyManager; 6 import android.util.Log; 7 8 public class PhoneS. 阅读全文
posted @ 2013-08-07 14:34 欢醉 阅读(548) 评论(0) 推荐(0) 编辑
摘要: 在使用ListView时,会遇到当ListView列表滑动到最底端时,添加新的列表项的问题,本文通过代码演示如何动态的添加新的列表项到ListView中。实现步骤:调用ListView的setOnScrollListener()方法设置滑动监听器,实现OnScrollListener接口的方法,判断当列表滑动到最低端时,加载新的列表项。其中OnScrollListener接口需要实现如下两个方法:onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)view 报告滑动状 阅读全文
posted @ 2013-08-04 16:55 欢醉 阅读(1960) 评论(0) 推荐(0) 编辑
摘要: 本文给大家演示异步加载图片的分析过程。让大家了解异步加载图片的好处,以及如何更新UI。首先给出main.xml布局文件:简单来说就是 LinearLayout 布局,其下放了2个TextView和5个ImageView。 1 2 7 12 17 22 27 32 37 42 我们将演示的过程是异步从服务器上下载5张不同图片,依次放入这5个ImageView。上下2个TextView 是为了方便我们看是否阻塞了UI的显示。 当然 AndroidManifest.xml 文件中要配置好网络访问权限。1)Handler+Runnable模式... 阅读全文
posted @ 2013-08-04 16:51 欢醉 阅读(416) 评论(0) 推荐(0) 编辑
摘要: excel导入时还要保存字体、其背景颜色等信息时读取方法就要改变: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6 using System.Data.OleDb; 7 using System.Data; 8 using Microsoft.Office.Interop.Excel; 9 using System.Reflection; 10 using System.Runtime.Inter... 阅读全文
posted @ 2013-05-28 10:09 欢醉 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 幻灯片图片浏览器1.布局 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical" 阅读全文
posted @ 2013-03-02 12:14 欢醉 阅读(1471) 评论(0) 推荐(0) 编辑
摘要: 1.布局 1 6 7 13 14 20 21 22 28 29 35 36 37 43 44 50 51 52 2.逻辑控制 1 package com.example.androidtabhost; 2 3 import android.os.Bundle; 4 import android.app.Activity; 5 import android.app.TabActivity; 6 import android.view.LayoutInflater; 7 import androi... 阅读全文
posted @ 2013-02-28 17:13 欢醉 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 1.布局 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical" 6 tools: 阅读全文
posted @ 2013-02-28 16:35 欢醉 阅读(1512) 评论(0) 推荐(0) 编辑
摘要: 拖动滑块改变图片透明度1.布局 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical&quo 阅读全文
posted @ 2013-02-28 16:29 欢醉 阅读(6056) 评论(0) 推荐(0) 编辑
摘要: 1. 获得当前年月日时分1 Calendar cal = Calendar.getInstance();2 year = cal.get(Calendar.YEAR);3 month = cal.get(Calendar.MONTH);4 day = cal.get(Calendar.DAY_OF_MONTH);5 hour = cal.get(Calendar.HOUR);6 minute = cal.get(Calendar.MINUTE);2.初始化DatePicker组件,指定监听 1 ... 阅读全文
posted @ 2013-02-28 14:48 欢醉 阅读(905) 评论(0) 推荐(0) 编辑
摘要: 1.只用XML配置来显示列表在res\values中添加一个arrays.xml 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 4 <string-array name="books"> 5 <item>口里奇才</item> 6 <item>凸显</item> 7 <item>下雨目前</item> 8 <item>越来越一直在于</item 阅读全文
posted @ 2013-01-22 11:52 欢醉 阅读(4243) 评论(0) 推荐(0) 编辑