Results 1 to 3 of 3
Thread: Set Global variable value
- 09-12-2011, 06:51 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 1
- Rep Power
- 0
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
Thank you for any helpJava 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"); else //I need to set UserID to res value here //Then how do I retrieve it in other views setContentView(R.layout.selectionmenu); } catch (Exception e) { ue.setText(e.toString()); } }
I am strickly an ASP developer and this is my first attempt with android apps
- 09-12-2011, 09:30 PM #2
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.
db
- 09-18-2011, 11:48 PM #3
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
http://www.mikeoconnor.net
Similar Threads
-
Global variables
By nikkka in forum New To JavaReplies: 6Last Post: 03-16-2011, 09:10 AM -
How to pu a sort of Global Variable?
By esgol in forum New To JavaReplies: 3Last Post: 01-19-2011, 05:46 PM -
Global variable not accessible
By bolduc4 in forum New To JavaReplies: 3Last Post: 05-10-2010, 07:51 AM -
How to undefine a Global Variable in JAVA?
By ajaykushwaha in forum New To JavaReplies: 13Last Post: 11-19-2008, 10:53 PM -
How would I declare the variable numbers as global?
By barney in forum New To JavaReplies: 1Last Post: 08-06-2007, 02:17 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks