diadia

興味があることをやってみる。自分のメモを残しておきます。

2020-02-03から1日間の記事一覧

AccountManagerで取得したaccountの中身を表示する方法

概要 AccountManager.getAccountsByType()で取得したリストをprintlnで表示してもうまく表示されない。 表示する方法はfor構文を使うことと、name属性を参照することである。 表示方法 val am : AccountManager = AccountManager.get(this) val accounts = a…

Kotlin Arrayの使い方

Arrayのオブジェクト生成する var testArray : Array<String> = arrayOf() Arrayにデータを追加する for (number in 0..10){ testArray += number.toString() }</string>

エラー:Caused by: java.lang.SecurityException: uid xxxxx cannot explicitly add accounts of type:

エラー内容 Caused by: java.lang.SecurityException: uid 10149 cannot explicitly add accounts of type: hogehoge エラー原因ファイル AndroidManifest.xml抜粋 <service android:name=".AuthenticatorService" android:exported="false"> <intent-filter> <action android:name=".Authenticator" /> </intent-filter> </service>

エラー:W/System.err: java.net.UnknownServiceException: CLEARTEXT communication to 10.0.2.2 not permitted by network security policy

エラー内容 W/System.err: java.net.UnknownServiceException: CLEARTEXT communication to 10.0.2.2 not permitted by network security policy このエラーはhttp通信を使う場合において設定不備よるエラーである。マニフェストファイルの不備である。 エラ…

Kotlin OkHttpを使ってHTTP通信

コンテンツ HttpUrlConnectionについて OkHttpのインストール OkHttpサンプルコード (補足)Android開発におけるHTTP通信 1.HttpUrlConnectionについて Androidアプリケーションを開発するにいたり、最初に本で学習した。その時にAsncTaskとHttpUrlConnection…