當前位置: 首頁>>代碼示例>>Java>>正文


Java NetworkErrorException類代碼示例

本文整理匯總了Java中android.accounts.NetworkErrorException的典型用法代碼示例。如果您正苦於以下問題:Java NetworkErrorException類的具體用法?Java NetworkErrorException怎麽用?Java NetworkErrorException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetworkErrorException類屬於android.accounts包,在下文中一共展示了NetworkErrorException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addAccount

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle addAccount(
        AccountAuthenticatorResponse response,
        String accountType,
        String authTokenType,
        String[] requiredFeatures,
        Bundle options)
        throws NetworkErrorException {
    Log.d(TAG, "addAccount");

    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);

    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}
 
開發者ID:googlesamples,項目名稱:account-transfer-api,代碼行數:19,代碼來源:Authenticator.java

示例2: getProperException

import android.accounts.NetworkErrorException; //導入依賴的package包/類
private Throwable getProperException(Throwable throwable)  {
    if (throwable instanceof HttpException) {
        HttpException httpException = (HttpException) throwable;
        Response response = httpException.response();
        String errorBody = null;
        try {
            String error = response.errorBody().string();
            Document htmlFile = Jsoup.parse(error, "ISO-8859-1");
            errorBody = htmlFile.body().text();
            Timber.d("response.errorBody()=%s, errorBody = %s", error, errorBody );
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (errorBody == null ) {
            return getThrowable(response.message(), response.code(), throwable);
        } else {
             return new NounResponseException(errorBody);
        }
    } else if (throwable instanceof IOException) {
        return new InternetConnectionException();
    } else if (throwable instanceof NetworkErrorException) {
        return new InternetConnectionException();
    }
    return throwable;
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:26,代碼來源:ErrorHandlerHelper.java

示例3: addAccount

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle addAccount(
        AccountAuthenticatorResponse r,
        String s,
        String s2,
        String[] strings,
        Bundle bundle) throws NetworkErrorException {
    return null;
}
 
開發者ID:jamesddube,項目名稱:LaravelNewsApp,代碼行數:10,代碼來源:Authenticator.java

示例4: confirmCredentials

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle confirmCredentials(
        AccountAuthenticatorResponse r,
        Account account,
        Bundle bundle) throws NetworkErrorException {
    return null;
}
 
開發者ID:jamesddube,項目名稱:LaravelNewsApp,代碼行數:8,代碼來源:Authenticator.java

示例5: getAuthToken

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle getAuthToken(
        AccountAuthenticatorResponse r,
        Account account,
        String s,
        Bundle bundle) throws NetworkErrorException {
    throw new UnsupportedOperationException();
}
 
開發者ID:jamesddube,項目名稱:LaravelNewsApp,代碼行數:9,代碼來源:Authenticator.java

示例6: updateCredentials

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle updateCredentials(
        AccountAuthenticatorResponse r,
        Account account,
        String s, Bundle bundle) throws NetworkErrorException {
    throw new UnsupportedOperationException();
}
 
開發者ID:jamesddube,項目名稱:LaravelNewsApp,代碼行數:8,代碼來源:Authenticator.java

示例7: addAccount

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
                         String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.setAction(Intent.ACTION_VIEW);
    intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
    intent.putExtra(AuthenticatorActivity.ARG_AUTH_TOKEN_TYPE, authTokenType);
    intent.putExtra(AuthenticatorActivity.ARG_IS_ADDING_NEW_ACCOUNT, true);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);

    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:15,代碼來源:Authenticator.java

示例8: hasFeatures

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account,
                          String[] features) throws NetworkErrorException {
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:8,代碼來源:Authenticator.java

示例9: getProperException

import android.accounts.NetworkErrorException; //導入依賴的package包/類
public Throwable getProperException(Throwable throwable) {
  if (throwable instanceof HttpException) {
    HttpException httpException = (HttpException) throwable;
    Response response = httpException.response();

    // try to parse the error
    Converter<ResponseBody, DataResponseModel> converter =
        retrofit.responseBodyConverter(DataResponseModel.class, new Annotation[0]);
    DataResponseModel error = null;
    try {
      error = converter.convert(response.errorBody());
    } catch (IOException | JsonSyntaxException e) {
      e.printStackTrace();
    }

    if (error == null || error.getData() == null || error.getData().getError() == null) {
      return getThrowable(response.message(), response.code(), throwable);
    } else {
      return new ParsedResponseException(error.getData().getError().get(0).getMsg());
    }
  } else if (throwable instanceof IOException) {
    return new InternetConnectionException();
  } else if (throwable instanceof NetworkErrorException) {
    return new InternetConnectionException();
  }
  return throwable;
}
 
開發者ID:nikacotAndroid,項目名稱:Weather-Guru-MVP,代碼行數:28,代碼來源:ErrorHandlerHelper.java

示例10: addAccount

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
                         String[] requiredFeatures, Bundle options)
    throws NetworkErrorException
{
  return null;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:8,代碼來源:AccountAuthenticatorService.java

示例11: addAccount

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    Log.d(TAG, "addAccount: called.");

    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
    intent.putExtra(AuthenticatorActivity.ARG_IS_ADDING_NEW_ACCOUNT, true);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);

    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}
 
開發者ID:Aentfs,項目名稱:Phony-Android,代碼行數:14,代碼來源:PhonyAuthenticator.java

示例12: onStart

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public void onStart() {
    super.onStart();
    if (!Network.isConnected(contextWeakReference.get())) {
        onError(new ApiException(new NetworkErrorException(), ApiCode.Request.NETWORK_ERROR));
    }
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:8,代碼來源:ApiSubscriber.java

示例13: getAuthToken

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException
{
    AccountManager accountManager = AccountManager.get(mContext);
    String authToken = accountManager.peekAuthToken(account, authTokenType);
    if (!authToken.isEmpty())
    {
        Bundle bundle = new Bundle();
        bundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
        bundle.putString(AccountManager.KEY_AUTHTOKEN, authToken);
        return bundle;
    }
    return newAccount(response);
}
 
開發者ID:HueToYou,項目名稱:ChatExchange-old,代碼行數:15,代碼來源:Authenticator.java

示例14: createProxyService

import android.accounts.NetworkErrorException; //導入依賴的package包/類
protected Service createProxyService(final Service service) {
    Class<Service> serviceClass = getServiceClass();
    return (Service) Proxy.newProxyInstance(serviceClass.getClassLoader(), new Class[]{serviceClass}, new InvocationHandler() {
        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            if (NetworkUtils.isNetAvailable()) {
                return ((Flowable) method.invoke(service, args)).subscribeOn(Schedulers.io());
            } else {
                return Flowable.error(new NetworkErrorException()).subscribeOn(Schedulers.io());
            }
        }
    });
}
 
開發者ID:jiangkang,項目名稱:KTools,代碼行數:14,代碼來源:BaseApi.java

示例15: updateCredentials

import android.accounts.NetworkErrorException; //導入依賴的package包/類
@Override
public Bundle updateCredentials(
        AccountAuthenticatorResponse r,
        Account account,
        String s,
        Bundle bundle) throws NetworkErrorException {
    throw new UnsupportedOperationException();
}
 
開發者ID:LCA311,項目名稱:leoapp-sources,代碼行數:9,代碼來源:StubAuthenticator.java


注:本文中的android.accounts.NetworkErrorException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。