It sounds like you're trying to dynamically inflate an xml layout and
run dynamic code.

XML Layout:
 Android doesn't support the use of dynamic xml layouts:
    “The view hierarchy inflation (and many other things that use XML
resources) relies on
     the preprocessing performed by the resource compiler when
building the application.
     They can not be used with plain XML files.

     It would certainly be nice to be able to inflate from raw XML
files, but there is no
     plan to do this any time soon due to the effort involved and that
it is questionable
     whether the performance would be acceptable.”

Code:
  Android is using compiled java. As it is not an interpreted language
you will not be able to use approaches available in other languages
e.g. Javascript's exec()

I've spent a fair bit of time looking at this problem myself and
basically the most viable solution is to come up with your own
simplified subset of layout commands and use these to dynamically add
views to a placeholder. As for the running of code again you need to
come up with a simplified set of changes you might want to make on the
fly e.g. what method to call onClick for button X.

I have considered writing a generic reusable solution to this very
problem but I think the subset of language components for both views
and code would be hard to define for unknown applications.

Ed

On Aug 1, 10:26 pm, "{ Devdroid }" <webnet.andr...@gmail.com> wrote:
> On 30 July 2010 11:49, prateek tuli <censor...@yahoo.co.in> wrote:
>
> > Hi,
> > I want to create an application in android which at runtime calls an
> > xml file from some path of the system.And make that contents of the
> > xml file run in the same application.Could i get a feasible code
> > because at runtime the bytecode of the activity is already created.how
> > do i compile and run the activity and runtime.Also i was facing
> > problem reading the xml file.Need some suggestions asap..
> > Thanx in advance!!
>
> XML files are not executables so they cannot be run. Please be more
> specific on what your are really want to achieve as it's hard to advice
> on "some <unnamed> problems"

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

Reply via email to