Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中以编程方式打开自定义弹出窗口?_Android_Android Widget - Fatal编程技术网

如何在android中以编程方式打开自定义弹出窗口?

如何在android中以编程方式打开自定义弹出窗口?,android,android-widget,Android,Android Widget,我有一个简单的android应用程序,它可以进行搜索。我有一个自定义的弹出窗口来选择过滤器 我现在正在开发一个主屏幕应用程序小部件。应用程序小部件类似于android的谷歌搜索小部件 有一个弹出的过滤器,一个假的搜索框和一个代替谷歌语音按钮的搜索按钮 除了弹出窗口外,一切都很好 当在一个小部件上单击filter按钮时,我会触发一个额外的意图,表明单击了home按钮 当活动打开时,我检查是否有多余的内容,并单击应该打开弹出窗口的按钮。但这不起作用。有什么想法吗 我的代码是这样的- home_but

我有一个简单的android应用程序,它可以进行搜索。我有一个自定义的弹出窗口来选择过滤器

我现在正在开发一个主屏幕应用程序小部件。应用程序小部件类似于android的谷歌搜索小部件

有一个弹出的过滤器,一个假的搜索框和一个代替谷歌语音按钮的搜索按钮

除了弹出窗口外,一切都很好

当在一个小部件上单击filter按钮时,我会触发一个额外的意图,表明单击了home按钮

当活动打开时,我检查是否有多余的内容,并单击应该打开弹出窗口的按钮。但这不起作用。有什么想法吗

我的代码是这样的-

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.  

});
在小部件中,我有-

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);
Bundle b = getIntent().getExtras();
if(b != null && b.getBoolean(CMWidget.HOME_BUTTON_CLICKED)) {
home_button.performClick();
}
在我的活动中:

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);
Bundle b = getIntent().getExtras();
if(b != null && b.getBoolean(CMWidget.HOME_BUTTON_CLICKED)) {
home_button.performClick();
}
我有一个类似这样的设置-

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.  

});

我在找这个,没人回答

Bundle b = getIntent().getExtras();
if(b != null && b.getBoolean(CMWidget.HOME_BUTTON_CLICKED)) {
findViewById(R.id.anchor_button).post(new Runnable() {
            @Override
            public void run() {
                showPopup();
            }
}

你能把你的密码寄出去吗?没有代码很难找到问题。我用代码更新了问题。Buddy u发布了所有代码,但没有出现问题的代码。。你是如何实现自定义弹出窗口的?它可能有一些问题