java - How to open new activity using onItemClick -
i have onitemclick listener. there's no error, every time click on "caloocan" in listview nothing happens.
@override public void onitemclick(adapterview<?> parent, view view, int position, long id) { restaulv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { int value = (int) restaulv.getitematposition(position); if (value == 0){ intent cal = new intent(hopnow.this, caloocan.class); startactivity(cal); } } }); } }
this code caloocan.java
package com.example.aspiree1_472g.finalfirstpage; import android.os.bundle; import android.support.v7.app.appcompatactivity; public class caloocan extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.caloocan); } }
try this
@override public void onitemclick(adapterview<?> parent, view view, int position, long id) { restaulv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { if (position == 0){ intent cal = new intent(hopnow.this, caloocan.class); startactivity(cal); } } }); }
Comments
Post a Comment