Closed tomridder closed 6 years ago
Add a BottomShretListener to the dialog and use the onSheetItemSelected to handle the different items
BottomSheetListener bsl=new BottomSheetListener()
{
@Override
public void onSheetShown(@NonNull BottomSheet bottomSheet, @Nullable Object o)
{
}
@Override
public void onSheetItemSelected(@NonNull BottomSheet bottomSheet, MenuItem menuItem, @Nullable Object o)
{
Toast.makeText(ShowNote.this,"onSheetItemSelected",Toast.LENGTH_SHORT).show();
if(menuItem.getTitle().equals("wechat"))
{
Toast.makeText(ShowNote.this,"wechat",Toast.LENGTH_SHORT).show();
}
if(menuItem.getTitle().equals("qq"))
{
Toast.makeText(ShowNote.this,"qq",Toast.LENGTH_SHORT).show();
}
if(menuItem.getTitle().equals("friendCycle"))
{
Toast.makeText(ShowNote.this,"friendCycle",Toast.LENGTH_SHORT).show();
}
}
that's what i am doing right now,is that correct to setListener for each Item??
You'll need to set the listener for every dialog you have created. See the sample app for an example
well ,can u copy this part of code for me ?i have seen your source code,but i didn't find that part...
this is my email 1402709211@qq.com
well,there's only two lines of code for that @Override public void onSheetItemSelected(@NonNull BottomSheet bottomSheet, MenuItem item, @Nullable Object object) { Toast.makeText(getApplicationContext(), item.getTitle() + " Clicked", Toast.LENGTH_SHORT).show(); } but i want to see the detail of setListener for each Item
my code is right ,thanks for talking with me
I'm not sure what you are asking or trying to achieve. If you want to receive a call back when an item is selected from the sheet you set a listener and handle the MenuItem in the onSheetItemSelected callback
i want to setListener event for each item on the Sheet how to write it ?thank u !