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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -