hi
i am design a login project, then i using indent to redirect the page, can i able to redirect the page using SESSION VARIABLE. line are bold below, then i use the two indent command to redirect the page in single if statement, is it right.
help me plz.,
i am design a login project, then i using indent to redirect the page, can i able to redirect the page using SESSION VARIABLE. line are bold below, then i use the two indent command to redirect the page in single if statement, is it right.
help me plz.,
Code:
package com.example.login2;
import java.util.ArrayList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.content.Intent;
import android.location.LocationListener;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class login2 extends Activity {
EditText un, pw;
TextView error;
Button ok;
String text;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
un = (EditText) findViewById(R.id.et_un);
pw = (EditText) findViewById(R.id.et_pw);
ok = (Button) findViewById(R.id.btn_login);
error = (TextView) findViewById(R.id.tv_error);
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("UserName", un
.getText().toString()));
postParameters.add(new BasicNameValuePair("Pwd", pw.getText()
.toString()));
// String valid = "1";
String response = null;
try {
response = CustomHttpClient.executeHttpPost(
"http://10.0.2.2/androidapp/index.php",
postParameters);
String res = response.toString();
res = res.trim();
if (res.equals("Success")) {
[B]Intent i = new Intent(getApplicationContext(),
second.class);
Intent j = new Intent(login2.this,Location.class);[/B]
// Sending data to another Activity
i.putExtra("name", un.getText().toString());
un.getText();
startActivity(i);
}
else {
error.setText(res);
}
// res= res.replaceAll("\\s+","");
} catch (Exception e) {
un.setText(e.toString());
}
}
});
}
}