Invalid escape sequence [message #1268584] |
Mon, 10 March 2014 13:56  |
Eclipse User |
|
|
|
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");
}
}
});
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.31371 seconds