我有NoteListActivity,我有搜索栏,通过方法调用:
private void searchClicked(MenuItem item) {
searchText.setText(AppConstant.NULL_STRING);
searchBgr.setVisibility(View.VISIBLE);
searchText.requestFocus();
showKeyBoard();
}
我需要从通知栏中打开该特定方法。 我设法打开了那个特定的活动,但我不知道如何在我想要关注的活动中调用方法。
这是通知栏活动的意图:
Intent searchIntent = new Intent(context, NoteListActivity.class);
searchIntent.putExtra(AppConstant.FIXED_NOTIFICATION_SEARCH_KEY, true);
int searchPendingIntentId = AppConstant.FIXED_NOTIFICATION_SEARCH_ID;
PendingIntent searchPendingIntent = PendingIntent.getActivity(context, searchPendingIntentId, searchIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
答案 0 :(得分:0)
onCreate(){
if(getIntent().getBooleanExtra (AppConstant.FIXED_NOTIFICATION_SEARCH_KEY,false) ){
searchText.setText(AppConstant.NULL_STRING);
searchBgr.setVisibility(View.VISIBLE);
searchText.requestFocus();
showKeyBoard();
}
}