putting form fields in a layout without XML

  • Replies:2
Elbow Meat
  • Forum posts: 1

Jul 10, 2012, 5:52:57 PM via Website

Hello all,

I'm a pretty new Android developer looking for some help with an application way over my head.

I'm trying to take form fields out of a database, and put them into my app without using any XML. This will allow the app to be much more flexible and open to later edits of the database. We want to be able to dynamically change the content of the app.

But so far I can't seem to find a reliable way to put checkboxes and spinners in my app using only java, no XML. I'm hoping someone would be able to offer a little help in this area. I've googled a ton of solutions, but all seem to reference back to XML. Maybe there's no way to do this, or maybe I'm looking at this problem the wrong way. Let's hear some suggestions!

Thanks in advance.

Reply
Eric McBride
  • Forum posts: 1,790

Jul 11, 2012, 4:05:53 PM via Website

Welcome!

Jeremiah is our code God around here, so hopefully he's around to help you.

You around Jeremiah (I need to get like a Bat signal light for you :-D)

Reply
Jeremiah
  • Forum posts: 775

Jul 12, 2012, 1:02:28 AM via Website

hehe, thanks Eric :grin:

I think there's a way to do it using xml as a line item, then adding the lines (data) to the layout from the code. It still uses xml, but will allow you to dynamically add to your layout from code. Check out this info:
http://stackoverflow.com/questions/1505751/android-binding-data-from-a-database-to-a-checkbox-in-a-listview
http://windrealm.org/tutorials/android/listview-with-checkboxes-without-listactivity.php

Reply