Note that there are some explanatory texts on larger screens.

plurals
  1. POSqlite database to change TextView in android app
    primarykey
    data
    text
    <p>I am setting my textview using columns from a sqlite database file.Problem is that when i change the view back and forth, there is a very obvious lag while it retrieves from the database.Here is the code: </p> <pre><code>public class Flipcard extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LinearLayout layMain = (LinearLayout) findViewById(R.id.FlashCardFront); layMain.setOnClickListener(this); Cursor cur; DbH db = null; TextView tv=(TextView) findViewById(R.id.TV_Word); TextView txtView=(TextView) findViewById(R.id.TV_CardNo); try { db=new DbH(this); } catch (IOException e2) { e2.printStackTrace(); } try { db.createdatabase(); } catch (IOException e) { e.printStackTrace(); } db.opendatabase(); cur=db.data(); cur.moveToFirst(); tv.setText(cur.getString(0)); cur.close(); } public void onClick(View v) { Intent i=new Intent(this,Flipcard_back.class); startActivity(i); } } </code></pre> <p>the other java file that is being called on click is: </p> <pre><code> public class Flipcard_back extends Activity implements OnClickListener{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_back); LinearLayout layMain = (LinearLayout) findViewById(R.id.FlashCardRear); layMain.setOnClickListener(this); } public void onClick(View v) { Intent i=new Intent(this,Flipcard.class); startActivity(i); } } </code></pre> <p>which is actually calling previous one.The problem is i'm one a very initial phase on my app development.Right now i am only trying to change two textviews in first java file using my database.When i switch back and forth there is a lag of around a second.How do i correct it? am i doing something wrong. Also i am not able to retrieve all the rows using getstring(1) etc.Why so?How do i get the columns one by one?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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