Switch statement not working

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Switch statement not working

Postby ziggy786 » Sat Jul 06, 2013 11:37 am

I've created a SQLite database and everything, but my switch statement doesn't work, i click on the AddRow button and it my app says "App Failed". Can someone help me please? Thank You

Code: Select all
package com.example.scoresheet;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Scoresheet extends Activity implements OnClickListener{

   Button sqlAddRow, sqlDeleteRow, sqlSave;
   EditText P1Score, P2Score, P3Score, P4Score, P5Score,
   P6Score, P7Score;
   protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      sqlAddRow = (Button) findViewById(R.id.bAddRow);
      sqlDeleteRow = (Button) findViewById(R.id.bDeleteRow);
      sqlSave = (Button) findViewById(R.id.bSave);
      P1Score = (EditText) findViewById(R.id.etP1Score);
      P2Score = (EditText) findViewById(R.id.etP2Score);
      P3Score = (EditText) findViewById(R.id.etP3Score);
      P4Score = (EditText) findViewById(R.id.etP4Score);
      P5Score = (EditText) findViewById(R.id.etP5Score);
      P6Score = (EditText) findViewById(R.id.etP6Score);
      P7Score = (EditText) findViewById(R.id.etP7Score);

   public void onClick(View arg0) {
      // TODO Auto-generated method stub
      switch (arg0.getId()){
      case R.id.bAddRow:
         boolean work = true;
         int score1 = Integer.parseInt(P1Score.getText().toString());
         int score2 = Integer.parseInt(P2Score.getText().toString());
         int score3 = Integer.parseInt(P3Score.getText().toString());
         int score4 = Integer.parseInt(P4Score.getText().toString());
         int score5 = Integer.parseInt(P5Score.getText().toString());
         int score6 = Integer.parseInt(P6Score.getText().toString());
         int score7 = Integer.parseInt(P7Score.getText().toString());
         Scores entry = new Scores(Scoresheet.this);
         entry.createEntry(score1, score2, score3, score4, score5, score6,
         }catch (Exception e){
            work = false;
            if (work){
               Dialog d = new Dialog(this);
               TextView tv = new TextView(this);
               tv.setText("APP WORKS!!!");
            } else {
               Dialog d = new Dialog(this);
               TextView tv = new TextView(this);
               tv.setText("APP Failed");
      case R.id.bDeleteRow:
      case R.id.bSave:

also i get an error in LogCat saying: "(1) near "TABLEScoreTable": syntax error" whenever i click on "Add Row"
also on the problems tab, it is not mentioned.
Once Poster
Once Poster
Posts: 1
Joined: Sat Jul 06, 2013 11:24 am


Return to Networking & Database Problems

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests