{"id":11061,"date":"2014-07-04T15:00:39","date_gmt":"2014-07-04T12:00:39","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=11061"},"modified":"2019-05-09T11:11:01","modified_gmt":"2019-05-09T08:11:01","slug":"android-seekbar-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/","title":{"rendered":"Android SeekBar Example"},"content":{"rendered":"<p>In Android, a <code>SeekBar<\/code> is a <code>ProgressBar<\/code> element&#8217;s extension that allows the selection of integer values using a natural user interface. <code>SeekBar<\/code> has a thumb that can be slided in order to choose a value between 0 and some maximum that can be set from the developer.<\/p>\n<p>For the need of this example, we will use the following tools in a Windows 64-bit platform:<br \/>\n&nbsp;<\/p>\n<ol>\n<li>JDK 1.7<\/li>\n<li>Eclipse ADT 4.3 Kepler<\/li>\n<li>Android SDK 4.3<\/li>\n<\/ol>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<\/p>\n<h2>1. Create a New Android Application Project<\/h2>\n<p>Open Eclipse IDE and go to File \u2192 New \u2192 Project \u2192 Android Application Project.<\/p>\n<p>Fill in the name of the application, the project and the package in the appropriate fields and then click Next.<\/p>\n<p><figure id=\"attachment_11091\" aria-describedby=\"caption-attachment-11091\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/new_project.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/new_project.png\" alt=\"Figure 1. Create a new Android application\" width=\"636\" height=\"544\" class=\"size-full wp-image-11091\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/new_project.png 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/new_project-300x256.png 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-11091\" class=\"wp-caption-text\">Figure 1. Create a new Android application<\/figcaption><\/figure><\/p>\n<p>In the next window, the \u201cCreate Activity\u201d option should be checked. The new created activity will be the main activity of your project. Then press Next button.<\/p>\n<p><figure id=\"attachment_11094\" aria-describedby=\"caption-attachment-11094\" style=\"width: 636px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_configuration.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_configuration.png\" alt=\"Figure 2. Configure the project\" width=\"636\" height=\"544\" class=\"size-full wp-image-11094\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_configuration.png 636w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_configuration-300x256.png 300w\" sizes=\"(max-width: 636px) 100vw, 636px\" \/><\/a><figcaption id=\"caption-attachment-11094\" class=\"wp-caption-text\">Figure 2. Configure the project<\/figcaption><\/figure><\/p>\n<p>In \u201cConfigure Launcher Icon\u201d window you should choose the icon you want to have in your app. We will use the default icon of android, so click Next button.<\/p>\n<p><figure id=\"attachment_11096\" aria-describedby=\"caption-attachment-11096\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/configure_laucher_icon.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/configure_laucher_icon.png\" alt=\"Figure 3. Configure the launcher icon\" width=\"660\" height=\"591\" class=\"size-full wp-image-11096\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/configure_laucher_icon.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/configure_laucher_icon-300x268.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-11096\" class=\"wp-caption-text\">Figure 3. Configure the launcher icon<\/figcaption><\/figure><\/p>\n<p>Select the \u201cBlank Activity\u201d option and press Next.<\/p>\n<p><figure id=\"attachment_11104\" aria-describedby=\"caption-attachment-11104\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/create_activity.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/create_activity.png\" alt=\"Figure 4. Create the activity and select its type\" width=\"660\" height=\"591\" class=\"size-full wp-image-11104\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/create_activity.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/create_activity-300x268.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-11104\" class=\"wp-caption-text\">Figure 4. Create the activity and select its type<\/figcaption><\/figure><\/p>\n<p>You then have to specify a name for the new Activity and a name for the layout description of your app. The .xml files for the layout will automatically be created in the <code>res\/layout<\/code> folder. Finally, press Finish.<\/p>\n<p><figure id=\"attachment_11100\" aria-describedby=\"caption-attachment-11100\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/blank_activity1.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/blank_activity1.png\" alt=\"Figure 5. Create a new blank activity\" width=\"660\" height=\"591\" class=\"size-full wp-image-11100\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/blank_activity1.png 660w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/blank_activity1-300x268.png 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-11100\" class=\"wp-caption-text\">Figure 5. Create a new blank activity<\/figcaption><\/figure><\/p>\n<p>Now you can see the final structure of the project in the following image (I have deleted the <code>fragment_main.xml<\/code>, as we don&#8217;t really need this).<\/p>\n<p><figure id=\"attachment_11101\" aria-describedby=\"caption-attachment-11101\" style=\"width: 315px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_structure.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_structure.png\" alt=\"Figure 6. The final structure of the project\" width=\"315\" height=\"585\" class=\"size-full wp-image-11101\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_structure.png 315w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/project_structure-161x300.png 161w\" sizes=\"(max-width: 315px) 100vw, 315px\" \/><\/a><figcaption id=\"caption-attachment-11101\" class=\"wp-caption-text\">Figure 6. The final structure of the project<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2><span id=\"code\">2. Create the layout of the Main Activity<\/span><\/h2>\n<p>As I mentioned, I &#8216;ll try to keep it simple. Just add a <code>SeekBar<\/code> element at the very top of your layout and a <code>TextView<\/code> below, that will help help us keep track of its changes; all, under the concept of a <code>RelativeLayout<\/code>, just for demonstration.<\/p>\n<p>Let&#8217;s do it by opening <code>res\/layout\/activity_main.xml<\/code> and navigating to the respective xml tab and paste the following.<\/p>\n<p><span style=\"text-decoration: underline\"><i><code>activity_main.xml<\/code><\/i><\/span><\/p>\n<pre class=\"brush:xml\">&lt;RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.javacodegeeks.android.seekbar.MainActivity\" &gt;\n\n    &lt;SeekBar\n        android:id=\"@+id\/seekBar1\"\n        android:layout_width=\"300dp\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentLeft=\"true\"\n        android:layout_alignParentTop=\"true\"\n        android:layout_marginTop=\"26dp\"\n        android:max=\"10\"\/&gt;\n\n    &lt;TextView\n        android:id=\"@+id\/textView1\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentLeft=\"true\"\n        android:layout_below=\"@+id\/seekBar1\"\n        android:layout_marginLeft=\"29dp\"\n        android:layout_marginTop=\"14dp\" \/&gt;\n    \n&lt;\/RelativeLayout&gt;\n<\/pre>\n<p>Except from setting our <code>SeekBar<\/code>&#8216;s maximum value to 10, there isn&#8217;t any special to explain, so let&#8217;s see the <code>MainActivity<\/code> class.<\/p>\n<h2>3. Code the Main Activity<\/h2>\n<p>Let&#8217;s first navigate to <code>src\/com.javacodegeeks.android.textviewtest\/MainActivity.java<\/code>. Next, complete the class like this:<\/p>\n<p><span style=\"text-decoration: underline\"><i><code>MainActivity.java<\/code><\/i><\/span><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.android.seekbar;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.widget.SeekBar;\nimport android.widget.SeekBar.OnSeekBarChangeListener;\nimport android.widget.TextView;\nimport android.widget.Toast;\n\npublic class MainActivity extends Activity{\n\n\t private SeekBar seekBar;\n\t private TextView textView;\n\n\t @Override\n\t protected void onCreate(Bundle savedInstanceState) {\n\t\t \n\t  super.onCreate(savedInstanceState);\n\t  setContentView(R.layout.activity_main);\n\t  initializeVariables();\n\t  \n\t  \/\/ Initialize the textview with '0'.\n\t  textView.setText(\"Covered: \" + seekBar.getProgress() + \"\/\" + seekBar.getMax());\n\t  \n\t  seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {\n\t\t  int progress = 0;\n\t\t  \n\t\t  @Override\n\t\t  public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) {\n\t\t\t  progress = progresValue;\n\t\t\t  Toast.makeText(getApplicationContext(), \"Changing seekbar's progress\", Toast.LENGTH_SHORT).show();\n\t\t  }\n\t\t\n\t\t  @Override\n\t\t  public void onStartTrackingTouch(SeekBar seekBar) {\n\t\t\t  Toast.makeText(getApplicationContext(), \"Started tracking seekbar\", Toast.LENGTH_SHORT).show();\n\t\t  }\n\t\t\n\t\t  @Override\n\t\t  public void onStopTrackingTouch(SeekBar seekBar) {\n\t\t\t  textView.setText(\"Covered: \" + progress + \"\/\" + seekBar.getMax());\n\t\t\t  Toast.makeText(getApplicationContext(), \"Stopped tracking seekbar\", Toast.LENGTH_SHORT).show();\n\t\t  }\n\t   });\n\t }\n\t \n\t \/\/ A private method to help us initialize our variables.\n\t private void initializeVariables() {\n\t\t seekBar = (SeekBar) findViewById(R.id.seekBar1);\n\t\t textView = (TextView) findViewById(R.id.textView1);\n\t }\n}\n<\/pre>\n<p>Here are some points I believe need more in-depth explanation:[ulp id=&#8217;XSQzgZ7lDbTb31Tj&#8217;]<\/p>\n<ul>\n<li><code>initializeVariables()<\/code> is a usual technique that I use (when on Android development) to initialize all the existing xml variables.<\/li>\n<li>In line 23, we used some <code>SeekBar<\/code>&#8216;s common methods, to initialize the displayed in <code>TextView<\/code> progress, to zero.<\/li>\n<\/ul>\n<p>What&#8217;s next? I&#8217;m sure you &#8216;ve already matched the <code>SeekBar<\/code> element to more than one of your installed applications, so what is needed to get things done, when touch and move the thumb, is an <code>ActionListener<\/code>, of course. Not exactly this, but it&#8217;s important that we have the generic meaning of it.<\/p>\n<p>Assuming that we don&#8217;t know even the basics of Android, the best answer, according to platform questions, can be foud in the official developer&#8217;s <a href=\"http:\/\/developer.android.com\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">site<\/a>. I also found myself there, concluding that the <code>ActionListener<\/code> that match our needs, was <a href=\"http:\/\/developer.android.com\/reference\/android\/widget\/SeekBar.OnSeekBarChangeListener.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code>OnSeekBarChangeListener<\/code><\/a>.<\/p>\n<p>Basically <code>SeekBar.OnSeekBarChangeListener<\/code> is a public static interface that is used to listen the <code>SeekBar<\/code> events, so we have to conform our <code>Activity<\/code> in order to implement it. This could be done either in the class definition ( <code>public class MainActivity extends Activity implements OnSeekBarChangeListener<\/code> ) or in the way line 25 shows. Of course, both ways are acceptable and allow us to override <a href=\"http:\/\/developer.android.com\/reference\/android\/widget\/SeekBar.OnSeekBarChangeListener.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code>OnSeekBarChangeListener<\/code><\/a>&#8216;s methods:<\/p>\n<ol>\n<li><code>onProgressChanged<\/code>: notification that the progress level has changed.<\/li>\n<li><code>onStartTrackingTouch<\/code>: notification that the user has started a touch gesture.<\/li>\n<li><code>onStopTrackingTouch<\/code>: notification that the user has finished a touch gesture.<\/li>\n<\/ol>\n<p>So, after reading the corresponding official documentation, I was like &#8220;why not using all of these methods in my example?&#8221; and the easiest way to get this done was to just display a <code>Toast<\/code>, whenever each one happens. Lines 28-43 are your disclaimer, so let&#8217;s get today&#8217;s article finished with screenshots.<\/p>\n<h2>4. Run the Application<\/h2>\n<p><figure id=\"attachment_11221\" aria-describedby=\"caption-attachment-11221\" style=\"width: 336px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_initial_state.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_initial_state.png\" alt=\"Figure 7. Initial state of the app\" width=\"336\" height=\"519\" class=\"size-full wp-image-11221\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_initial_state.png 336w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_initial_state-194x300.png 194w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/a><figcaption id=\"caption-attachment-11221\" class=\"wp-caption-text\">Figure 7. Initial state of the app<\/figcaption><\/figure><\/p>\n<p>Now, let&#8217;s just touch (and keep it pressed for a while) the <code>SeekBar<\/code> element:<\/p>\n<p><figure id=\"attachment_11225\" aria-describedby=\"caption-attachment-11225\" style=\"width: 336px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_touched_seekbar.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_touched_seekbar.png\" alt=\"Figure 8. Touching the SeekBar\" width=\"336\" height=\"519\" class=\"size-full wp-image-11225\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_touched_seekbar.png 336w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_touched_seekbar-194x300.png 194w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/a><figcaption id=\"caption-attachment-11225\" class=\"wp-caption-text\">Figure 8. Touching the <code>SeekBar<\/code><\/figcaption><\/figure><\/p>\n<p>While moving the element, the overidded <code>onProgressChanged<\/code> method is executed:<\/p>\n<p><figure id=\"attachment_11227\" aria-describedby=\"caption-attachment-11227\" style=\"width: 336px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_changing_seekbar.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_changing_seekbar.png\" alt=\"Figure 9. Moving the SeekBar\" width=\"336\" height=\"519\" class=\"size-full wp-image-11227\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_changing_seekbar.png 336w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_changing_seekbar-194x300.png 194w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/a><figcaption id=\"caption-attachment-11227\" class=\"wp-caption-text\">Figure 9. Moving the <code>SeekBar<\/code><\/figcaption><\/figure><\/p>\n<p>Finally, after deciding its final position, it&#8217;s <code>onStopTrackingTouch<\/code> sequence to be executed:<\/p>\n<p><figure id=\"attachment_11229\" aria-describedby=\"caption-attachment-11229\" style=\"width: 336px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_stopped_touching.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_stopped_touching.png\" alt=\"Figure 10. Placing the SeekBar\" width=\"336\" height=\"519\" class=\"size-full wp-image-11229\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_stopped_touching.png 336w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/app_stopped_touching-194x300.png 194w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/a><figcaption id=\"caption-attachment-11229\" class=\"wp-caption-text\">Figure 10. Placing the <code>SeekBar<\/code><\/figcaption><\/figure><\/p>\n<h2>5. Final Words &#8211; Source Code Download<\/h2>\n<p>And that was it for today, simple &#8216;n easy, as I promised! Have a nice day!<br \/>\nThis was an example of SeekBar in Android. You can also download the source code for this example: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/07\/SeekBar.zip\">SeekBar.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Android, a SeekBar is a ProgressBar element&#8217;s extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb that can be slided in order to choose a value between 0 and some maximum that can be set from the developer. For the need of this example, we will &hellip;<\/p>\n","protected":false},"author":12,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[606],"tags":[605],"class_list":["post-11061","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seekbar","tag-onseekbarchangelistener"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android SeekBar Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In Android, a SeekBar is a ProgressBar element&#039;s extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android SeekBar Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In Android, a SeekBar is a ProgressBar element&#039;s extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/toubou.techblog\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-07-04T12:00:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-09T08:11:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Thodoris Bais\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ThodorisBais\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thodoris Bais\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\"},\"author\":{\"name\":\"Thodoris Bais\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983\"},\"headline\":\"Android SeekBar Example\",\"datePublished\":\"2014-07-04T12:00:39+00:00\",\"dateModified\":\"2019-05-09T08:11:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\"},\"wordCount\":826,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"onSeekBarChangeListener\"],\"articleSection\":[\"SeekBar\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\",\"name\":\"Android SeekBar Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2014-07-04T12:00:39+00:00\",\"dateModified\":\"2019-05-09T08:11:01+00:00\",\"description\":\"In Android, a SeekBar is a ProgressBar element's extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"widget\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/widget\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"SeekBar\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/widget\/seekbar\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android SeekBar Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983\",\"name\":\"Thodoris Bais\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg\",\"caption\":\"Thodoris Bais\"},\"description\":\"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.\",\"sameAs\":[\"http:\/\/thodorisbais.blogspot.com\",\"https:\/\/www.facebook.com\/toubou.techblog\/\",\"https:\/\/instagram.com\/thodoris.bais\/\",\"https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408\",\"https:\/\/x.com\/@ThodorisBais\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/thodoris-bais\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android SeekBar Example - Java Code Geeks","description":"In Android, a SeekBar is a ProgressBar element's extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb","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:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/","og_locale":"en_US","og_type":"article","og_title":"Android SeekBar Example - Java Code Geeks","og_description":"In Android, a SeekBar is a ProgressBar element's extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/toubou.techblog\/","article_published_time":"2014-07-04T12:00:39+00:00","article_modified_time":"2019-05-09T08:11:01+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Thodoris Bais","twitter_card":"summary_large_image","twitter_creator":"@ThodorisBais","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Thodoris Bais","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/"},"author":{"name":"Thodoris Bais","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983"},"headline":"Android SeekBar Example","datePublished":"2014-07-04T12:00:39+00:00","dateModified":"2019-05-09T08:11:01+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/"},"wordCount":826,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["onSeekBarChangeListener"],"articleSection":["SeekBar"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/","name":"Android SeekBar Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2014-07-04T12:00:39+00:00","dateModified":"2019-05-09T08:11:01+00:00","description":"In Android, a SeekBar is a ProgressBar element's extension that allows the selection of integer values using a natural user interface. SeekBar has a thumb","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/widget\/seekbar\/android-seekbar-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"widget","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/widget\/"},{"@type":"ListItem","position":5,"name":"SeekBar","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/widget\/seekbar\/"},{"@type":"ListItem","position":6,"name":"Android SeekBar Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/045f5a70ed608824c16959f146ede983","name":"Thodoris Bais","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/03\/Thodoris-Bais_avatar_1425256492-96x96.jpg","caption":"Thodoris Bais"},"description":"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.","sameAs":["http:\/\/thodorisbais.blogspot.com","https:\/\/www.facebook.com\/toubou.techblog\/","https:\/\/instagram.com\/thodoris.bais\/","https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408","https:\/\/x.com\/@ThodorisBais"],"url":"https:\/\/examples.javacodegeeks.com\/author\/thodoris-bais\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/11061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=11061"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/11061\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=11061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=11061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=11061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}