Skip to main content



      Home
Home » Newcomers » Newcomers » Invalid escape sequence(Unable to use valid char)
Invalid escape sequence [message #1268584] Mon, 10 March 2014 13:56 Go to next message
Eclipse UserFriend
I am trying to set a String path
String server_name = "192.168.5.166\\NLS"

But when I run my app in debug the String is displayed as "192.168.5.166\\NLS" rather than 192.168.5.166\NLS

I am new to Java programming as well as Eclipse. But I did some online research prior to this post and came up with
\b backspace
\t horizontal tab
\n linefeed
\f form feed
\r carriage return
\" double quote
\' single quote
\\ backslash

but as I said when I add the \\ to my string its displaying still as 192.168.5.166\\NLS rather than "192.168.5.166\NLS"

Any help would be greatly appreciated!!

Thomas


package com.hfc.droid;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
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 Main extends Activity
{
static boolean errored = false;
Button b;
TextView statusTV;
EditText userNameET , passWordET;
String editTextUsername;
boolean loginStatus;
String editTextPassword;
String db_type = "MSSQL";
String server_name = "192.168.5.166\NLS";
String db_name = "NLS";

@Override
public class Main extends Activity
{
static boolean errored = false;
Button b;
TextView statusTV;
EditText userNameET , passWordET;
String editTextUsername;
boolean loginStatus;
String editTextPassword;
String db_type = "MSSQL";
String server_name = "192.168.5.166\NLS";
String db_name = "NLS";

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}

public void addListenerOnButton()
{
userNameET = (EditText) findViewById(R.id.tbusername);
passWordET = (EditText) findViewById(R.id.tbpassword);
statusTV = (TextView) findViewById(R.id.tv);
b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
//Check if text controls are not empty
if (userNameET.getText().length() != 0 && userNameET.getText().toString() != "")
{
if(passWordET.getText().length() != 0 && passWordET.getText().toString() != "")
{
editTextUsername = userNameET.getText().toString();
editTextPassword = passWordET.getText().toString();
statusTV.setText("");
//Create instance for AsyncCallWS
AsyncCallWS task = new AsyncCallWS();
//Call execute
task.execute();
}
//If Password text control is empty
else
{
statusTV.setText("Please enter Password");
}
//If Username text control is empty
} else
{
statusTV.setText("Please enter Username");
}
}
});
}



Re: Invalid escape sequence [message #1268617 is a reply to message #1268584] Mon, 10 March 2014 14:57 Go to previous message
Eclipse UserFriend
Update:

Never mind. During my debug I was looking at the variable before it was actually set. Once the value was set it was setting it correctly.

Thanks
Thomas
Previous Topic:Re: Xtext
Next Topic:Help
Goto Forum:
  


Current Time: Tue Jun 17 17:29:26 EDT 2025

Powered by FUDForum. Page generated in 0.31371 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top