摘要: 效果图播放器实现了,当电话来是保存当前的播放点,以及当内存不足的时候播放器实例销毁的时候保存播放点以及播放的文件,当重新创建实例的时候获得播放的文件以及播放点。音乐播放api介绍MediaPlayer mediaPlayer = new MediaPlayer();if (mediaPlayer.isPlaying()) { mediaPlayer.reset();//重置为初始状态}mediaPlayer.setDataSource("/sdcard/god.mp3");mediaPlayer.prepare();//缓冲 mediaPlayer.start();//开始 阅读全文
posted @ 2011-06-02 00:29 飞鹰小谭 阅读(596) 评论(0) 推荐(1) 编辑
摘要: 服务--ServiceAndroid中的服务和windows中的服务是类似的东西,服务一般没有用户操作界面,它运行于系统中不容易被用户发觉,可以使用它开发如监控之类的程序。服务的开发比较简单,如下:第一步:继承Service类public class SMSService extends Service { }第二步:在AndroidManifest.xml文件中的<application>节点里对服务进行配置:<service android:name=".SMSService" />服务不能自己运行,需要通过调用Context.startServ 阅读全文
posted @ 2011-06-01 00:02 飞鹰小谭 阅读(1049) 评论(0) 推荐(0) 编辑
摘要: 如果你想窃听别人接收到的短信,达到你不可告人的目的,那么本节内容可以实现你的需求。当系统收到短信时,会发出一个action名称为android.provider.Telephony.SMS_RECEIVED的广播Intent,该Intent存放了接收到的短信内容,使用名称“pdus”即可从Intent中获取短信内容。这里面得到对象数组,数组是以二进制数组格式public class SmsBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent in 阅读全文
posted @ 2011-05-30 00:38 飞鹰小谭 阅读(468) 评论(0) 推荐(1) 编辑
摘要: acitvity状态运行状态暂停状态停止状态activity生命周期图非用户行为把activity不可见的时候,例如电话忽然来了== /** * 重新创建恢复缓存的数据 */ @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { Log.i("onRestoreInstanceState",savedInstanceState.getString("name")); super.onRestoreInstanceState(savedInstanceSta 阅读全文
posted @ 2011-05-29 23:46 飞鹰小谭 阅读(312) 评论(0) 推荐(0) 编辑
摘要: Android基本的设计理念是鼓励减少组件间的耦合,因此Android提供了Intent (意图) ,Intent提供了一种通用的消息系统,它允许在你的应用程序与其它的应用程序间传递Intent来执行动作和产生事件。使用Intent可以激活Android应用的三个核心组件:活动、服务和广播接收器。Intent可以划分成显式意图和隐式意图。显式意图:调用Intent.setComponent()或Intent.setClass()方法指定了组件名或类对象的Intent为显式意图,显式意图明确指定了Intent应该传递给哪个组件。隐式意图:没有调用Intent.setComponent()或Int 阅读全文
posted @ 2011-05-28 00:39 飞鹰小谭 阅读(677) 评论(0) 推荐(0) 编辑
摘要: acitvity 开发A、配置文件<activity android:name=".OtherActivity" android:label="otherActivity"> </activity>B、编写布局文件 C、写一个类继承activity 重写onCreate 在这个方法中设置布局文件setContentView(R.layout.other);activity传参数//意图传参数方法一 //intent.putExtra("name", "谭建平"); //intent.putE 阅读全文
posted @ 2011-05-28 00:38 飞鹰小谭 阅读(1860) 评论(0) 推荐(0) 编辑
摘要: AndroidManifest.xml <uses-library android:name="android.test.runner"/> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.myapp.tests" android:label="MyAppTests" /> 1.继承androidTestCase类。 2.Assert类判断所得到 阅读全文
posted @ 2011-05-25 15:45 飞鹰小谭 阅读(2071) 评论(1) 推荐(0) 编辑
摘要: 效果图1、先定义item item.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content& 阅读全文
posted @ 2011-05-24 00:30 飞鹰小谭 阅读(402) 评论(0) 推荐(0) 编辑
摘要: database.beginTransaction();//开启事务database.setTransactionSuccessful();//当操作成功的时候把事务状态改为成功状态database.endTransaction();//提交事务 会根据事务的状态来提交事务还是回滚事务 阅读全文
posted @ 2011-05-24 00:18 飞鹰小谭 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 使用sqlite自带的crud方法操作数据库,不赞成使用,因为效率没直接操作sql语句高所以只把例子贴出来OtherPersonServicepackage com.tjp.service;import java.util.ArrayList;import java.util.List;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import com. 阅读全文
posted @ 2011-05-23 22:40 飞鹰小谭 阅读(420) 评论(0) 推荐(0) 编辑