Hi guys I'm newbie to android development and I need some help...
I want to make an app that will use data from an xml database and there are two points where I need help cause I find java with xml too complicate...
eg.
Code:
<items>
<1><name>box</name><price>2.00</price></1>
<2><name>pencil</name><price>1.00</price></1>
</items>
1)get a single xml value from a child node(eg.name of 1st item - "box")
2)get an xml database from child nodes (to use it as data source for a listbox) - this one is not nessesary
Thank you for your time guys...
I had never used xml in my programs before android either, so when starting off I found xml a little uncomfortable and found myself wanting to avoid it too. If you take the time to learn how the different xml files are used and how these objects can (easily) be used in your code, I think you'll see why its a lot better to just go with it. It helped things click for me when I understand that every xml object/attribute has a related java object/setmethod, which made me realize how much more organized and simple my code was using the xml.
I don't fully understand what your asking how to do, but it sounds like your trying to "swim upstream" by developing your own system of xml instead of using the android xml namespace. I would recommend doing some reading at developer.android.com, its really not too hard to get your head around and I think it will make your development go a lot more smoothly
Hi guys its me again. I send a lot of hours on searching about an easy way to use xml...
The easier way I have found called DOM but I have 2 questions:
1) how to load files from an android project easily(refered with less command line and without using inputstream)
2) how to use xpath to easily navigate on android
Prefered to see some examples...
Thanks 4 all...
Related
hi,
I have a program and it has lots of settings saved in memory, when I exis the program I need to save settings in a config file.
My program has CString(s), CArray(s) and other basic int and DWORD varibles, so how can I save such complex settings?
Mohammad
as xml maybe
If you're using MFC you could always attach a CArchive to a file and serialize
Perhaps you need to either create a log file - for debugging purposes or save your settings to the registry. If its the former then, check this one http://www.codeproject.com/ce/GenericLogFunctionality.asp it should be helpful. If its the latter, then you just search codeproject and you'll find lot of tutorials on the registry. Also, you can use CEDB which is a flat table data base that can store many data type structures including files and images, use it if you need to.
It may seem like you're lost now, but you can take an overview about the cons and pros of each technique so as to choose the best one for you.
For my config file I use plain english bounded by my own tags. I use a character sequence as a seperator for lists. I convert numerical values into text that can be human readable. There are some benefits to being able to read and edit it manually if the need arizes. I also made a class purely for writing and reading from my config file. Now when I to use a config file I can just drop that class into my project.
XML sounds good and similar but it would require a greater knowledge of xml.
Registry is easier and faster to do/execute but for data that can potentially grow too much it is probably best to keep it out of registry.
Is CArray serializable? do we just simply use CArray::Serialize and it will dump all included objects into a file?
thanks
http://msdn2.microsoft.com/en-gb/default.aspx
this site may be helpfull while you wait for somebody to answer your question
If you can it would be easier to use CObArray and ensure that the array members are subclassed from CObject with the DECLARE_SERIAL / IMPLEMENT_SERIAL macros. You could also add a new << operator to the CArchive class and write the serialization routine but that would kinda defeat the object I guess.
I solved the issue using serialization, for CArray structures I used the following method:
File<<MyArray.GetSize();//store how many objects
for(all my objects in the CArray)
serialize them one by one
I did the same when loading and it works flawlessly.
Thanks all for your help
hi sry for this dumb question but Is There Any Registry Editor for Samsung Galaxy S2 Android thanks
Only Windows has a registry. What are you wanting to do?
pjfriend said:
Only Windows has a registry. What are you wanting to do?
Click to expand...
Click to collapse
same things i used to do on my old HTC HD2 tweeking wifi and make it little more faster
You might be able to achieve what you want if you have a specific question...
SII has 'N' class radio anyway so it should be a great deal quicker than your HD2.
Ahh , you mean editing the build.prop which resides in system. Must be rooted(stand to be corrected?) and opened through root explorer/ astro/estrongs file explorer
Sent from my GT-P1000 using XDA Premium App
I saw this thread and thought 'Thats the first question I asked when I moved from wm6.5 to android!'. Welcome to Android mate
No, is basically the answer
thanks pjfriend
turborider said:
is that so hard for u to understand what Registry Editor mean? lol
Click to expand...
Click to collapse
Is it so hard for you to understand that system register is Windows-specific? There is no such thing on a Linux, MacOS X, DOS, BSD, Android, iOS, Bada OS, Symbian and so on.
Cheers Brut.all
turborider said:
wow i never thought polish plp have mobile phones in there,dont be smart azz on me dude,i never used android before,bloody hell i wish plp be more helpful than answering crap,i just wanted to know if Yes or No on Registry Editor
Click to expand...
Click to collapse
What's wrong with you? There were like 4 people who told you that there just isn't a registry editor for Android because Android does not have a registry! And you just seem to ignore those people, and insulte Brut.all because of his origin. We don't need people like you in our Android community.
This is getting to be like a monty python comedy sketch LISTEN turborider, there is NO registry, there is NO registry like service or system on android. You can make some modifications using a text editor to build.prop to change some system behaviour.
ice_coffee said:
This is getting to be like a monty python comedy sketch LISTEN turborider, there is NO registry, there is NO registry like service or system on android. You can make some modifications using a text editor to build.prop to change some system behaviour.
Click to expand...
Click to collapse
tyvm matey for your help
Instead of insulting people who try to help, maybe rather actually read the replies properly
Sent from my GT-P1000 using XDA Premium App
please Moderators close this thread sry for my post and ty again ice_coffee
@turborider
Ok, I think I'll explain this further to you.
Windows stores much of its configuration in a system register. Most of other systems, including Android, store config in many configuration files. They're usually textual and human readable, so you could open and edit them using any text editor, even notepad. Usually every installed service/daemon has its own configuration file(s).
This approach has pros and cons over system register. Config files are less standardized: some of them are xml files, others are ini-like or even custom format. So it's quite messy comparing to system register. On the other hand developer could choose format which is most suitable for his needs and you don't need any special software to edit system configuration. Config files are also very simple from technical point of view and this is good.
Unix systems usually store their config files in /etc/ directory. On Android it's /system/etc/ - there you will find a lot of files and you could open any of them, look into, edit, etc. Of course it's not a good idea to do some random changes I don't think you'll find complete guide to Android config files, because every device/ROM is different. Fortunately most of these files aren't specific to Android, but Linux/Unix or some service, so you should be able to find some help in Google.
Happy hacking
P.S.
Yes, we have mobile phones in Poland ;-)
EDIT:
Advanced options for wifi are in /system/etc/wifi/tiwlan.ini, but I'm not sure whether every device uses tiwlan driver. Of course these options aren't the same as in Windows configuration.
Brut.all said:
@turborider
Ok, I think I'll explain this further to you.
Windows stores much of its configuration in a system register. Most of other systems, including Android, store config in many configuration files. They're usually textual and human readable, so you could open and edit them using any text editor, even notepad. Usually every installed service/daemon has its own configuration file(s).
This approach has pros and cons over system register. Config files are less standardized: some of them are xml files, others are ini-like or even custom format. So it's quite messy comparing to system register. On the other hand developer could choose format which is most suitable for his needs and you don't need any special software to edit system configuration. Config files are also very simple from technical point of view and this is good.
Unix systems usually store their config files in /etc/ directory. On Android it's /system/etc/ - there you will find a lot of files and you could open any of them, look into, edit, etc. Of course it's not a good idea to do some random changes I don't think you'll find complete guide to Android config files, because every device/ROM is different. Fortunately most of these files aren't specific to Android, but Linux/Unix or some service, so you should be able to find some help in Google.
Happy hacking
P.S.
Yes, we have mobile phones in Poland ;-)
EDIT:
Advanced options for wifi are in /system/etc/wifi/tiwlan.ini, but I'm not sure whether every device uses tiwlan driver. Of course these options aren't the same as in Windows configuration.
Click to expand...
Click to collapse
ty mate sry for the last post
android options are stored usually (and always for the system's settings) in sqlite3 format and the dbs are around in /data (look for settings.db)
you can edit them on the device via adb shell and sqlite commands, but i suppose there might be some gui for it as well
this is akin to registry on windows, just op just doesn't know the technical differences. no need to be aggressive pricks about it -
Only Windows Operating System has registries. Unix-based one's store configuration files in /etc directory, eliminating the need for a registry.
bilboa1 said:
...this is akin to registry on windows, just op just doesn't know the technical differences. no need to be aggressive ****** about it -
Click to expand...
Click to collapse
+1 to that. A clearly teachable moment wasted by some nasty responses.
@turborider, as already mentioned, the build.prop file can be modified to make some tweaks (and some Android systems might also let you create a file called local.prop that can do some of the same things) but these are not nearly as far ranging as the windows registry. There are many forums and threads which describe the various tweaks and which can be found by searching for ["build.prop" tweaks]. Speaking of searching, for questions like this it is usually more productive to find existing threads covering the topic because such tutorials are likley to have higher traffic than a thread that asks a single question. One simple example of a build.prop tweak that I recently used was to change a value (switching between 1 and 0) which enabled/disabled a particular audio feature (audio offloading, to be precise) while testing a bug in Lineage OS, but there are more significant things that can be done by tweaking the build.prop. There are also other ways to tweak Android OS as suggested by @bilboa1. Search, and you'll find that stuff.
Is there anyway in Eclipse to have it update the R.java file without having to have a clean build. I am creating the XML files as I go, and am tired of having to comment out code just to have the file rebuild itself.
Also on my one project, the project can't seem to even get the R. Layout. Main to even be read. I noticed it when created the project, in the Main. Java file it had an error. Why does Eclipse have to be so confusing lol.
Thanks for help in advance
Sent from my HTC Desire CDMA using XDA App
You can try turning the automatic building of the application off, then building it when you're ready.
The only problems I ever have is when I go to run a program after a lot of xml changes and it puts a layout_name.out.xml. Then you delete it, close the project, open the project, and clean build.
There is also the saving the xml file to be able to use the view, whatever it may be in the source files.
Thanks for quick reply, what I would like is as soon as I save the XML files it updates the R. Java
Sent from my HTC Desire CDMA using XDA App
this is a problem with eclipse. search these boards for R.java and you will find many people complaining about how Eclipse messes with their project because of some issue with R.java. if you havent tried IntelliJ before you might try that. there are no issues using it with R.java
and the Community Android Edition is free.
So if I understand you correctly, you want to be able to create something in the xml, and have it create it in your class file, which will create it in your R.java file by itself?
If this is the case, I don't think it would work like this. Everything with an id created for you. I know some of my apps, I don't directly interact with some of the views, so I don't need them created. For example, I have a label like textview that stays the same. I don't want it created and throwing up the unused variable exclamation point, nor do I want to waste memory doing it. I think this was the simplest of options, instead of deleting everything you don't use, you just create what you do.
I don't know your level of programming knowledge, so I guess I'll just leave it at that. No disrespect intended, if I have somehow offended you.
j0hnZ said:
So if I understand you correctly, you want to be able to create something in the xml, and have it create it in your class file, which will create it in your R.java file by itself?
If this is the case, I don't think it would work like this. Everything with an id created for you. I know some of my apps, I don't directly interact with some of the views, so I don't need them created. For example, I have a label like textview that stays the same. I don't want it created and throwing up the unused variable exclamation point, nor do I want to waste memory doing it. I think this was the simplest of options, instead of deleting everything you don't use, you just create what you do.
I don't know your level of programming knowledge, so I guess I'll just leave it at that. No disrespect intended, if I have somehow offended you.
Click to expand...
Click to collapse
i believe he means that he has created something in xml with an @+id/something and then when he goes to use it in one of his activities/etc it throws an error because R.java has not been updated with the id of 'something'..
killersnowman said:
i believe he means that he has created something in xml with an @+id/something and then when he goes to use it in one of his activities/etc it throws an error because R.java has not been updated with the id of 'something'..
Click to expand...
Click to collapse
Weird, I've never had that problem.
killersnowman said:
i believe he means that he has created something in xml with an @+id/something and then when he goes to use it in one of his activities/etc it throws an error because R.java has not been updated with the id of 'something'..
Click to expand...
Click to collapse
Basically, it doesn't even recognize it basically. I guess I should just recreate the project and copy paste my stuff
Sent from my HTC Desire CDMA using XDA App
Sorry if this is the wrong place to post, but this is my first jump into android app development-
I'm *trying* to develop a cross platform gis data entry solution for editing shapefile/ geo-database polygon (or point) attributes in the field. Network connectivity can only be relied upon before going to, or upon returning from, the field. Is there an android friendly method for using a (any) type of geo-database file? Right now, I'm planning on exporting polygons to a kml/kmz or similar, and separately export the attributes to sqlite for editing. Upon return from the field, the edited sqlite rows can be used to update the (server-side) geo-database attributes.
However, I would eventually like to be able to directly edit the geometry, but am not sure if this means having to write something from scratch to read from a local geodatabase file, or if some sort of *local* android geodatabase solution already exists.
Just trying to get an idea of the initial direction I should be taking, as I have gis programing and database experience, but haven't ever done any native android development.
Any suggestions or links to related references would be appreciated!
Thanks!
-B
QGIS
You may want to check out this link - http://www.qgis.org/wiki/QGIS_Mobile_GSoC_2011
I don't have any connection to that project.
I'll check it out- thanks. I also spoke with esri, and they will be releasing some android products soon, complete with apis. Certainly not ideal or open source, but probably cheaper than developing my own. Gonna keep trying to develop a simple solution for managing and edditing attributes on my own till then.
Sent from my GT-I9000 using XDA Premium App
Hi all,
Firstly many thanks to Smartwatch Ticks for those excellent tutorial videos detailing what's in the XML files behind the ClockSkin faces on the D5 / Lem5 etc.
This sparked an interest in using something I discovered last year called Leo Editor (www.leoeditor.com). It's open source and written in Python. It's basically an outline editor. It has a tree structure and each node can contain text. However, the trick to Leo is that you can generate external files from any node. Also each node can be cloned and used anywhere.
This means that you can have a tree node which just contains the definitions of all your image arrays. If you want to use them for a particular face just clone the node again and paste it into your watch face structure where it's required.
The advantage with these clones is that if there's an error, once you fix it in one place, they're all fixed!
When you save your outline it writes all your generated files, creating new files for new nodes as required.
It doesn’t just support xml. It can be used to work with any language to break up code into manageable structures.
It's documentation which generates the code for you.
A concept called "literate programming".
I think there is already a software for creating android based smartwatches such as the D5.
It's called ClockSkinMaker created by @rromeroa
Clockskin Maker
Hi yes, I've had a look at ClockSkinMaker. I didn't find it very intuitive and I have been toying with the idea of developing my own that will include being able to edit the images, but for now I think I'll use it to test my faces and create them using Leo Editor.
Most stuff doesn't change anyway, it's just a matter of creating the new images, plus it makes it very easy to create a group of faces that have slight differences. Cloned nodes containing the desired "drawables" can easily be added in.
This enables very easy creation of several versions of the same face, but each one with slightly different features.
If a GUI was always better, the good lord wouldn't have given us bash!
richardtwyning said:
Hi yes, I've had a look at ClockSkinMaker. I didn't find it very intuitive and I have been toying with the idea of developing my own that will include being able to edit the images, but for now I think I'll use it to test my faces and create them using Leo Editor.
Most stuff doesn't change anyway, it's just a matter of creating the new images, plus it makes it very easy to create a group of faces that have slight differences. Cloned nodes containing the desired "drawables" can easily be added in.
This enables very easy creation of several versions of the same face, but each one with slightly different features.
If a GUI was always better, the good lord wouldn't have given us bash!
Click to expand...
Click to collapse
Ohh I see. Good luck then :good: