はじめに コーディング中に Android Studio 上で出てくる警告はちゃんと気にして潰しているのですが、 Lint チェックし忘れて 「コマンドラインからビルドすると警告出るんですけど…」 という問い合わせがあったりします。 本当にすみません。 そんな自戒の意味を込めて、今まで解決した項目の解決方法メモ。 やりたいこと ここでメモることで Lint の存在を思い出す 反省する 備忘録 ビルドするコマンド
App(Application) 1.命名規則 アプリケーション名 普通の英語名(スペースを含んでも構わない) UpperCamelCase プロジェクト名 UpperCamelCase Src(Sorce) 1.命名規則 パッケージ名 すべて小文字 スペースは削除して、アンダースコア(_)に変更する。 srcの中のパッケージ名: メインパッケージ:<リバースドメイン名>.<アプリケーション名> メインパッケージ以外:<メインパッケージ>.[controller|model|view...] 詳細な構成については、2のフォルダパッケージ構成に記す。 ファイル・クラス名 UpperCamelCase 名詞 Activity、Fragment、AdapterなどはComponent名を末尾に付ける メソッド名 lowerCamelCase 動詞で始める。ただし、Booleanを返すメソッドはi
Techboosterでは、これまでXMLをパース(解析)するやJSONをパース(解析)するで、Web上のコンテンツをパース(解析)する方法を紹介してきました。 今回は、JavaのHTMLパーサであるjsoupを用いてHTMLをパースする方法を紹介します。 jsoupは、HTTPのリクエストを投げるだけでDOMオブジェクトとしてHTMLを返してくれる便利なライブラリです。 jsoupのダウンロード Jsoupの公式HPはこちら http://jsoup.org/ ダウンロードはこちら http://jsoup.org/download ダウンロードのページからjarファイルをダウンロードします。 ※2012年2月23日現在では、バージョンは1.6.1でした。 jarファイルをダウンロードしたら、プロジェクトにクラスパスを通します。 クラスパスを通すには、プロジェクトの「プロパティ」から「J
この記事はとある勉強会で身内のために作成したもので、Fragmentをまだあまり使ったことの無い方が、どうしてFragmentを使うのかと、どこから始めればいいのかをまとめたものになります。 Fragment(フラグメント)とは? Fragmentとは、簡単にいうと、コンテンツとライフサイクルを持ったビューです。 プログラミングでいうライフサイクルとは、インスタンスが作成されてから、それが捨てられるまでの一連の流れのことをいいます。 Androidでは、例としてActivity(アクティビティ)だとインスタンスが作成される際にonCreateメソッドが呼ばれ、破棄される際にonDestroyメソッドが呼ばれ、他にも画面の状態によって、onResume・onStart・onPause・onStopなどのメソッドが呼ばれます。 このように、ライフサイクルに応じて呼び出されるメソッドを持っている
2017/04/23更新 buildConfigFieldについて追記 ライブラリ情報更新 通信処理(RxJava2+RxAndroid+Retrofit2)について追記 はじめに 最近Androidネイティブ開発で消耗しています。 モダンなAndroidネイティブ開発に関してまとめてみました。 基本 AndroidManifest.xml 主に次の項目を設定する アプリの権限の設定 ApplicationおよびActivityの初期設定 BroadcastReceiverの設定 アプリのパーミッション(権限)を追加したい場合はapplicationタグの前にuser-permissonタグを追記 上記は一番よく使う通信を許可するためのパーミッション name属性値に許可したいパーミッションを指定します。 build.gradle アプリケーションの次のビルド設定を記載する アプリバージョ
Android 開発における通信 アプリ開発において不可欠とも言える Web 通信ですが、 Android だと少し面倒だと思ったことはありませんか。 最近の Android では、通信はメインスレッドでは行ってはいけません。つまり、別スレッドで非同期処理をする必要があります。 しかし、 UI の変更はメインスレッドでしかできないという仕様です。 ここでつまずいてコードが汚くなった経験、皆さんにはないでしょうか、僕にはあります。 非同期通信処理を簡単に行いたい そこで今回は ApiCaller という抽象クラスを実装しました。 まずはこのApiCaller を用いると通信処理をどれだけ簡単に書けるか見ていただきましょう。 (もったいぶった説明は不要だという上級者の方はこちら ApiCaller ) 今回は通信ができていることがわかれば十分なので、 HatenaBookmarks から私の最
2019/04/25更新 AndroidでHTTP通信するときの手段についてまとめておきます。 サーバー側の流行やプログラミングのパラダイム変化によって今後もどんどん新しい、便利なライブラリが出てくるでしょう。 HttpUrlConnection(ライブラリ使わずJava標準のURLConnectionを使う方法) Apache系(Apache HttpClient,DefaultHttpClient,AndroidHttpClient)引退にともない、低レベルAPIとしてはこちらが推奨に。 (以前はバグがあった) Example ■ HttpUrlConnectionでGETのサンプルコード public static String get(String endpoint, String encoding, Map<String, String> headers) throws IOEx
2016 - 04 - 10 Android:Retrofit2.0ではてなAPIとおしゃべりしてみた Android Retrofit Library Androidでネットワーク通信するアプリを作る際、少し前まではVolleyを使うのがイケてるAndroiderの嗜みだったようですが、最近ではどうやらRetrofitがその地位を奪いつつあるようです。 ということで遅ればせながらイケてるAndroider目指してRetrofitをお触りしてみます。 Retrofitとは 導入方法 インタフェースを定義する データクラスを定義する API実行 Retrofitを設定する APIをインスタンス化する リクエストを1個ずつインスタンス化する Callを実行する レスポンスを処理する 所感 サンプルコード 参考 Retrofitとは RetrofitはSquareが開発しているネットワークアクセ
DI(Dependency Injection)について たまにDI不要論とかがネットで話題になったりしてて,ふわっとDIの考え方は知ってたんだけど実際にDIパターンみたいな実装をしたことなかったのでちょっと触ってみた. DIとは 日本語だと依存性注入みたいな小難しい訳になってしまうんだけど,概念自体は難しくはないと思う. よく車の例で紹介されてて,例えば車クラスには( Aエンジンオブジェクト と Aタイヤオブジェクト )を属性に持ってるとする この車クラスのエンジン部分をBエンジンオブジェクトにごっそり切り替えようとした場合に車クラスにはAエンジンに依存した実装があるので置き換えるのが大変だ!! という問題が発生する public class Car{ public A_Engine aEngine; public A_Tire aTire; public go(){ aEngine.s
はじめに なぜ、今更こんな何のためにもならなそうなことを書くのかというお話をします。 最近Androidを新しく始める人はすいすいとアプリの開発を覚えていき、昔は大変だった通信もRetrofit一択で何の迷いもなく終わります。Retrofitは本当に素晴らしいライブラリです、アノテーションを使用してコードを殆ど書かず、初心者にも分かりやすく書くことができ、カスタマイズ性も非常に高いです。 ですが、だからこそ昔のAndroidの通信の長い歴史を知って、今まで以上にRetrofitなどのライブラリの素晴らしさを実感してほしいと思って書きました。 そして、できれば誰かが次世代の通信ライブラリを作る際の糧としてくれることを願っています。 主な歴史 2007/11/05 : Androidが発表される 2011/09/29 : HttpURLConnectionを推奨するブログが出る 2013/05
Androidアプリで、画面からなにか処理した時に 外部のWeb APIから情報を取得(http getリクエスト)するロジックを書いていたのですが、 なぜかリクエスト投げるとNetworkOnMainThreadExceptionというエラーが返ってくる。。 調べてみると、どうやらAndroid3.0以上では メインスレッドからネットワーク処理を行うことを許していないらしい。 確かにエラーが出たときはAndroid4.?でデバッグしてました。 と、いうわけで 「AsyncTask」を使って別スレッドでhttpリクエストを投げることにしました。 〜大変参考になりました!〜 ・android開発|「AsyncTask」利用:android.os.NetworkOnMainThreadExceptionエラーへの対応方法 — 検索プログラマのメモ帳 ・AsyncTaskを使った非同期処理のきほ
adbコマンドが使える状態で、 apkさえあれば、以下の情報を取得できる。 コマンドプロンプトから、 aapt dump badging hoge.apk package: name='com.hoge' versionCode='1' versionName='1.0.0' uses-permission:'android.permission.CAMERA' uses-permission:'android.permission.INTERNET' uses-permission:'android.permission.FLASHLIGHT' sdkVersion:'7' targetSdkVersion:'7' uses-feature:'android.hardware.camera' uses-feature-not-required:'android.hardware.came
サービス終了のお知らせ SankeiBizは、2022年12月26日をもちましてサービスを終了させていただきました。長らくのご愛読、誠にありがとうございました。 産経デジタルがお送りする経済ニュースは「iza! 経済ニュース」でお楽しみください。 このページは5秒後に「iza!経済ニュース」(https://www.iza.ne.jp/economy/)に転送されます。 ページが切り替わらない場合は以下のボタンから「iza! 経済ニュース」へ移動をお願いします。 iza! 経済ニュースへ
Bitbola merupakan situs Game Online terbaik yang menyediakan beragam pilihan game slot terbaru dan terlengkap yang dapat dipercaya. Dengan koleksi permainan yang beragam, pemain tidak akan merasa bosan dan mempunyai peluang besar untuk bisa meraih kemenangan besar dan juga bonus yang menarik. Proses pendaftaran di Bitbola sangatlah mudah dan tidak dipungut biaya. Hal inilah yang membuat situs taru
Before using this app, you can review Find My Device’s privacy policy and terms of service.
<追記:2020/02/21> Googleから「新しいフォーマットにしませんか?」と提案されたので、変換しました。このサイトの内容は古いですが、一応新しいフォーマットで見やすいように少しずつ修正していきます。 <追記:2017/11/19> Eclipseの使い方を書いているのですが、実はすでにAndroid Studioに移行しています。Android Studioの使い方は、他の方が書かれていると思うので書かないと思いますが、あとで調べてわかりづらい?と思ったら書くかもしれません。まだEclipseの方は、Android Studioへの移行をオススメします。 Eclipseで作ったプロジェクトもAndroid Studioで読み込めますし。実際に読んでみた本を紹介しておきます。まず、開発環境の構築について、まぁネットを探せばでてきますが、実際自分もネットをみて環境を構築しましたけど
Xperiaの中に出現する削除できないBaiduフォルダ 中国にデータ送信疑惑で海外フォーラム炎上中 1 名前: クロスヒールホールド(大阪府)@\(^o^)/:2014/10/29(水) 12:58:23.73 ID:IZkgmtnp0.net Android 4.4.2または4.4.4 KitKatのファームウェアを搭載するXperiaにおいて、内部ストレージに「Baidu(百度:中国のWebサービスを展開する企業)フォルダ」が 生成される現象が確認され、海外フォーラムではスパイウェアではないかと話題となっています。 Baiduフォルダは削除しても、OS起動時にMyXperiaアプリが実行されるたび、ゾンビのように復活します。唯一の解決策はadbのシェルコマンドで、MyXperiaアプリをブロックすることだけです。 この現象の確認できるモデルと、そうでないモデルがあるようです。なお、筆
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く