android - onListItemClick is not being called. I am not sure why -


here activity:i trying call "onlistitemclicked" supported listactivity? want use actionbaractivity because want bar "logout" , "update". listactivity won't show. idea of i'm doing wrong?

package com.example.test.test;  import android.content.intent; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.listview;  import com.parse.findcallback; import com.parse.parse; import com.parse.parseexception; import com.parse.parseobject; import com.parse.parsequery; import com.parse.parseuser;  import java.util.list;   public class homepageactivity extends actionbaractivity {  protected list<parseobject> mstatus;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_homepage);      final listview listview = (listview)findviewbyid(android.r.id.list);      parse.initialize(this, "dcamnt7hvomow0jdmelkg5udr388o3xsgicisk3n", "1ahialdsuscxlbkwgkoyvhohwm9yetptb6qiijrb");      parseuser currentuser = parseuser.getcurrentuser();     if (currentuser != null) {         // show user homepage status         parsequery<parseobject> query = parsequery.getquery("status");         query.orderbydescending("createdat");         query.findinbackground(new findcallback<parseobject>() {             public void done(list<parseobject> status, parseexception e) {                 if (e == null) {                     //success                     mstatus = status;                     statusadapter adapter = new statusadapter(getapplicationcontext(), mstatus);                     listview.setadapter(adapter);                 } else {                     //there problem, alert user                  }             }         });      } else {         // show login screen         intent takeusertologinscreen = new intent(homepageactivity.this, loginactivity.class);         startactivity(takeusertologinscreen);     }  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu_main, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();     switch (id) {         case r.id.updatestatus:             //take user update status activity              intent intent = new intent(this, updatestatusactivity.class);             startactivity(intent);              break;          case r.id.logoutuser:             //log out user             parseuser.logout();              //take user login screen             intent takeusertologin = new intent(this, loginactivity.class);             startactivity(takeusertologin);              break;     }     return super.onoptionsitemselected(item);  }  onlistitemclick...  } 

here layout:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity">  <listview     android:id="@android:id/list"     android:layout_width="match_parent"     android:layout_height="match_parent">  </listview>  </relativelayout> 

use onitemclicklistener

listview .setonitemclicklistener(new onitemclicklistener()    {       @override       public void onitemclick(adapterview<?> adapter, view v, int position,             long arg3)        {          // on list itemclick       }    }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -