クラス直下で宣言
private PendingIntent pi; LocationManager mLocationManager; ReceiveLocation receiver;
onCreate内に以下を記述
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); receiver = new ReceiveLocation(); //指定したIntentに反応するようにReceiverにIntentFilterを登録 final IntentFilter filter = new IntentFilter(); filter.addAction("com.android.practice.ACTION_LOCATION_UPDATE"); registerReceiver(receiver, filter);
端末毎に表示サイズを変更させる [Androidアプリ開発 #05]で書いた表示サイズについて、
3.4インチ端末でもテストしましたが、正常に表示が最適化されていました。
横向き(landscape)に対応するには、リソースに「layout-land」ディレクトリを追加し、
その中にレイアウトファイルを格納します。
すると、端末が横向きになったときに、自動的に認識してくれます。