This is my simple code for an app that I'm making but when I try to
run it with the emulator this error shows up:
ActivityManager: am: 1: Syntax error: Unterminated quoted string
my code:
package com.android.SoccerAndroidProject;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener
{
private static final String TAG = "Game";
//creating the names of the parts
Button onepointButton,twopointsButton,
threepointsButton,resetButton,
onepointButton2, twopointsButton2, threepointsButton2;
EditText homeButton,awayButton;
TextView textScoreHome,textScoreAway,textScoreBetween;
int score1 = 0;
int score2 = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(TAG, "onCreate started");
// I now have all my UI in the Java memory
onepointButton = (Button)findViewById(R.id.onepointButton);
onepointButton2 = (Button)findViewById(R.id.onepointButton2);
twopointsButton = (Button)findViewById(R.id.twopointsButton);
twopointsButton2 = (Button)findViewById(R.id.twopointsButton2);
threepointsButton = (Button)findViewById(R.id.threepointsButton);
threepointsButton2 = (Button)findViewById(R.id.threepointsButton2);
resetButton = (Button)findViewById(R.id.resetButton);
homeButton = (EditText)findViewById(R.id.homeButton);
awayButton = (EditText)findViewById(R.id.awayButton);
textScoreHome = (TextView)findViewById(R.id.textScoreHome);
textScoreAway = (TextView)findViewById(R.id.textScoreAway);
textScoreBetween = (TextView)findViewById(R.id.textScoreBetween);
// Initialize text views
textScoreHome.setText(String.valueOf(score1));
textScoreAway.setText(String.valueOf(score2));
textScoreBetween.setText("");
// Define button listeners
resetButton.setOnClickListener(this);
onepointButton.setOnClickListener(this);
onepointButton2.setOnClickListener(this);
twopointsButton.setOnClickListener(this);
twopointsButton2.setOnClickListener(this);
threepointsButton.setOnClickListener(this);
threepointsButton2.setOnClickListener(this);
Log.d(TAG, "onCreate done");
}
public void onClick(View src) {
switch(src.getId()) {
case R.id.resetButton:
score1=0;
score2=0;
textScoreHome.setText(String.valueOf(score1));
textScoreAway.setText(String.valueOf(score2));
break;
case R.id.onepointButton:
score1++;
textScoreHome.setText(String.valueOf(score1));
break;
case R.id.onepointButton2:
score2++;
textScoreAway.setText(String.valueOf(score2));
break;
case R.id.twopointsButton:
score1 = score1 + 2;
textScoreHome.setText(String.valueOf(score1));
break;
case R.id.twopointsButton2:
score2 = score2 + 2;
textScoreAway.setText(String.valueOf(score2));
break;
case R.id.threepointsButton:
score1 = score1 + 3;
textScoreHome.setText(String.valueOf(score1));
break;
case R.id.threepointsButton2:
score2 = score2 + 3;
textScoreAway.setText(String.valueOf(score2));
break;
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en