如何将Roman Nuriks Wizard Pager审核中的数据放入数据库? [英] How do I put data from Roman Nuriks Wizard Pager review into database?

查看:134
本文介绍了如何将Roman Nuriks Wizard Pager审核中的数据放入数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧所以我知道之前已经问过这个问题,但问题和答案对我的情况都没有帮助。我需要做的是简单地从向导末尾的评论页面获取所有数据并将其放入我的SQLite数据库中,以便将来可以在我的应用程序中使用它。

Alright so I know this has been asked before but the question and answer both didn't help me in my situation. What I need to do is simply get all of the data from the review page at the end of the wizard and put it into my SQLite database so that I may use it in the future within my application.

我甚至不确定在这种情况下我应该在哪个班级工作。我真的希望之前遇到麻烦的人可以帮助我,因为我一直在寻找好几天而且我很难过!

I'm not even sure which class I should be working on in this case. I really hope someone who's had trouble with this before can help me because I've been searching for days and I'm stumped!

预先感谢您的任何帮助给我吧!

Thanks in advance for any help you can give me!

这是我到目前为止所尝试的,但总是返回null

here is my what I've tried so far however it is always returning null

  mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {



            if (mPager.getCurrentItem() == mCurrentPageSequence.size()) {

                String title = mWizardModel.findByKey("Surf:Post Title").getData().getString(SingleTextFieldPage.SIMPLE_DATA_KEY);
                int price = mWizardModel.findByKey("Surf:Price").getData().getInt(NumberPage.SIMPLE_DATA_KEY);  
                String maincat = mWizardModel.findByKey("Main Category").getData().getString(Page.SIMPLE_DATA_KEY);

                Long newId = myDb.insertRow(title, price, maincat);

                DialogFragment dg = new DialogFragment() {
                    @Override
                    public Dialog onCreateDialog(Bundle savedInstanceState) {
                        return new AlertDialog.Builder(getActivity())
                                .setMessage(R.string.submit_confirm_message)
                                .setPositiveButton(R.string.submit_confirm_button, null)
                                .setNegativeButton(android.R.string.cancel, null)
                                .create();
                    }
                };
                dg.show(getSupportFragmentManager(), "place_order_dialog");
            } else {
                if (mEditingAfterReview) {
                    mPager.setCurrentItem(mPagerAdapter.getCount() - 1);
                } else {
                    mPager.setCurrentItem(mPager.getCurrentItem() + 1);
                }
            }

        }
    });


推荐答案

@Derek Smith我找到了一种方法来保存数据,它适用于我。

@Derek Smith I have figured out a way to save the data and it works for me.

这是我的AbstractWizardModel类块:

This is my AbstractWizardModel class block:

@Override
protected PageList onNewRootPageList() {

    return new PageList(
            new LoginInfoPage(this, "Login Information").setRequired(true));
}

它类似于随图书馆提供的样本。

It is similar to the sample provided with Library.

现在在您的MainActivity中,写如下:

Now in your MainActivity, write as below:

String data = mWizardModel.findByKey("LoginInformation").getData().getString(LoginInfoPage.EMAIL_DATA_KEY);

检索数据的主要方法是密钥。在我的情况下,密钥是登录信息,这也是你的标题。

The main thing to retrieve data is "key". In my case, key is "Login Information" which is also your title.

希望它有所帮助。

问候,

这篇关于如何将Roman Nuriks Wizard Pager审核中的数据放入数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆