{"action":"closed","issue":{"url":"https://api.github.com/repos/RijoKJose/FoodTestApplication/issues/6","repository_url":"https://api.github.com/repos/RijoKJose/FoodTestApplication","labels_url":"https://api.github.com/repos/RijoKJose/FoodTestApplication/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/RijoKJose/FoodTestApplication/issues/6/comments","events_url":"https://api.github.com/repos/RijoKJose/FoodTestApplication/issues/6/events","html_url":"https://github.com/RijoKJose/FoodTestApplication/issues/6","id":146386910,"number":6,"title":"The items inside each if and else if can be generalized","user":{"login":"sravan-s","id":11382805,"avatar_url":"https://avatars.githubusercontent.com/u/11382805?v=3","gravatar_id":"","url":"https://api.github.com/users/sravan-s","html_url":"https://github.com/sravan-s","followers_url":"https://api.github.com/users/sravan-s/followers","following_url":"https://api.github.com/users/sravan-s/following{/other_user}","gists_url":"https://api.github.com/users/sravan-s/gists{/gist_id}","starred_url":"https://api.github.com/users/sravan-s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sravan-s/subscriptions","organizations_url":"https://api.github.com/users/sravan-s/orgs","repos_url":"https://api.github.com/users/sravan-s/repos","events_url":"https://api.github.com/users/sravan-s/events{/privacy}","received_events_url":"https://api.github.com/users/sravan-s/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-06T17:52:45Z","updated_at":"2016-04-07T04:14:54Z","closed_at":"2016-04-07T04:14:54Z","body":"@RijoKJose \r\n\r\nhttps://github.com/RijoKJose/FoodTestApplication/blob/master/app/src/main/java/com/projects/myapp/foodtestapplication/MainActivity.java\r\n\r\n\r\neg:\r\nfunction setData(foodImg, foodName, ... , foodRate) {\r\n    foodimageView.setBackgroundResource(foodImg);\r\n    fodName.setText(foodName);\r\n    ....\r\n    rate.setText(foodRate);\r\n}\r\n\r\nif( pos = 1) {\r\n  setData(R.drawable.burger, \"burger\", ...);\r\n} else if( pos = 2) {\r\n  setData(R.drawable.egg, \"egg\",  ...);\r\n}\r\n\r\nAlso, possibly you can get the arguments from a data structure, mapping the variable 'pos'.\r\n"}}