• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RestoreObserver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.app.backup.RestoreObserver的典型用法代码示例。如果您正苦于以下问题:Java RestoreObserver类的具体用法?Java RestoreObserver怎么用?Java RestoreObserver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RestoreObserver类属于android.app.backup包,在下文中一共展示了RestoreObserver类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onOptionsItemSelected

import android.app.backup.RestoreObserver; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.create:
            createTestFiles();
            break;
        case R.id.restore:
            new BackupManager(this).requestRestore(new RestoreObserver() {
                @Override
                public void restoreFinished(int error) {
                    if (error == 0) {
                        Toast.makeText(MainActivity.this, R.string.files_restored, Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(MainActivity.this, getString(R.string.restore_failed, error), Toast.LENGTH_SHORT).show();
                    }
                }
            });
            break;
    }

    return super.onOptionsItemSelected(item);
}
 
开发者ID:mightyfrog,项目名称:Key-Value-Backup-API-Sample,代码行数:23,代码来源:MainActivity.java


示例2: onRestoreButtonClick

import android.app.backup.RestoreObserver; //导入依赖的package包/类
/**
 * Click handler, designated in the layout, that runs a restore of the app's
 * most recent data when the button is pressed.
 */
public void onRestoreButtonClick(View v) {
    Log.v(TAG, "Requesting restore of our most recent data");
    BackupManager mBackupManager = new BackupManager(this);
    mBackupManager.requestRestore(new RestoreObserver() {
        public void restoreFinished(int error) {
            /** Done with the restore! Now draw the new state of our data */
            if (error == 0) {
                Log.v(TAG, "Restore finished, error = " + error);
                NotifToasts.showBackupRestored(GeoPingPrefActivity.this);
            } else {
                Log.e(TAG, "Restore finished with error = " + error);
            }
        }
    });
}
 
开发者ID:gabuzomeu,项目名称:geoPingProject,代码行数:20,代码来源:GeoPingPrefActivity.java


示例3: onRestoreButtonClick

import android.app.backup.RestoreObserver; //导入依赖的package包/类
/**
 * Click handler, designated in the layout, that runs a restore of the app's
 * most recent data when the button is pressed.
 */
public void onRestoreButtonClick(View v) {
    Log.v(TAG, "Requesting restore of our most recent data");
    mBackupManager.requestRestore(
            new RestoreObserver() {
                public void restoreFinished(int error) {
                    /** Done with the restore!  Now draw the new state of our data */
                    Log.v(TAG, "Restore finished, error = " + error);
                    populateUI();
                }
            }
    );
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:17,代码来源:BackupRestoreActivity.java


示例4: requestRestore

import android.app.backup.RestoreObserver; //导入依赖的package包/类
public void requestRestore() {
    RestoreObserver restoreObserver = new RestoreObserver() {
        @Override
        public void onUpdate(int nowBeingRestored, String currentPackage) {
            super.onUpdate(nowBeingRestored, currentPackage);
        }
    };

    BackupManager bm = new BackupManager(this);
    bm.requestRestore(restoreObserver);
}
 
开发者ID:GeeksEmpireNet,项目名称:Shortcuts,代码行数:12,代码来源:BackupHandler.java


示例5: onCreate

import android.app.backup.RestoreObserver; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Long lastCheck = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getLong("lastCheck", -1);
    if(lastCheck==-1){
        new BackupManager(getApplicationContext()).requestRestore(new RestoreObserver() {
            @Override
            public void restoreStarting(int numPackages) {
                super.restoreStarting(numPackages);


            }

            @Override
            public void onUpdate(int nowBeingRestored, String currentPackage) {
                super.onUpdate(nowBeingRestored, currentPackage);


            }

            @Override
            public void restoreFinished(int error) {
                super.restoreFinished(error);
                Log.i(Constants.LOG_TAG, "REstore finalizou " + error);
                Toast.makeText(getApplicationContext(), "Restoure completou " + error, Toast.LENGTH_SHORT).show();
                CrawlSMSInbox.startCrawlingSMSInbox(getApplicationContext());
            }
        });
    }else {
        CrawlSMSInbox.startCrawlingSMSInbox(getApplicationContext());
    }
}
 
开发者ID:rafaelcoutinho,项目名称:cowbird,代码行数:33,代码来源:AnotaProtocolo.java


示例6: requestRestore

import android.app.backup.RestoreObserver; //导入依赖的package包/类
private boolean requestRestore(Context ctx) {
    BackupManager bm = new BackupManager(ctx);
    RestoreObserver restoreObserver = new RestoreObserver() {

        @Override
        public void restoreStarting(int numPackages) {
            sRestoring = true;
            showNote(R.string.prog_SearchingForBackup);
        }

        @Override
        public void restoreFinished(int error) {
            sBackupExists = (error == 0);
            sRestoring = false;

            // we passed backup restore, now we can load databases...
            doUpgradeDatabaseInPlace();
        }
    };
    try {
        int res = bm.requestRestore(restoreObserver);
        return res == 0 ? true : false;
    } catch (NullPointerException e) {
        // catch failure of RestoreSession object to manage itself in the
        // following:
        // android.app.backup.RestoreSession.endRestoreSession(RestoreSession.java:162)
        // android.app.backup.BackupManager.requestRestore(BackupManager.java:154)
        return false;
    }
}
 
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:31,代码来源:SafeSlinger.java


示例7: requestRestore

import android.app.backup.RestoreObserver; //导入依赖的package包/类
public void requestRestore() {
    Log.d(LOG_TAG, "request restore");

    BackupManager bm = new BackupManager(getActivity());
    bm.requestRestore(
            new RestoreObserver() {
                @Override
                public void restoreStarting(int numPackages) {
                    Log.d(LOG_TAG, "Restore from cloud starting.");
                    Log.d(LOG_TAG, "" + gameData.getTotalMoves());

                    super.restoreStarting(numPackages);
                }

                @Override
                public void onUpdate(int nowBeingRestored, String currentPackage) {
                    Log.d(LOG_TAG, "Restoring " + currentPackage);
                    super.onUpdate(nowBeingRestored, currentPackage);
                }

                @Override
                public void restoreFinished(int error) {
                    Log.d(LOG_TAG, "Restore from cloud finished.");

                    super.restoreFinished(error);
                    Log.d(LOG_TAG, "" + gameData.getTotalMoves());

                    Log.d(LOG_TAG, "calling load");
                    load();

                }
            });
}
 
开发者ID:TylerCarberry,项目名称:2048-Battles,代码行数:34,代码来源:GameFragment.java


示例8: onCreateView

import android.app.backup.RestoreObserver; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main_control, container, false);

    ((TextView) rootView.findViewById(R.id.full_text)).setText(Html.fromHtml(
            "<p>O AnotaProtocolo permite que você mantenha organizados todos os números de protocolos de operadoras que você tiver.</p><p><b>Organizando protocolos</b><br/>" +
                    "Os seus protocolos recebidos por SMS são automaticamente carregados no aplicativo. Também é possível adicionar novos protocolos manualmente.</p>" +
                    "<p><b>Adicionar Comentários</b><br/>Os protocolos podem ter anotações pessoais para facilitar o seu controle de qual protocolo se refere a qual solicitação.</p>" +
                    "<p><b>Apagar Protocolos</b><br>Caso um protocolo não seja mais importante você pode apagá-lo. Pressione-o por 3 segundos na lista de protocolos para iniciar a remoção.</p>" +
                    "<p><b>Precisa de Ajuda</b><br/>Caso esteja com problemas para utilizar o aplicativo ou gostaria de ter uma nova operadora controlada automaticamente pelo aplicativo acesse estes <a href='https://github.com/rafaelcoutinho/cowbird/issues'>link</a> ou envie um e-mail para: <a href='mailto:[email protected]'>[email protected]</a></p>" +
                    "<hr/><p>Desenvolvido por <a href='https://github.com/DaviRSSilva'>Davi Ribeiro</a> e <a href='https://github.com/rafaelcoutinho'>Rafael Coutinho</a><br>Licenciado sob GPLv2</p>"));
    ((TextView) rootView.findViewById(R.id.full_text)).setMovementMethod(LinkMovementMethod.getInstance());

    ((TextView) rootView.findViewById(R.id.full_text)).setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            new BackupManager(getActivity()).requestRestore(new RestoreObserver() {
                @Override
                public void restoreStarting(int numPackages) {
                    super.restoreStarting(numPackages);

                    Log.i(Constants.LOG_TAG, "Iniciando restore");
                }

                @Override
                public void onUpdate(int nowBeingRestored, String currentPackage) {
                    super.onUpdate(nowBeingRestored, currentPackage);

                    Log.i(Constants.LOG_TAG, "nowBeingRestored " + nowBeingRestored + " " + currentPackage);
                }

                @Override
                public void restoreFinished(int error) {
                    super.restoreFinished(error);
                    Log.i(Constants.LOG_TAG, "REstore finalizou " + error);
                    Toast.makeText(getActivity(), "Restoure completou " + error, Toast.LENGTH_SHORT).show();
                }
            });
            return true;
        }
    });

    return rootView;
}
 
开发者ID:rafaelcoutinho,项目名称:cowbird,代码行数:46,代码来源:MainControlActivity.java



注:本文中的android.app.backup.RestoreObserver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ByteSequence类代码示例发布时间:2022-05-23
下一篇:
Java SizeLayoutType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap