@Override public void onUpdate( final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIds) { final WalletApplication application = (WalletApplication) context.getApplicationContext(); final Wallet wallet = application.getWallet(); final BigInteger balance = wallet.getBalance(BalanceType.ESTIMATED); updateWidgets(context, appWidgetManager, appWidgetIds, balance); }
@Override public boolean onCreate() { final Context context = getContext(); this.config = new Configuration(PreferenceManager.getDefaultSharedPreferences(context)); this.userAgent = WalletApplication.httpUserAgent( WalletApplication.packageInfoFromContext(context).versionName); final ExchangeRate cachedExchangeRate = config.getCachedExchangeRate(); if (cachedExchangeRate != null) { exchangeRates = new TreeMap<String, ExchangeRate>(); exchangeRates.put(cachedExchangeRate.currencyCode, cachedExchangeRate); } return true; }