What is Unterminated quoted string?

by sasan_f2...@fouladirad.com » Tue, 08 Mar 2011 05:41:19 GMT


Sponsored Links
 his 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));



Re: What is Unterminated quoted string?

by Daniel Mack » Fri, 20 May 2011 09:30:37 GMT


 Hey,

On 4 Mrz., 02:14, "sasan_f2...@fouladirad.com"



I'm facing exactly the same problem under OS X 10.6, using Eclipse and
the Android SDK for 2.3.3 (version 10).

Did you find any solution for this issue yet? It seems to be entirely
unrelated to the actual code, though. Everything is freshly installed
and up-to-date.


Daniel

-- 


Sponsored Links


Other Threads

1. Proper way of launching Activity from Notification or Widget

HI Everyone,

I'm having trouble successfully launching my activity properly form a
Notification or Widget. Firstly let me explain how I am handling my
activities (for all I know it could be the completely wrong way to
handle activities, in which case I'll change it, but it works for the
most part)

I have a Main.class Activity, that doesn't have any layout associated
with it. It is what is launched when the application is launched. In
the onCreate method (which I have overridden), I read from
SharedPreferences to determine if the user is logged in or not. If
they aren't logged in, Main will then use startActivityForResult() to
launch Login.class. If they are logged in, it will launch (for
example) Details.class.

In both Login.class and Details.class, I have overridden
onBackPressed() which uses setResult(-1) and then finish()'s the
activity. I have overridden the onReceive() method in Main.class, and
if it recieves -1, it will finish() that activity as well. This makes
the back button work as expected (you shouldn't be able to use the
back button to get from Details.class to Login.class, as there's a
dedicated logout button for that. Having the back button log the
person out isn't what I want.)

Firstly, if this is the completely wrong way to launch the UI and
handle activities, let me know (I suspect it may be,) and I'll change
it so that Login.class is what get's launched, and it will launch
Details.class if the user is already logged in.

The problem that I have is this: if I start the Main.class activity
from either a Widget or Notificaton using PendingIntent like so:

Intent intent = new Intent ( context , Main.class );
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, 0);

It will launch it as expected. But it will launch another instance. If
I press the back button from the newly launched Activity, it will
close the current Activity, but it will then display the old Activity
(that may not have been killed by Android yet) that has been brought
to the front. So it goes something like this:

Details screen displayed -> Back Pressed -> Old details screen
displayed -> Back pressed -> Home is displayed (or whatever activity
was running)

Obviously it looks poorly coded if pressing back doesn't really do
anything, you have to do it twice (if the user keeps launching from
the widget, it can be how ever many times they have launched it + 1 ).
I'm guessing it's partly because it is poorly coded, but I don't know
what I need to do to fix it. Does anyone have any suggestions on the
best way to solve this? I've looked into bringing the current activity
to the front, but I can't seem to find any way of doing that.

Thanks,
Josh.

-- 

2. How to read a object array

Dear all,

I faced a question, I hope who can  help me.
Today, I used following method to get all installed package
information.

Object [] xx =
paramContext.getPackageManager().getInstalledPackages(8).toArray();

But I don't know how to withdraw the provider's name and package name
from Object xx.

would you mind to teach me?

Thanks

-- 

3. getCanonicalHostName returns an IP address

4. gingerbread tool level??

5. What I think should be fixed in iOS and how only Android can do it

6. Application data wiped out after reboot

7. Geo Location and webview