Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to populate android-viewFlow from SQLite database correctly
    text
    copied!<p>I'm trying to implement android-viewFlow (<a href="https://github.com/pakerfeldt/android-viewflow" rel="nofollow">https://github.com/pakerfeldt/android-viewflow</a>) in my app, however, I'm having hard time populating each page correctly.</p> <p>The problem is that I have SQLite database, and I need to have a number of views that will match the number of rows matching my query (typically between 9 and 21), and each of those views should show values from that exact row.</p> <p>In viewFlow, there's this "sidebuffer" field that will load the number of views depending on what's the value of this "sidebuffer". So, how do I populate the adapter from SQLite and force the "sidebuffer" to match my number of rows. (If "sidebuffer = 3", the views loaded will be 2 * 3 + 1, and if it's 5, then it will load 2 * 5 + 1).</p> <p>Is there a downside of having "sidebuffer = 100" hard-coded even if I will never have even near that much of views to be shown?</p> <p>The reason I'm using viewFlow, and not the Android's compatibility viewPager, is that I need the title indicator which is implemented.</p> <p>Thanks in advance!</p> <p>Right now, I've created a new method in viewFlow.java</p> <pre><code>public setSidebuffer(int sidebuffer) { mSideBuffer = sidebuffer; init(); } </code></pre> <p>and in my main_activity where I'm setting up the viewFlow I'm calling the method as follows:</p> <pre><code>viewFlow = (ViewFlow) findViewById(R.id.viewflow); AndroidVersionAdapter adapter = new AndroidVersionAdapter(this); viewFlow.setAdapter(adapter, 3); viewFlow.setSidebuffer(adabter.getSize() / 2); // THIS IS THE THING </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload