Creating Variables in Android
Hey guys,
I'm just starting out with Android development using Eclipse. The only programming language that I've used a lot before is VB.NET, so I'm just wondering, is it possible to create variables which you can then add to over the course of the session?
I'm particularly thinking of strings because I want to create an app that will be used so that users can go through a series of options to build up an SQL query, then send this query to a remote server and return the results.
Can it be done similar to VB.NET? Or is it completely different?
Any help at all would be very much appreciated.
Thanks in advance :)
Related Article: Problem installing Android Development Tools
is a solved Mobile Development discussion thread by Wolxhound90 that has 6 replies, was last updated 1 year ago and has been tagged with the keywords: android, development, eclipse, java, tools.
Wolxhound90
Junior Poster in Training
61 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0
Can it be done similar to VB.NET? Or is it completely different?
>> I wouldn't know never used VB. For the rest it just a variable, how you handle it and interact with it is up to you. To build it you can consider StringBuilder instead of some concatenation often see from beginners
peter_budo
Code tags enforcer
15,815 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52
Ok, well in VB.NET, for example, to declare the variable I would do:
Dim strQuery as String = "SELECT "
and then as I was going through the options I would do something along the lines of:
strQuery += txtFirstAttribute.Text
which would take the text from the textbox "txtFirstAttribute" and add it onto the end of the string.
From reading that link I get the impression that it's something along the lines of:
new StringBuilder("SELECT ").append(txtFirstAttribute)
Would that work in the same way?
Thanks for your reply, sorry if I'm asking some stupid questions :P
Wolxhound90
Junior Poster in Training
61 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0
Yes exactly StringBuilder is better way then what you showed in VB which is also possible in Java/Android
peter_budo
Code tags enforcer
15,815 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52
Ah, thank you very much :)
Wolxhound90
Junior Poster in Training
61 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0
Question Answered as of 1 Year Ago by
peter_budo