I have a simple android application which does search. I have a custom popup window to select filters.
I am now developing a homescreen app widget to that. The app widget is similar to that of Google Search Widget for android.
There is a filter which pops up, a search box (fake) and a search button(instead of google’s voice button).
Everything is working great except for the popup.
When the filter button is clicked on a widget, i trigger a intent with an extra that indicates home button is clicked.
When the activity opens, i check for the extra and performClick() on the button that is supposed to open the popup. But that’s not working. Any idea?
My code is something like this –
In the widget I have –
Intent intent = new Intent(context, ActivityToOpen.class);
Bundle bundle = new Bundle();
bundle.putBoolean(CALL_FROM_WIDGET, true);
bundle.putBoolean(HOME_BUTTON_CLICKED, true);
intent.putExtras(loginBundle);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
In the Activity I have –
Bundle b = getIntent().getExtras();
if(b != null && b.getBoolean(CMWidget.HOME_BUTTON_CLICKED)) {
home_button.performClick();
}
I have a onClickListener set something like this –
home_button = findViewById(R.id.home_button);
home_button.setOnClickListener(new OnClickListener() {
i have implemented onClick() here which pops up the custom popup menu. Popup menu has Quick Action Items.
});
I was looking for this one which no one replied.