Adding XML Parsing?

30 views
Skip to first unread message

brendanburns

unread,
Dec 12, 2011, 1:22:17 AM12/12/11
to Ruboto (JRuby on Android)
Hey Folks,
I was interested to see your project on JRuby + Android.

I saw the UI tutorial, I thought I'd point you at a snippet of code
I've written, to parse Android UI style XML dynamically:

http://code.google.com/p/droiddraw/source/browse/trunk/AnDroidDraw/src/org/droiddraw/android/ViewInflater.java

It's open sourced, feel free to incorporate it into Ruboto if you'd
like.

--brendan

Uwe Kubosch

unread,
Dec 12, 2011, 4:52:52 AM12/12/11
to rub...@googlegroups.com
This looks really interesting! Could you write up a tutorial on the wiki on how to use it?

https://github.com/ruboto/ruboto-core/wiki

--
Uwe Kubosch
http://ruboto.org/


Brendan Burns

unread,
Dec 19, 2011, 1:04:39 AM12/19/11
to rub...@googlegroups.com
Hello,
I started looking into how to do this, but I before it will work, I
need to figure out how to load custom Java code into Ruboto.

I see that I can use something like:

java_import "org.droiddraw.android.ViewInflater"

inflater = ViewInflater.new($activity)
view = inflater.inflate($xml)

$activity.setContentView view

But how can I get Ruboto to build that file into the .apk?

I can't seem to find similar instructions on the wiki.

Any quick pointers would be quite useful!

Thanks!
--brendan

Brendan Burns

unread,
Dec 19, 2011, 1:06:47 AM12/19/11
to rub...@googlegroups.com
I should clarify:

How do I get ruboto to build ViewInflater.java (my custom Java code)
into the .apk.

Thanks
--brendan

Uwe Kubosch

unread,
Dec 20, 2011, 4:51:24 AM12/20/11
to rub...@googlegroups.com
If I understand you correctly, all you have to do is drop you ViewInflater.java file into the src/org/droiddraw/android directory.

All .java files in the src directory will be compiled and included in the apk.

--
Uwe Kubosch
u...@kubosch.no
http://kubosch.no/


Brendan Burns

unread,
Dec 25, 2011, 6:56:25 PM12/25/11
to rub...@googlegroups.com
Thanks,
I've written up a small tutorial here:

https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Using-ViewInflater

Let me know if there are any problems. I'm not very familiar with
Ruby, I imagine that you could probably load the XML from a file, but
I'm not sure how to do that.

--brendan

Uwe Kubosch

unread,
Dec 26, 2011, 6:54:09 AM12/26/11
to rub...@googlegroups.com
Thanks! We'll take a look.
Reply all
Reply to author
Forward
0 new messages