当前位置: 首页>>代码示例>>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;未经允许,请勿转载。