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 :)

Recommended Answers

All 4 Replies

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

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

Yes exactly StringBuilder is better way then what you showed in VB which is also possible in Java/Android

Ah, thank you very much :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.