{"id":230,"date":"2010-05-20T00:18:34","date_gmt":"2010-05-19T15:18:34","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2010\/05\/20\/android_1\/"},"modified":"2010-05-20T00:18:34","modified_gmt":"2010-05-19T15:18:34","slug":"android_1","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2010\/05\/20\/android_1\/","title":{"rendered":"Android \u306f\u3058\u3081\u307e\u3057\u305f\u3002(1) \uff0d \u642d\u8f09\u30bb\u30f3\u30b5\u30fc\u3092\u53d6\u5f97\u3057\u3066\u307f\u308b"},"content":{"rendered":"<p>Softbank Desire \u3092\u4e88\u7d04\u3059\u308b\u3082\u3001\u307e\u3060\u5165\u8377\u305b\u305a\u30025\u6708\u672b\u306b\u306f\u5165\u8377\u3059\u308b\u306e\u304b\u306a\uff5e\uff1f\u4e45\u3005\u306b\u7269\u6b32\u304c\u308f\u3044\u3066\u307e\u3059\u3002<\/p>\n<p>Windows Phone 7 \u3082\u3061\u3087\u3063\u3068\u8208\u5473\u3092\u6301\u3063\u305f\u3051\u3069\u3001Android \u898b\u308c\u3070\u898b\u308b\u307b\u3069\u9762\u767d\u305d\u3046\u3060\u3002<\/p>\n<p>\u5b9f\u6a5f\u5165\u624b\u307e\u3067\u306b\u3001\u3061\u3087\u3063\u3068\u305a\u3064\u6e96\u5099\u3092\u3057\u3066\u3044\u3053\u3046\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Android1_14EDF\/android_sensor01.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"android_sensor01\" border=\"0\" alt=\"android_sensor01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Android1_14EDF\/android_sensor01_thumb.jpg\" width=\"217\" height=\"320\"><\/a><\/p>\n<p>\u30bb\u30f3\u30b5\u30fc\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u975e\u5e38\u306b\u9762\u767d\u305d\u3046\u306b\u304a\u3082\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u307e\u305a\u306f\u642d\u8f09\u30bb\u30f3\u30b5\u30fc\u3092\u53d6\u5f97\u3057\u3066\u307f\u308b(\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u4e0a\u3067\u30fb\u30fb\u30fb)<\/p>\n<p>\u52a0\u901f\u5ea6\u30bb\u30f3\u30b5\u30fc\u304c\u53d6\u5f97\u3067\u304d\u305f\u3002<\/p>\n<p><strong>SensorListActivity<\/strong><\/p>\n<pre class=\"prettyprint linenums\">package info.typea.sensorlist;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nimport android.app.ListActivity;\r\nimport android.hardware.Sensor;\r\nimport android.hardware.SensorManager;\r\nimport android.os.Bundle;\r\nimport android.widget.ArrayAdapter;\r\n\r\npublic class SensorListActivity extends ListActivity {\r\n\t\r\n    \/** Called when the activity is first created. *\/\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.main);\r\n        \r\n        \/\/ \u30bb\u30f3\u30b5\u30fc\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u306f\u3001Context\u7d4c\u7531\u3067\u53d6\u5f97\u3059\u308b\u3088\u3046\u3060\r\n    \tSensorManager sensorManager = (SensorManager)this.getSystemService(SENSOR_SERVICE);\r\n        \/\/ Sensor.TYPE_ALL \u3092\u6307\u5b9a\u3057\u6709\u52b9\u306a\u30bb\u30f3\u30b5\u30fc\u3092\u3059\u3079\u3066\u53d6\u5f97\r\n    \tList<sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);\r\n \r\n\t\/\/ ListView \u306b\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u3001\u30bb\u30f3\u30b5\u30fc\u306e\u540d\u79f0\u3067\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u76f4\u3059   \t\r\n    \tList<string> sensorNames = new ArrayList<string>();\r\n    \tfor (Sensor sensor : sensors) {\r\n    \t\tsensorNames.add(sensor.getName());\r\n    \t}\r\n    \tArrayAdapter<string> lstAdapter \r\n    \t\t= new ArrayAdapter<string>(this, R.layout.sensor_row, sensorNames);\r\n    \t\r\n    \tsetListAdapter(lstAdapter);\r\n    }\r\n}\r\n<\/pre>\n<p><strong>res\/layout\/main.xml<\/strong><\/p>\n<pre class=\"prettyprint linenums\"><p>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;<br>&lt;LinearLayout xmlns:android=\"<a href=\"http:\/\/schemas.android.com\/apk\/res\/android&quot;\">http:\/\/schemas.android.com\/apk\/res\/android\"<\/a><br>&nbsp;&nbsp;&nbsp; android:orientation=\"vertical\"<br>&nbsp;&nbsp;&nbsp; android:layout_width=\"fill_parent\"<br>&nbsp;&nbsp;&nbsp; android:layout_height=\"fill_parent\"<br>&nbsp;&nbsp;&nbsp; &gt;<br>&nbsp;&nbsp;&nbsp; &lt;ListView android:id=\"@+id\/android:list\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:layout_width=\"wrap_content\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:layout_height=\"wrap_content\"\/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TextView android:id=\"@+id\/android:empty\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:layout_width=\"wrap_content\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:layout_height=\"wrap_content\"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:text=\"No Sensors!\"\/&gt;<br>&lt;\/LinearLayout&gt;\r\n<\/p><\/pre>\n<p><strong>res\/layout\/sensor_row.xml<\/strong><\/p>\n<pre class=\"prettyprint linenums\"><p>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;<br>&lt;TextView android:id=\"@+id\/text1\" xmlns:android=\"<a href=\"http:\/\/schemas.android.com\/apk\/res\/android&quot;\">http:\/\/schemas.android.com\/apk\/res\/android\"<\/a><br>&nbsp;&nbsp;&nbsp; android:layout_width=\"wrap_content\"<br>&nbsp;&nbsp;&nbsp; android:layout_height=\"wrap_content\"\/&gt;<\/p>\r\n<\/pre>\n<p>\u3044\u3058\u3087\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Softbank Desire \u3092\u4e88\u7d04\u3059\u308b\u3082\u3001\u307e\u3060\u5165\u8377\u305b\u305a\u30025\u6708\u672b\u306b\u306f\u5165\u8377\u3059\u308b\u306e\u304b\u306a\uff5e\uff1f\u4e45\u3005\u306b\u7269\u6b32\u304c\u308f\u3044\u3066\u307e\u3059\u3002 Windows Phone 7 \u3082\u3061\u3087\u3063\u3068\u8208\u5473\u3092\u6301\u3063\u305f\u3051\u3069\u3001Android \u898b\u308c\u3070\u898b\u308b\u307b\u3069\u9762\u767d\u305d\u3046\u3060\u3002 \u5b9f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[39],"tags":[],"class_list":["post-230","post","type-post","status-publish","format-standard","hentry","category-android"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}