是什么getActivity()
意思?我在某处看到,他们写MainActivity.this.startActionMode(mActionModeCallback)
而不是getActivity()
。有人能解释一下这两行是什么意思吗?
someView.setOnLongClickListener(new View.OnLongClickListener() {
// Called when the user long-clicks on someView
public boolean onLongClick(View view) {
if (mActionMode != null) {
return false;
}
// Start the CAB using the ActionMode.Callback defined above
mActionMode = getActivity().startActionMode(mActionModeCallback);
view.setSelected(true);
return true;
}
});