nybras wrote:
>
> New to Android Development and was wondering if there was some way of 
> taking the users input to create an activity? For example say the user is 
> going through the process of setting up a profile of themself. One of the 
> questions is "how many pets do you have?". The user inputs "4" and then 
> clicks the 'Next' button (which opens the next activity).
>
> How would I take the users input of "4" to create four editText objects in 
> the next activity so that the user can now input the name's of his/her's 
> pets?
>
> I'm an ok-ish programmer (have never touched XML before though) so you 
> don't need to go into much detail I just don't know how I would access this 
> variable to create the four editText [sic] objects. From what I've found 
> out you can't add strings to the resources at run-time nor can even 
> edit/append files in resources.
>
That isn't true, exactly. You can dynamically create resources. You can 
dynamically assign text 
content to resources that handle such things, like 'TextView'. It is true 
that you don't 
"edit/append files in resources", whatever you meant by that. What did you 
mean by that?

Anyway, what is it you want to do that you can't do with things like 
http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence)
?
 

> I was thinking of writing an XML file from java [sic] and making the 
> activity (obviously written in XML) read the XML file if that's even 
> possible? Can XML files read XML files?
>
XML files are document files and contain no behavior. Thus, no, XML files 
cannot read any files. 
The program that uses the XML file can do anything it needs to do with 
additional files, though.

Android Activity code is written in Java, but it does use XML files to 
specify GUI elements such as layouts.
It supplements that with methods to dynamically work with widget attributes.

dnkoutso wrote:
>
> > Pass the 4 as an intent extra in your next activity.
> > Have a container layout in your next activity (probably linear layout 
> with vertical orientation) then onCreate read the intent extra and loop 
> through and programmatically create EditText views. Call addView() from 
> your container layout.

> then onCreate read the intent extra and loop through and programmatically 
> create EditText views. Call addView() from your container layout.

 
-- 
Lew

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to