{"id":1881,"date":"2013-11-21T17:18:42","date_gmt":"2013-11-21T13:18:42","guid":{"rendered":"https:\/\/blog.alwawee.ru\/?p=1881"},"modified":"2014-07-28T22:35:35","modified_gmt":"2014-07-28T18:35:35","slug":"android-animation-one-after-other","status":"publish","type":"post","link":"https:\/\/blog.alwawee.ru\/?p=1881","title":{"rendered":"Android Animation one after other"},"content":{"rendered":"<p>I wrote about a new approach to animate multiple objects in Android one after another. For example, 6 ImageButtons and 6 TextViews. I decided to duplicate this solution in my blog.<\/p>\n<p>My approach to reach this goal can be useful when you need to animate a lot of views one after another. You can use `setStartOffset` method to set a delay before animation begins. So, if you know, how much time will take for your first animation to end, you can set this as a delay for your second animation. This is an example where I animated six `ImageButtons` and six `TextViews` below them one after another:<\/p>\n<pre>\r\n    public void animateButtons() {\r\n    \t\/\/ An array of buttons\r\n        int[] imageButtonIds = {R.id.searchButton, R.id.favoriteButton, R.id.responseButton, R.id.articleButton, R.id.resumeButton, R.id.subscribeButton};\r\n        \/\/ Array of textViews\r\n        int[] textViewIds = {R.id.searchTextView, R.id.favoriteTextView, R.id.responseTextView, R.id.articleTextView, R.id.resumeTextView, R.id.subscribeTextView};\r\n\r\n        int i = 1;\r\n\r\n        for (int viewId : imageButtonIds) {\r\n\r\n            ImageButton imageButton = (ImageButton) findViewById(viewId);\r\n            \/\/ Animation from a file fade.xml in folder res\/anim\r\n            Animation fadeAnimation = AnimationUtils.loadAnimation(this, R.anim.fade);\r\n            \/\/ Delay for each animation is 100 ms bigger than for previous one\r\n            fadeAnimation.setStartOffset(i * 100);\r\n            imageButton.startAnimation(fadeAnimation);\r\n            \r\n            \/\/ The same animation is for textViews\r\n            int textViewId = textViewIds[i-1];\r\n            TextView textView = (TextView) findViewById(textViewId);\r\n            textView.startAnimation(fadeAnimation);\r\n            \r\n            i ++;\r\n        }\r\n    }\r\n<\/pre>\n<p>In my `res\/anim` folder I have a file, called `fade.xml` with these contents: <\/p>\n<pre>\r\n    <?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n    \r\n    <!--  Fade animation with 500 ms duration -->\r\n    \r\n    <alpha xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n           android:interpolator=\"@android:anim\/accelerate_decelerate_interpolator\"\r\n           android:fromAlpha=\"0.0\" android:toAlpha=\"1.0\"\r\n           android:duration=\"500\" \/>\r\n<\/pre>\n<p>Here <a href=\"http:\/\/stackoverflow.com\/questions\/3519682\/android-animation-one-after-other\" title=\"http:\/\/stackoverflow.com\/questions\/3519682\/android-animation-one-after-other\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/3519682\/android-animation-one-after-other <\/a>is this post and two other approaches &#8211; using AnimationSet and using listeners. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wrote about a new approach to animate multiple objects in Android one after another. For example, 6 ImageButtons and 6 TextViews. I decided to duplicate this solution in my blog. My approach to reach this goal can be useful when you need to animate a lot of views one after another. You can use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-1881","post","type-post","status-publish","format-standard","hentry","category-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Animation one after other - Denis Kutlubaev<\/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:\/\/blog.alwawee.ru\/?p=1881\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Animation one after other - Denis Kutlubaev\" \/>\n<meta property=\"og:description\" content=\"I wrote about a new approach to animate multiple objects in Android one after another. For example, 6 ImageButtons and 6 TextViews. I decided to duplicate this solution in my blog. My approach to reach this goal can be useful when you need to animate a lot of views one after another. You can use [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.alwawee.ru\/?p=1881\" \/>\n<meta property=\"og:site_name\" content=\"Denis Kutlubaev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/alwaweemobile\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-21T13:18:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-07-28T18:35:35+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blog.alwawee.com\/?attachment_id=1982\" \/>\n<meta name=\"author\" content=\"Denis Kutlubaev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Denis Kutlubaev\" \/>\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:\\\/\\\/blog.alwawee.ru\\\/?p=1881#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881\"},\"author\":{\"name\":\"Denis Kutlubaev\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"headline\":\"Android Animation one after other\",\"datePublished\":\"2013-11-21T13:18:42+00:00\",\"dateModified\":\"2014-07-28T18:35:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881\"},\"wordCount\":144,\"commentCount\":0,\"articleSection\":[\"Android\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881\",\"name\":\"Android Animation one after other - Denis Kutlubaev\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\"},\"datePublished\":\"2013-11-21T13:18:42+00:00\",\"dateModified\":\"2014-07-28T18:35:35+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/?p=1881#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.alwawee.ru\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android Animation one after other\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#website\",\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/\",\"name\":\"Denis Kutlubaev\",\"description\":\"iOS Development\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.alwawee.ru\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.alwawee.ru\\\/#\\\/schema\\\/person\\\/58f1f1f57155b48afab83ba53b3e26a7\",\"name\":\"Denis Kutlubaev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg\",\"caption\":\"Denis Kutlubaev\"},\"description\":\"iOS Developer, creator of Tornado Browser and many other popular apps\",\"sameAs\":[\"http:\\\/\\\/dennis.alwawee.com\"],\"url\":\"https:\\\/\\\/blog.alwawee.ru\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Animation one after other - Denis Kutlubaev","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:\/\/blog.alwawee.ru\/?p=1881","og_locale":"en_US","og_type":"article","og_title":"Android Animation one after other - Denis Kutlubaev","og_description":"I wrote about a new approach to animate multiple objects in Android one after another. For example, 6 ImageButtons and 6 TextViews. I decided to duplicate this solution in my blog. My approach to reach this goal can be useful when you need to animate a lot of views one after another. You can use [&hellip;]","og_url":"https:\/\/blog.alwawee.ru\/?p=1881","og_site_name":"Denis Kutlubaev","article_publisher":"https:\/\/www.facebook.com\/alwaweemobile","article_published_time":"2013-11-21T13:18:42+00:00","article_modified_time":"2014-07-28T18:35:35+00:00","og_image":[{"url":"http:\/\/blog.alwawee.com\/?attachment_id=1982","type":"","width":"","height":""}],"author":"Denis Kutlubaev","twitter_misc":{"Written by":"Denis Kutlubaev","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.alwawee.ru\/?p=1881#article","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/?p=1881"},"author":{"name":"Denis Kutlubaev","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"headline":"Android Animation one after other","datePublished":"2013-11-21T13:18:42+00:00","dateModified":"2014-07-28T18:35:35+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.alwawee.ru\/?p=1881"},"wordCount":144,"commentCount":0,"articleSection":["Android"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.alwawee.ru\/?p=1881#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.alwawee.ru\/?p=1881","url":"https:\/\/blog.alwawee.ru\/?p=1881","name":"Android Animation one after other - Denis Kutlubaev","isPartOf":{"@id":"https:\/\/blog.alwawee.ru\/#website"},"datePublished":"2013-11-21T13:18:42+00:00","dateModified":"2014-07-28T18:35:35+00:00","author":{"@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7"},"breadcrumb":{"@id":"https:\/\/blog.alwawee.ru\/?p=1881#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.alwawee.ru\/?p=1881"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.alwawee.ru\/?p=1881#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.alwawee.ru\/"},{"@type":"ListItem","position":2,"name":"Android Animation one after other"}]},{"@type":"WebSite","@id":"https:\/\/blog.alwawee.ru\/#website","url":"https:\/\/blog.alwawee.ru\/","name":"Denis Kutlubaev","description":"iOS Development","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.alwawee.ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.alwawee.ru\/#\/schema\/person\/58f1f1f57155b48afab83ba53b3e26a7","name":"Denis Kutlubaev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/346de75d27c818be0aa7fddeada2e50e30cc15b4da6b3b8110c5d766cd2afa34?s=96&d=mm&r=pg","caption":"Denis Kutlubaev"},"description":"iOS Developer, creator of Tornado Browser and many other popular apps","sameAs":["http:\/\/dennis.alwawee.com"],"url":"https:\/\/blog.alwawee.ru\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1881"}],"version-history":[{"count":0,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=\/wp\/v2\/posts\/1881\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.alwawee.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}