Results 1 to 3 of 3
  1. #1
    SteveBMill is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Set Global variable value

    I am building a app and no 0 about JAVA

    JavaScript yes but no help with this

    below is my code that validate the users logon

    Java Code:
    ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
    postParameters.add(new BasicNameValuePair("useremail", ue.getText().toString()));
    postParameters.add(new BasicNameValuePair("password", pw.getText().toString()));
    // String valid <> "0";
    String response = null;
    try {
    response = CustomHttpClient.executeHttpPost("http://mysite/mssp/logonvalidation.asp",postParameters);
    String res = response.toString();
    // res = res.trim();
    res = res.replaceAll("\\s+", "");
    // error.setText(res);
    if (res.equals("0"))
    error.setText("Invalid user email and/or password Logon");
    //I need to set UserID to res value here
    //Then how do I retrieve it in other views
    } catch (Exception e) {
    Thank you for any help

    I am strickly an ASP developer and this is my first attempt with android apps

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Set Global variable value

    I don't know Android, but I do know that to get help on a forum, you need to ask a question.


  3. #3
    Drun's Avatar
    Drun is offline Member
    Join Date
    Nov 2009
    Indian Head, MD (Missing Pittsburgh PA)
    Rep Power

    Default Re: Set Global variable value

    For "globals" java does not have them, but you can "emulate" them, this is not a pritty solution but it works, make a object and on that object make feilds you would like to have as your globals make sure you do your getters and setters for them. Next use the singalton princiapal for that object. It cheap not pritty but it works, I do this for the main activity in my apps, since I like to break the listeners out into other files, and I need a way to get back to the main activity (unless some one can point out a better away)
    Michael P. O'Connor

Similar Threads

  1. Global variables
    By nikkka in forum New To Java
    Replies: 6
    Last Post: 03-16-2011, 10:10 AM
  2. How to pu a sort of Global Variable?
    By esgol in forum New To Java
    Replies: 3
    Last Post: 01-19-2011, 06:46 PM
  3. Global variable not accessible
    By bolduc4 in forum New To Java
    Replies: 3
    Last Post: 05-10-2010, 08:51 AM
  4. How to undefine a Global Variable in JAVA?
    By ajaykushwaha in forum New To Java
    Replies: 13
    Last Post: 11-19-2008, 11:53 PM
  5. Replies: 1
    Last Post: 08-06-2007, 03:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts