在 3 列表视图翻转器中显示不同的字符串数组 Toast

发布于 2024-12-15 06:27:51 字数 2225 浏览 0 评论 0原文

我的 Flipper 上有 3 个列表视图,使用不同的线性布局

ListView list;
ListView list1;
ListView list2;

,并且我有从数组列表转换而来的字符串数组。

ArrayList<String> TextLV1 = new ArrayList<String>(); 
String[] TextLv1;

我还有一个脚蹼和名为 QuickAction 的弹出菜单按钮

mQuickAction
            .setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
                @Override
                public void onItemClick(int pos) {
                    if (pos == 0) { // Add item selected
                        Toast.makeText(cobabikinflipper.this,
                                "Add item selected on row " + mSelectedRow + " " + TextLv[mSelectedRow],
                                Toast.LENGTH_SHORT).show();
                    } else if (pos == 1) { // Accept item selected
                        Toast.makeText(
                                cobabikinflipper.this,
                                "Accept item selected on row "
                                        + mSelectedRow, Toast.LENGTH_SHORT)
                                .show();
                    } else if (pos == 2) { // Upload item selected
                        startActivity(new Intent("com.binus.skripsi.marketdetail"));
                    } else if (pos == 3) { // Upload item selected
                        Toast.makeText(
                                cobabikinflipper.this,
                                "Lendski items selected on row "
                                        + mSelectedRow, Toast.LENGTH_SHORT)
                                .show();
                    }
                }
            });

当我单击弹出菜单(pos==0)时,字符串数组是正确的(它显示了正确的字符串),但是当我单击其他时我无法从右侧列表视图更改为正确的字符串。我应该怎么做才能解决这个问题?

当我更改页面时,弹出菜单向我显示正确的字符串,因为我认为 MQuick Action 弹出菜单不适用于 3 列表视图,而是全合一..(抱歉,我的英语不太好)

我认为这是问题 (**) ??

public void onItemClick(int pos) {
                    if (pos == 0) { // Add item selected
                        Toast.makeText(cobabikinflipper.this,
                                "Add item selected on row " + mSelectedRow + " " + **TextLv[mSelectedRow]**,
                                Toast.LENGTH_SHORT).show();

I have 3 listview on my Flipper using diffrent linear layout

ListView list;
ListView list1;
ListView list2;

and I have String Arrays that has been converted from Array list.

ArrayList<String> TextLV1 = new ArrayList<String>(); 
String[] TextLv1;

I also have a flipper and pop up menu button called QuickAction in the flipper

mQuickAction
            .setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
                @Override
                public void onItemClick(int pos) {
                    if (pos == 0) { // Add item selected
                        Toast.makeText(cobabikinflipper.this,
                                "Add item selected on row " + mSelectedRow + " " + TextLv[mSelectedRow],
                                Toast.LENGTH_SHORT).show();
                    } else if (pos == 1) { // Accept item selected
                        Toast.makeText(
                                cobabikinflipper.this,
                                "Accept item selected on row "
                                        + mSelectedRow, Toast.LENGTH_SHORT)
                                .show();
                    } else if (pos == 2) { // Upload item selected
                        startActivity(new Intent("com.binus.skripsi.marketdetail"));
                    } else if (pos == 3) { // Upload item selected
                        Toast.makeText(
                                cobabikinflipper.this,
                                "Lendski items selected on row "
                                        + mSelectedRow, Toast.LENGTH_SHORT)
                                .show();
                    }
                }
            });

When I click on the pop up menu (pos==0) the string array is right(it shows me the right String), But when i click on the others i cant change to the right string from the right listview. what should i do to solve the Condition?

When i Change the page, The pop up menu shows me the right String because i think the MQuick Action Pop up menu works not for 3 listview but All in one.. (Im sorry my english isn't so good)

i think here's the problem (**) ??

public void onItemClick(int pos) {
                    if (pos == 0) { // Add item selected
                        Toast.makeText(cobabikinflipper.this,
                                "Add item selected on row " + mSelectedRow + " " + **TextLv[mSelectedRow]**,
                                Toast.LENGTH_SHORT).show();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文