下面列出了android.view.Window#performPanelIdentifierAction ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}
/**
* Execute a particular menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/
public boolean invokeMenuActionSync(Activity targetActivity,
int id, int flag) {
class MenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public MenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
}
public void run() {
Window win = activity.getWindow();
returnValue = win.performPanelIdentifierAction(
Window.FEATURE_OPTIONS_PANEL,
identifier,
flags);
}
}
MenuRunnable mr = new MenuRunnable(targetActivity, id, flag);
runOnMainSync(mr);
return mr.returnValue;
}