[android-developers] context menu
HI
i given buttons in xml file and onclick listener in java.
1).when i click on button (projects)menu has to appear(allprojects,myprojects,myfavorites)....it appearing but when i click allprojects it has to show the next acitvity(allprojects class) but its not displaying the activity......
2)context menu is displaying at the centre of the screen ...how to make it to display at the bottom of the layout...
<Button android:text="Projects" android:textColor="#ffffff" android:textSize="17dip" android:background="#bebebe" android:layout_weight="1" android:layout_alignLeft="@+id/rl1" android:clickable="true" android:id="@+id/t1" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
<Button android:text="Seminars" android:textColor="#ffffff" android:textSize="17dip" android:background="#bebebe" android:layout_weight="1" android:layout_centerHorizontal="true" android:id="@+id/t2" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
final Button bt1=( Button)findViewById(R.id.t1);
bt1.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
public void onCreateContextMenu(ContextMenu menu,
View v, ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
menu.add(0,1,0,"All Projects");
menu.add(0,2,0,"My Favorites");
menu.add(0,3,0,"My Projects");
}
public void onContextItemSelected(MenuItem item) {
if (item.getItemId() == 1) {
Intent intent=new Intent(WelcomePage.this,AllProjects.class);
startActivity(intent);
}
else{
}
}
});
plz tell me where am making mistake....
-- You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home