database - Android: Text size not changing -


i'm doing quiz using sqlite database , questions , answers pull database dont seem change size set in xml file. have narrowed down stuff pulled database i'm wondering why that. here classes involved

dbhelper

public class dbhelper extends  sqliteopenhelper { public dbhelper(context context) {     super(context, database_name, null, database_version); } private static final int database_version = 1; // database name private static final string database_name = "triviaquiz"; // tasks table name private static final string table_quest = "quest"; // tasks table columns names private static final string key_id = "id"; private static final string key_ques = "question";  private static final string key_answer = "answer"; //correct option private static final string key_opta= "opta"; //option private static final string key_optb= "optb"; //option b private static final string key_optc= "optc"; //option c private sqlitedatabase dbase;  @override public void oncreate(sqlitedatabase db) { dbase=db; string sql = "create table if not exists " + table_quest + " ( " + key_id + " integer primary key autoincrement, " + key_ques + " text, " + key_answer+ " text, "+key_opta +" text, " +key_optb +" text, "+key_optc+" text)"; db.execsql(sql); addquestions();  //db.close(); }  private void addquestions() {     question q1=new question("8 x 2 " + "=","16", "20", "18", "16");     this.addquestion(q1);     question q2=new question("8 x 3  " +    "=", "20", "24", "26", "24");     this.addquestion(q2);     question q3=new question("8 x 4 " + " =","30", "35","32","32");     this.addquestion(q3);     question q4=new question("8 x 5 " + " = ", "40", "38", "41","40");     this.addquestion(q4);     question q5=new question("8 x 6 " +" =","45","48","50","48");     this.addquestion(q5);     question q6=new question("8 x 7 " +" =","55","56","58","56");     this.addquestion(q6);     question q7=new question("8 x 8 " +" =","64","68","60","64");     this.addquestion(q7);     question q8=new question("8 x 9 " +" =","75","72","70","72");     this.addquestion(q8);     question q9=new question("8 x 10 " +" =","81","89","80","80");     this.addquestion(q9);     question q10=new question("8 x [  ]  " +" = 8","1","9","5","1");     this.addquestion(q10);     question q11=new question("8 x [  ] " +" = 24","5","3","6","3");     this.addquestion(q11);     question q12=new question("8 x [  ] " +" = 40","6","9","5","5");     this.addquestion(q12);     question q13=new question("8 x [  ] " +" = 56","7","8","9","7");     this.addquestion(q13);     question q14=new question("8 x [  ] " +" = 80","7","10","9","10");     this.addquestion(q14); } @override public void onupgrade(sqlitedatabase db, int oldv, int newv) { // drop older table if existed db.execsql("drop table if exists " + table_quest); // create tables again oncreate(db); } // adding new question public void addquestion(question quest) { //sqlitedatabase db = this.getwritabledatabase(); contentvalues values = new contentvalues(); values.put(key_ques, quest.getquestion()); values.put(key_answer, quest.getanswer()); values.put(key_opta, quest.getopta()); values.put(key_optb, quest.getoptb()); values.put(key_optc, quest.getoptc()); // inserting row dbase.insert(table_quest, null, values); } public list<question> getallquestions() { list<question> queslist = new arraylist<question>(); // select query string selectquery = "select  * " + table_quest; dbase=this.getreadabledatabase(); cursor cursor = dbase.rawquery(selectquery, null); // looping through rows , adding list if (cursor.movetofirst()) { { question quest = new question(); quest.setid(cursor.getint(0)); quest.setquestion(cursor.getstring(1)); quest.setanswer(cursor.getstring(2)); quest.setopta(cursor.getstring(3)); quest.setoptb(cursor.getstring(4)); quest.setoptc(cursor.getstring(5)); queslist.add(quest); } while (cursor.movetonext()); } // return quest list return queslist; }  public int rowcount() { int row=0; string selectquery = "select  * " + table_quest; sqlitedatabase db = this.getwritabledatabase(); cursor cursor = db.rawquery(selectquery, null); row=cursor.getcount(); return row; } } 

exercise.java

public class exercise1 extends activity { list<question> queslist; int score=0; int qid=0; question currentq; textview txtquestion; button rda, rdb, rdc; button butnext; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.exercise1);     dbhelper db=new dbhelper(this);     queslist=db.getallquestions();     currentq=queslist.get(qid);     txtquestion=(textview)findviewbyid(r.id.textview1);     rda=(button)findviewbyid(r.id.radio0);     rdb=(button)findviewbyid(r.id.radio1);     rdc=(button)findviewbyid(r.id.radio2);     //butnext=(button)findviewbyid(r.id.button1);     setquestionview();     rda.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v)         {             string s = currentq.getanswer();             log.d("exercise", s);              if(currentq.getanswer().equals(rda.gettext()))             {                 score++;                 if(qid<4)                 {                         currentq=queslist.get(qid);                         setquestionview();                 }                 else                 {                     intent intent = new intent(exercise1.this, tables2.class);                     bundle b = new bundle();                     b.putint("score", score); //your score                     intent.putextras(b); //put score next intent                     startactivity(intent);                     finish();                 }             }             else              {                 log.d("exercise", "not working ");             }         }           });     rdb.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v)         {             log.d("exercise", "button b pressed");             if(currentq.getanswer().equals(rdb.gettext()))             {                 score++;                  if(qid<4)                 {                         currentq=queslist.get(qid);                         setquestionview();                 }                 else                 {                     intent intent = new intent(exercise1.this, tables2.class);                     bundle b = new bundle();                     b.putint("score", score); //your score                     intent.putextras(b); //put score next intent                     startactivity(intent);                     finish();                 }             }             else              {                 log.d("exercise", "not working");             }         }           });     rdc.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v)         {             log.d("exercise", "button c pressed");             if(currentq.getanswer().equals(rdc.gettext()))             {                 score++;                 log.d("exercise", "wrong answer");                  if(qid<4)                 {                         currentq=queslist.get(qid);                         setquestionview();                 }                 else                 {                     intent intent = new intent(exercise1.this, tables2.class);                     bundle b = new bundle();                     b.putint("score", score); //your score                     intent.putextras(b); //put score next intent                     startactivity(intent);                     finish();                 }             }             else             {                 log.d("exercise", "not workingr");             }         }           }); } private void setquestionview() {     txtquestion.settext(currentq.getquestion());     rda.settext(currentq.getopta());     rdb.settext(currentq.getoptb());     rdc.settext(currentq.getoptc());     qid++; }  } 

exercise.xml

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context=".quizactivity" android:background="@drawable/exercise" > <linearlayout        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignparentbottom="true"        android:layout_alignparentleft="true"        android:layout_alignparentright="true"        android:layout_alignparenttop="true"        android:orientation="vertical" >     <textview                android:id="@+id/textview1"                android:layout_width="match_parent"                 android:gravity="center"                android:layout_height="200sp"                android:text="large text"                        android:textsize="50sp"                android:textappearance="?android:attr/textappearancelarge" />      <button                    android:id="@+id/radio0"                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:checked="true"                    android:text="radiobutton" />     <button                    android:id="@+id/radio1"                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:text="radiobutton" />     <button                    android:id="@+id/radio2"                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:text="radiobutton" /> </linearlayout> 

i assume somewhere in here why text size not changing


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -