0

amazonで私のアプリケーションの画像を保存していますが、Amazon Cognitoの資格プロバイダを初期化しようとすると例外が発生します。Amazon Cognitoの資格情報プロバイダを初期化しようとしたときにヌルオブジェクトの参照が返される

AmazonS3 s3 = new AmazonS3Client(credentialsProvider); 

私はwhiceは何である「credentialsProvider」機能でそれをやった:ログがsharedpref nullポインタ例外について

// Initialize the Amazon Cognito credentials provider 
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
     this, 
     "someidentity", // Identity pool ID 
     Regions.US_EAST_2 // Region 
); 

答えて

0

であるここでの問題は、私はintializedときというの初期化

だっれます私はこれを解決するために を投稿しました。私はちょうどスタティックcredentialProviderと呼ばれ、アマゾンがUtilクラスの "sCredProvider"を提供しています

が、これはこの奇妙な問題を取得し、誰にも役立ちます願っています「UtilAWS3」クラスから継承

AmazonS3 s3 = new AmazonS3Client(sCredProvider); 

:)

:ので、関数は次のようになります
関連する問題