Please don't forget to vote helpful posts
Android, Part IV: Databases and Menus
#16
Posted 12 April 2012 - 07:11 AM
Great job solving your problem.
Please don't forget to vote helpful posts
Please don't forget to vote helpful posts
#18
Posted 16 January 2013 - 09:48 AM
Denis1, on 29 August 2010 - 01:46 PM, said:
Marc Ellis, on 02 August 2010 - 11:39 AM, said:
Hi, great tutorials - especially for someone like me whose just dipping their little toe into the world of Android development for the first time.
I tried this one out and am probably missing something here but I can't seem to get this to work
/>/>/> I'm just left with a blank screen when I run the code.
Also, the code in the step-by-step explain it all section is a little different in the Complete Code section at the end ...which is the one we should use ?
I tried this one out and am probably missing something here but I can't seem to get this to work
Also, the code in the step-by-step explain it all section is a little different in the Complete Code section at the end ...which is the one we should use ?
Quote
01 /** Called when the activity is first created. */
02 @Override
03 public void onCreate(Bundle savedInstanceState) {
04 super.onCreate(savedInstanceState);
05
06 this.list = new ListView(this);
07 setContentView(this.list);
08
09 this.db = this.openOrCreateDatabase("dic_tut4", MODE_PRIVATE, null);
10 this.db.execSQL("CREATE TABLE IF NOT EXISTS table_of_dics(value REAL)");
11 this.update_list();
12 }
02 @Override
03 public void onCreate(Bundle savedInstanceState) {
04 super.onCreate(savedInstanceState);
05
06 this.list = new ListView(this);
07 setContentView(this.list);
08
09 this.db = this.openOrCreateDatabase("dic_tut4", MODE_PRIVATE, null);
10 this.db.execSQL("CREATE TABLE IF NOT EXISTS table_of_dics(value REAL)");
11 this.update_list();
12 }
Quote
20 /** Called when the activity is first created. */
21 @Override
22 public void onCreate(Bundle savedInstanceState) {
23 super.onCreate(savedInstanceState);
24
25 this.list = new ListView(this);
26 this.registerForContextMenu(this.list);
27
28 this.db = this.openOrCreateDatabase("dic_tut5", MODE_PRIVATE, null);
29 this.db.execSQL("CREATE TABLE IF NOT EXISTS table_of_dics(value REAL)");
30 this.update_list();
31
32 setContentView(this.list);
33 }
21 @Override
22 public void onCreate(Bundle savedInstanceState) {
23 super.onCreate(savedInstanceState);
24
25 this.list = new ListView(this);
26 this.registerForContextMenu(this.list);
27
28 this.db = this.openOrCreateDatabase("dic_tut5", MODE_PRIVATE, null);
29 this.db.execSQL("CREATE TABLE IF NOT EXISTS table_of_dics(value REAL)");
30 this.update_list();
31
32 setContentView(this.list);
33 }
its a blank screen because there is no data to display. click menu and add data and you will see it on your screen
Quote
So how then do you add data into the menu?
Cos you can't click what you don't see right?
Cos you can't click what you don't see right?
|
|






MultiQuote



|