{"id":261,"date":"2018-11-13T12:44:59","date_gmt":"2018-11-13T10:44:59","guid":{"rendered":"https:\/\/www.cipv6.de\/worp\/?p=261"},"modified":"2018-11-13T12:44:59","modified_gmt":"2018-11-13T10:44:59","slug":"android-get-values-of-the-temperature-sensor-show-them-on-the-display","status":"publish","type":"post","link":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/","title":{"rendered":"Android: get values of the Temperature Sensor, show them on the display"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69febe1720144\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69febe1720144\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#Mainactivityjava\" >Mainactivity.java:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#activity_mainxml\" >activity_main.xml:<\/a><\/li><\/ul><\/nav><\/div>\n<h4><span class=\"ez-toc-section\" id=\"Mainactivityjava\"><\/span>Mainactivity.java:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>[code]<\/p>\n<p>public class MainActivity extends AppCompatActivity implements SensorEventListener {<\/p>\n<p>private SensorManager mSM;<br \/>\nprivate Sensor mTemp;<br \/>\nprivate TextView sensorTextView;<\/p>\n<p>@Override<br \/>\nprotected void onCreate(Bundle savedInstanceState) {<br \/>\nsuper.onCreate(savedInstanceState);<br \/>\nsetContentView(R.layout.activity_main);<\/p>\n<p>sensorTextView = findViewById(R.id.sensorTextview);<br \/>\nmSM = (SensorManager) getSystemService(SENSOR_SERVICE);<br \/>\nmTemp = mSM.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);<br \/>\n}<\/p>\n<p>@Override<br \/>\npublic void onSensorChanged(SensorEvent sensorEvent) {<\/p>\n<p>float tmpval = sensorEvent.values[0];<br \/>\nsensorTextView.setText(&quot;Temp :&quot; + (tmpval) );<\/p>\n<p>}<\/p>\n<p>@Override<br \/>\npublic void onAccuracyChanged(Sensor sensor, int accuracy) {<\/p>\n<p>}<\/p>\n<p>@Override<br \/>\nprotected void onResume() {<br \/>\nsuper.onResume();<br \/>\nmSM.registerListener(this, mTemp, SensorManager.SENSOR_DELAY_NORMAL);<br \/>\n}<\/p>\n<p>@Override<br \/>\nprotected void onPause() {<br \/>\nsuper.onPause();<br \/>\nmSM.unregisterListener(this);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>[\/code]<\/p>\n<h4><span class=\"ez-toc-section\" id=\"activity_mainxml\"><\/span>activity_main.xml:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>[code]<br \/>\n&lt;pre&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br \/>\n&lt;android.support.constraint.ConstraintLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;<br \/>\n    xmlns:app=&quot;http:\/\/schemas.android.com\/apk\/res-auto&quot;<br \/>\n    xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;<br \/>\n    android:layout_width=&quot;match_parent&quot;<br \/>\n    android:layout_height=&quot;match_parent&quot;<br \/>\n    tools:context=&quot;.MainActivity&quot;&gt;<\/p>\n<p>    &lt;TextView<br \/>\n        android:id=&quot;@+id\/sensorTextview&quot;<br \/>\n        android:layout_width=&quot;wrap_content&quot;<br \/>\n        android:layout_height=&quot;wrap_content&quot;<br \/>\n        app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br \/>\n        app:layout_constraintLeft_toLeftOf=&quot;parent&quot;<br \/>\n        app:layout_constraintRight_toRightOf=&quot;parent&quot;<br \/>\n        app:layout_constraintTop_toTopOf=&quot;parent&quot; \/&gt;<\/p>\n<p>&lt;\/android.support.constraint.ConstraintLayout&gt;&lt;\/pre&gt;<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mainactivity.java: [code] public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSM; private Sensor mTemp; private TextView sensorTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sensorTextView = findViewById(R.id.sensorTextview); mSM = (SensorManager) getSystemService(SENSOR_SERVICE); mTemp = mSM.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); } @Override public void onSensorChanged(SensorEvent sensorEvent) { float tmpval = sensorEvent.values[0]; sensorTextView.setText(&quot;Temp :&quot; + (tmpval) ); } @Override &hellip; <a href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Android: get values of the Temperature Sensor, show them on the display&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[39,49,59],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-android","tag-java","tag-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android: get values of the Temperature Sensor, show them on the display - cipv6.de<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android: get values of the Temperature Sensor, show them on the display - cipv6.de\" \/>\n<meta property=\"og:description\" content=\"Mainactivity.java: [code] public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSM; private Sensor mTemp; private TextView sensorTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sensorTextView = findViewById(R.id.sensorTextview); mSM = (SensorManager) getSystemService(SENSOR_SERVICE); mTemp = mSM.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); } @Override public void onSensorChanged(SensorEvent sensorEvent) { float tmpval = sensorEvent.values[0]; sensorTextView.setText(&quot;Temp :&quot; + (tmpval) ); } @Override &hellip; Continue reading &quot;Android: get values of the Temperature Sensor, show them on the display&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/\" \/>\n<meta property=\"og:site_name\" content=\"cipv6.de\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-13T10:44:59+00:00\" \/>\n<meta name=\"author\" content=\"ugu5ma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:site\" content=\"@ugu5ma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ugu5ma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/\"},\"author\":{\"name\":\"ugu5ma\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"headline\":\"Android: get values of the Temperature Sensor, show them on the display\",\"datePublished\":\"2018-11-13T10:44:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/\"},\"wordCount\":243,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"keywords\":[\"Android\",\"java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/\",\"name\":\"Android: get values of the Temperature Sensor, show them on the display - cipv6.de\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\"},\"datePublished\":\"2018-11-13T10:44:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/index.php\\\/2018\\\/11\\\/13\\\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android: get values of the Temperature Sensor, show them on the display\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#website\",\"url\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/\",\"name\":\"cipv6.de\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.cipv6.de\\\/worp\\\/#\\\/schema\\\/person\\\/5d62b275485540be9e5e9e33d4fab86d\",\"name\":\"ugu5ma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\",\"caption\":\"ugu5ma\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/cipv6.de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android: get values of the Temperature Sensor, show them on the display - cipv6.de","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/","og_locale":"en_US","og_type":"article","og_title":"Android: get values of the Temperature Sensor, show them on the display - cipv6.de","og_description":"Mainactivity.java: [code] public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSM; private Sensor mTemp; private TextView sensorTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sensorTextView = findViewById(R.id.sensorTextview); mSM = (SensorManager) getSystemService(SENSOR_SERVICE); mTemp = mSM.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); } @Override public void onSensorChanged(SensorEvent sensorEvent) { float tmpval = sensorEvent.values[0]; sensorTextView.setText(&quot;Temp :&quot; + (tmpval) ); } @Override &hellip; Continue reading \"Android: get values of the Temperature Sensor, show them on the display\"","og_url":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/","og_site_name":"cipv6.de","article_published_time":"2018-11-13T10:44:59+00:00","author":"ugu5ma","twitter_card":"summary_large_image","twitter_creator":"@ugu5ma","twitter_site":"@ugu5ma","twitter_misc":{"Written by":"ugu5ma","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#article","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/"},"author":{"name":"ugu5ma","@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"headline":"Android: get values of the Temperature Sensor, show them on the display","datePublished":"2018-11-13T10:44:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/"},"wordCount":243,"commentCount":0,"publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"keywords":["Android","java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/","url":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/","name":"Android: get values of the Temperature Sensor, show them on the display - cipv6.de","isPartOf":{"@id":"https:\/\/www.cipv6.de\/worp\/#website"},"datePublished":"2018-11-13T10:44:59+00:00","breadcrumb":{"@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/11\/13\/android-get-values-of-the-temperature-sensor-show-them-on-the-display\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cipv6.de\/worp\/"},{"@type":"ListItem","position":2,"name":"Android: get values of the Temperature Sensor, show them on the display"}]},{"@type":"WebSite","@id":"https:\/\/www.cipv6.de\/worp\/#website","url":"https:\/\/www.cipv6.de\/worp\/","name":"cipv6.de","description":"","publisher":{"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cipv6.de\/worp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.cipv6.de\/worp\/#\/schema\/person\/5d62b275485540be9e5e9e33d4fab86d","name":"ugu5ma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g","caption":"ugu5ma"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/7211dd31d32612293e4228c8f880721a803dcc15211868f096ea9a8e77b6f316?s=96&d=mm&r=g"},"sameAs":["https:\/\/cipv6.de"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9uBTs-4d","jetpack-related-posts":[{"id":58,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/android-query-jso-data-log-the-response-to-logcat\/","url_meta":{"origin":261,"position":0},"title":"Android: Query JSON-Data , log the response to logcat","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"[java] package de.clarisweb.android.jsondemo; import android.os.AsyncTask; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.view.Menu; import android.view.MenuItem; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class MainActivity extends AppCompatActivity { public class DownloadTask extends AsyncTask< String, Void, String> { @Override protected String doInBackground(String...\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":51,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/android-timer\/","url_meta":{"origin":261,"position":1},"title":"Android: Timer","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"[java] @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new CountDownTimer(10000, 100) { public void onTick(long millisecondsUntilDone) { Log.i(\"Seconds Left!\", String.valueOf(millisecondsUntilDone \/ 1000)); Toast.makeText(MainActivity.this, \"\" + String.valueOf(millisecondsUntilDone \/ 1000), Toast.LENGTH_SHORT).show(); } public void onFinish() { Log.i(\"We're done!\", \"No more countdown\"); } }.start();<\/pre> [\/java]","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":46,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/android-listview-clicked-item-loschen\/","url_meta":{"origin":261,"position":2},"title":"Android Listview: clicked item l\u00f6schen","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"[java] package de.clarisweb.android.listview; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ListView myListView = findViewById((R.id.myListView)); final ArrayList myFamily = new ArrayList(); myFamily.add(\"P1\"); myFamily.add(\"P2\"); myFamily.add(\"P3\"); myFamily.add(\"P4\"); myFamily.add(\"P5\"); final ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, myFamily); myListView.setAdapter(arrayAdapter); myListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView,\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":42,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/run-task-in-background\/","url_meta":{"origin":261,"position":3},"title":"Android: run task in background","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"\u00a0 [java] package de.clarisweb.android.downloadwebcontent; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; public class MainActivity extends AppCompatActivity { public class DownloadTask extends AsyncTask\u00a0{ @Override protected String doInBackground(String... strings) { Log.i(\"URL\", strings[0]); return \"done !\"; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DownloadTask task = new DownloadTask(); String\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2017\/12\/22\/android-get-specific-json-attribute\/","url_meta":{"origin":261,"position":4},"title":"Android: get specific JSON attribute","author":"ugu5ma","date":"December 22, 2017","format":false,"excerpt":"When accessing\u00a0http:\/\/headers.jsontest.com\/ the following content is provided: { \"X-Cloud-Trace-Context\": \"778d633b22354c11045ece44c646dd2a\/11146751159933655926\", \"Accept-Language\": \"de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,sv;q=0.6,la;q=0.5\", \"Host\": \"headers.jsontest.com\", \"DNT\": \"1\", \"User-Agent\": \"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/63.0.3239.84 Safari\/537.36\", \"Postman-Token\": \"5851966f-f18b-cb0f-ab9c-e39ca6878d76\", \"Accept\": \"*\/*\", \"Cache-Control\": \"no-cache\" } The Goal is to extract the values for\u00a0 Host and User-Agent. first of all\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":127,"url":"https:\/\/www.cipv6.de\/worp\/index.php\/2018\/01\/04\/android-log-or-toast-the-selected-item-in-an-listview\/","url_meta":{"origin":261,"position":5},"title":"Android: Log or Toast the selected Item in an ListView","author":"ugu5ma","date":"January 4, 2018","format":false,"excerpt":"in case you have the need to log.i the selected item of an listview this snippet could help: \u00a0 [java] listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { CheckedTextView checkedTextView = (CheckedTextView) view; String itemClicked = (String) listView.getAdapter().getItem(i); if (checkedTextView.isChecked()) { Log.i(\"Info :\",\u2026","rel":"","context":"In \"Android\"","block_context":{"text":"Android","link":"https:\/\/www.cipv6.de\/worp\/index.php\/tag\/android\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":0,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cipv6.de\/worp\/index.php\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}