i have imageview looping images through. example, here code:
//home screen slideshow -----> final int[] imagearray = {r.drawable.image1, r.drawable.image2, r.drawable.image3}; (int j = 0; j < 10; j++) { final handler handler = new handler(); runnable runnable = new runnable() { int = 0; public void run() { imageview.setimageresource(imagearray[i]); i++; if (i > imagearray.length - 1) { = 0; } handler.postdelayed(this, 19000); //for interval... } }; handler.postdelayed(runnable, 19000); //for initial delay.. //end slideshow -----> }
i know how link entire imageview url using following code:
imageview.setonclicklistener(new view.onclicklistener() { public void onclick (view v){ intent intent = new intent(); intent.setaction(intent.action_view); intent.addcategory(intent.category_browsable); intent.setdata(uri.parse("http://google.com")); startactivity(intent); }
that great if trying link every image google.com. really, trying link each different image in slider different webpage. how can accomplish this?
edit:
//home screen slideshow -----> final int[] imagearray = {r.drawable.image1, r.drawable.image2, r.drawable.image3, r.drawable.image4, r.drawable.image5, r.drawable.image6, r.drawable.image11, r.drawable.image7, r.drawable.image8, r.drawable.image9, r.drawable.image10, r.drawable.image4, r.drawable.image2, r.drawable.image6, r.drawable.image12, r.drawable.image8, r.drawable.image3, r.drawable.image9, r.drawable.image10, r.drawable.image11, r.drawable.image12}; (int j = 0; j < 10; j++) { final handler handler = new handler(); runnable runnable = new runnable() { int = 0; public void run() { imageview.setimageresource(imagearray[i]); i++; if (i > imagearray.length - 1) { = 0; } handler.postdelayed(this, 19000); //for interval... if (imagearray[i]==1) { imageview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { intent intent = new intent(context, restaurants.class); startactivity(intent); } } ); } } }; handler.postdelayed(runnable, 19000); //for initial delay.. //end slideshow -----> }
try put onclicklistener inside runnable
Comments
Post a Comment