android - Going to random entry in ListView -
i making app shows listview, , when user touches 1 of items in listview, alertdialog pops up. works fine. want button appear on alertdialog called random. button supposed open random item in listview, however, alertdialog closes , nil else happens when click button.
i tryinhg utilize .setselection method in listview, method correct? here relevant code:
//this in listview.setonitemclicklistener ad.setbutton("random", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { random r = new random(); int low = 0; int high = 16; int r = r.nextint(high - low) + low; listview.setselection(r);
you utilize listview's smoothscrolltoposition(int position) scroll particular location in list.
android listview android-listview
No comments:
Post a Comment