-
Android从网上获取图片并设置桌面背景源码
Android从网上获取图片并设置桌面背景源码
- 2022-05-20 09:06:42下载
- 积分:1
-
android 自动升级示例源码
android 自动升级示例源码
- 2014-06-29下载
- 积分:1
-
仿赶集生活android客户端的介绍启动界面 实例源码
仿赶集生活android客户端的介绍启动界面 实例源码
- 2015-02-19下载
- 积分:1
-
android aidl跨进程调用 完整源码下载(含客户端和服务端源码)
这两天在学习aidl跨进程调用,研究了一天终于写出了个helloword。。做下记录吧。根据官方提供的指南,开发aidl跨进程调用,主要分以下步骤:1. 创建.aidl文件-该文件(YourInterface.aidl)定义了客户端可用的方法和数据的接口。2. 在makefile文件中加入.aidl文件-(Eclipse中的ADT插件提供管理功能)Android包括名为AIDL的编译器,位于tools/文件夹。3. 实现接口-AIDL编译器从AIDL接口文件中利用Java语言创建接口,该接口有一个继承的命名为Stub的内部抽象类(并且实现了一些IPC调用的附加方法),要做的就是创建一个继承YourInterface.Stub的类并且实现在.aidl文件中声明的方法。4. 向客户端公开接口-如果是编写服务,应该继承Service并且重载Service.onBind(Intent) 以返回实现了接口的对象实例上面的东西真的很官方。。下面结合我的例子做一下学习总结:先开发服务器端1.创建一个aidl文件,可以看提供的源码。创建完成后,eclipse插件自动在gen目录下生成同名字的java文件。里面包含一个Stub抽象类,这个类继承自android.os.Binder,这个类是实现整个远程调用的核心。2.然后创建一个类来继承上面说到的那个Stub抽象类,实现里面的抽象方法。(这些抽象方法是根据aidl文件自动生成的)。3.创建一个自定义Service继承自Service,实现其onBind方法,注意此onBind方法必须返回第二步创建的那个Stub类的子类。然后在xml中声明此service,注意此service的声明必须包含一个action,此action也用于客户端的调用使用。(在下面的客户端开发中会有介绍)。4.创建一个activity,此activity只要实现把service启动了即可。这样服务器端就开发完毕,运行后启动了一个可供远程调用的service。关键还是通过onBind暴露一个Binder给客户端。Binder哪来呢?就是通过aidl文件adt会自动生成一个抽象类Stub继承自Binder,只需要创建一个类实现这个Stub的抽象方法即可。然后开发客户端:1.客户端也需要一个aidl文件,注意客户端的aidl文件的包名必须和服务器端的aidl包名一致,名字也相同。创建完后同样会在gen下生成一个接口。2.创建一个Activity,包含变量ServiceConnection con,实现其onServiceConnected和onServiceDisconnected方法,onServiceConnected方法生成第一步那个接口的实现类的对象。con对象用于在onCreate中绑定service,这个service的action必须为服务器端声明的那个service的配置action。绑定中用到con会执行onServiceConnected方法生成aidl对象iPerson。然后就可以通过iPerson来调用aidl里的任意方法返回服务器的东西。客户端开发完毕。关键点是创建aidl文件自动生成了一个接口,在activity中必须绑定服务程序开启的service,在绑定过程中初始化aidl对象。然后就可用aidl对象调用任意方法了。OK,可以运行看效果了。过程真的很繁琐。。但是好像也只能这样了。最主要的还是服务端onBind暴露,然后客户端bindService得到aidl对象。
- 2020-12-01 17:29:26下载
- 积分:1
-
android 异步 执行 任务 例子 附讲解
Rules::The AsyncTask instance must be created in UI thread. .execute must be invoked on the UI thread.Never call objMyTask.onPreExecute(), objMyTask.doInBackground(), objMyTask.onProgressUpdate(), objMyTask.onPostExecute manually.The AsyncTask can be executed only once (an exception will be thrown if a second execution is attempted.)AsyncTask have Four Main Method... onPreExecute() doInBackground() onProgressUpdate() onPostExecute() onPreExecute-This method is called first when you start AsyncTask using objAsync.execute().And mostly this method is use for initializing dialog(ProgressDialog,CustomDialog) and showing. doInBackground-The main purpose of AsyncTask is accomplished by this method.Any non-UI thread process is running in this method.Such as Rss Feed Reader,Image and video Uploading and Downloading.You cant handle your View in this method.Because this method is non-UI thread.While any background process is running if you want to handle UI therea are onProgressUpdate method. after completion of process this method send result to OnPostExecute. onProgressUpdate-While backgrounding task is running ,you can handle your UI using this method .Such as status of downloading or uploading task.and this method is called from doInBackground.Using publishProgress() you can call onProgressUpdate method to update UI while process is running. onPostExecute -This method is called after the background computation finishes.The result of background process in passed in this method as parameters.And now you can dismiss progress dialog ,to indicate that background task is completed. You can cancel AsyncTask using objAsyncTask.cancel().then you just check in doInBackground, if (isCancelled()) { break; } else { //continue... } See this Image For more Clear.
- 2013-07-05下载
- 积分:1
-
手机天气预报源码
手机天气预报源码,代码齐全,android客户端
手机天气预报源码,代码齐全,android客户端。学习和参考非常好的例子
- 2022-01-21 03:46:10下载
- 积分:1
-
二维码扫描功能实例
二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例二维码扫描功能实例
- 2022-02-05 11:28:59下载
- 积分:1
-
fengkuanglanqiu
Android 系统3D游戏开发,名为疯狂投篮。是《oid+3d游戏开发技术详解与典型案例》一书的源码(Android system, 3D game development, called crazy shot. " Oid+3d game development technologies Detailed with a typical case" a source book)
- 2012-07-06 15:26:40下载
- 积分:1
-
Android PopupWindow弹出式信息窗口用法示例
Android PopupWindow弹窗示例,今天的这个弹窗比较单一,比较基础,如果你是Android开发新手的话,那就更好了,非常适合新手朋友学习Android UI中的PopupWindow。
这个实例运行后,在窗体中显示一个小按钮,单击按钮后,将弹出一个图片信息窗口,可关闭这个窗口,是最简单的Android PopupWindow应用了,最终的效果请参见截图所示。
- 2022-03-09 18:51:45下载
- 积分:1
-
安卓游戏制作
应用背景一个简单的安卓开发,便于大家熟悉安卓的小应用,并且加以学习,更好地利用学习资源,有好的东西就要分享嘛,希望大家多多支持,后续还会有更多的资源共享给大家,谢谢!!!关键技术安卓开发的一个Snake贪吃蛇游戏,很适合入门的小伙来学习一下,主要用的事Eclipse开发软件,应用面很广,学习到的知识也挺多的,欢迎各位来下载吧!!!
- 2023-06-11 09:20:03下载
- 积分:1