当前位置: 首页 > news >正文

毛绒玩具 东莞网站建设 技术支持做网站的公司搞什么活动

毛绒玩具 东莞网站建设 技术支持,做网站的公司搞什么活动,企业所得税优惠政策2021年计算,网站设计收集Loaders#xff0c;获取数据的东西。 总体流程是#xff1a;通过getLoaderManager().initLoader(0,null,this)获得Loader#xff0c;如果没有#xff0c;那么就会调用接口函数获取#xff0c;注意#xff1a;有ID#xff0c;所以要在获取的接口函数里进行相应的选择。 会…  Loaders获取数据的东西。   总体流程是通过getLoaderManager().initLoader(0,null,this)获得Loader如果没有那么就会调用接口函数获取注意有ID所以要在获取的接口函数里进行相应的选择。    会自动更新数据 一个主要依赖Activity或者Fragment存在的。 通过getLoaderManager().initLoader(0,null,this)方法初始化LOADER。 要继承LoaderManager.LoaderCallbacks包括 LoaderManager.LoaderCallbacks includes these methods: onCreateLoader() — Instantiate and return a new Loader for the given ID.onLoadFinished() — Called when a previously created loader has finished its load.onLoaderReset() — Called when a previously created loader is being reset, thus making its data unavailable.These methods are described in more detail in the following sections.   第一个用于创建LOADER一般来说只有init的时候ID对应的LOADER不在的时候才会运行该方法。   第二个一般用来获取数据后的填充适配器。   第三个用于重置。     Loader可以自定义一般使用继承AsyncTaskLoader的类。    /*** A custom Loader that loads all of the installed applications.*/ public static class AppListLoader extends AsyncTaskLoaderListAppEntry {final InterestingConfigChanges mLastConfig new InterestingConfigChanges();final PackageManager mPm;ListAppEntry mApps;PackageIntentReceiver mPackageObserver;public AppListLoader(Context context) {super(context);// Retrieve the package manager for later use; note we dont// use context directly but instead the save global application// context returned by getContext().mPm getContext().getPackageManager();}/*** This is where the bulk of our work is done. This function is* called in a background thread and should generate a new set of* data to be published by the loader.*/Override public ListAppEntry loadInBackground() {// Retrieve all known applications.ListApplicationInfo apps mPm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES |PackageManager.GET_DISABLED_COMPONENTS);if (apps null) {apps new ArrayListApplicationInfo();}final Context context getContext();// Create corresponding array of entries and load their labels.ListAppEntry entries new ArrayListAppEntry(apps.size());for (int i0; iapps.size(); i) {AppEntry entry new AppEntry(this, apps.get(i));entry.loadLabel(context);entries.add(entry);}// Sort the list.Collections.sort(entries, ALPHA_COMPARATOR);// Done!return entries;}/*** Called when there is new data to deliver to the client. The* super class will take care of delivering it; the implementation* here just adds a little more logic.*/Override public void deliverResult(ListAppEntry apps) {if (isReset()) {// An async query came in while the loader is stopped. We// dont need the result.if (apps ! null) {onReleaseResources(apps);}}ListAppEntry oldApps mApps;mApps apps;if (isStarted()) {// If the Loader is currently started, we can immediately// deliver its results.super.deliverResult(apps);}// At this point we can release the resources associated with// oldApps if needed; now that the new result is delivered we// know that it is no longer in use.if (oldApps ! null) {onReleaseResources(oldApps);}}/*** Handles a request to start the Loader.*/Override protected void onStartLoading() {if (mApps ! null) {// If we currently have a result available, deliver it// immediately.deliverResult(mApps);}// Start watching for changes in the app data.if (mPackageObserver null) {mPackageObserver new PackageIntentReceiver(this);}// Has something interesting in the configuration changed since we// last built the app list?boolean configChange mLastConfig.applyNewConfig(getContext().getResources());if (takeContentChanged() || mApps null || configChange) {// If the data has changed since the last time it was loaded// or is not currently available, start a load.forceLoad();}}/*** Handles a request to stop the Loader.*/Override protected void onStopLoading() {// Attempt to cancel the current load task if possible.cancelLoad();}/*** Handles a request to cancel a load.*/Override public void onCanceled(ListAppEntry apps) {super.onCanceled(apps);// At this point we can release the resources associated with apps// if needed.onReleaseResources(apps);}/*** Handles a request to completely reset the Loader.*/Override protected void onReset() {super.onReset();// Ensure the loader is stoppedonStopLoading();// At this point we can release the resources associated with apps// if needed.if (mApps ! null) {onReleaseResources(mApps);mApps null;}// Stop monitoring for changes.if (mPackageObserver ! null) {getContext().unregisterReceiver(mPackageObserver);mPackageObserver null;}}/*** Helper function to take care of releasing resources associated* with an actively loaded data set.*/protected void onReleaseResources(ListAppEntry apps) {// For a simple List there is nothing to do. For something// like a Cursor, we would close it here.} } 上面是官方的代码。 构造方法传入context。 loadInBackground是后台真正获取数据的代码。 deliverResult提交数据给客户端可以直接返回。 onStartLoading处理要开始的请求官方在这里进行了更新的监听。 onStopLoading要求停止官方直接使用cancelLoad()。 onCanceled()取消的操作官方建议对资源进行释放。 onReset重置详细看代码。   这样的话就能从头到尾自定义和使用一个Loader了。转载于:https://www.cnblogs.com/yutoulck/p/3619264.html
http://www.pierceye.com/news/318873/

相关文章:

  • 大型网站的优化方法儿童编程哪家培训机构好
  • 怎么样能够为一个网站做推广金安合肥网站建设专业
  • 免费手机网站商城微信公众号对接网站做
  • 用vs2013做网站公司网站突然404
  • 东莞建站模板搭建广东商城网站建设
  • crm网站下载网站建设网址网站制作
  • 网站开发怎么入驻京东花店网站开发参考文献
  • 郑州专业网站推广优化公司技术支持 东莞网站建设
  • 苏州做网站的公司哪家最好网站企业
  • 厦门做网站seo网络营销就是什么
  • 哪个网站可以学做蛋糕网络软件系统
  • 网站制作的核心要点是什么找人做网站服务器不是自己的怎么办
  • 自己做国际网站福建省文明建设办公室网站
  • 天津专业做网站的公司私人免费网站怎么下载
  • 深圳网站设计灵点网络口碑好广州海珠建网站
  • 网站开启gzip压缩西安的推广公司
  • 深圳彩票网站建设企业邮箱免费版开通
  • 佛山网站建设网络推广wordpress文章加音频
  • 设计师新手接单网站怎么把自己做的网站
  • 动漫制作专业在国企河北网络营销推广seo
  • 潜江网站建设兼职万网人网站备案流程
  • 物流官网网站今天新闻联播
  • 郑州网站开发的公司三亚今天最新通知
  • 足球直播网站怎么做东莞市公司网站建设平台
  • 建设网站需要了解什么校园网站建设和管理工作制度
  • 网站商务通弹出窗口图片更换设置移动端cpu
  • 成都画册设计的公司海外seo托管
  • 中国早期互联网公司河南seo网站开发
  • wordpress添加短代码优化营商环境的金句
  • 网站访问统计js代码wordpress后台登陆不进去