Hi
In "Hello Android" book that i am reading , there is a sentence about usefulness of Resources that i can't understand .
Please give me some help about it .
The paragraph is :
"The resource compiler compresses and packs your resources and then
generates a class named R that contains identifiers you use to reference
those resources in your program. This is a little different from standard
Java resources, which are referenced by key strings. Doing it this way
allows Android to make sure all your references are valid and saves
space by not having to store all those resource keys. Eclipse uses a
similar method to store and reference the resources in Eclipse plug-ins."
The underlined sentence has two part .
I understand part one in this way :
When there is some error in for example XML lay out files in Android project in Eclipse IDE ,
The IDE does not work correctly and some red signs are appeared next to files that have
error in left side project browser of Eclipse.
Is the thing that i understood is correct and complete ???
And about part two .
I cant understand it . What it says ??
Thanks for your help
peter.sorotokin said:
Hi
In "Hello Android" book that i am reading , there is a sentence about usefulness of Resources that i can't understand .
Please give me some help about it .
The paragraph is :
"The resource compiler compresses and packs your resources and then
generates a class named R that contains identifiers you use to reference
those resources in your program. This is a little different from standard
Java resources, which are referenced by key strings. Doing it this way
allows Android to make sure all your references are valid and saves
space by not having to store all those resource keys. Eclipse uses a
similar method to store and reference the resources in Eclipse plug-ins."
The underlined sentence has two part .
I understand part one in this way :
When there is some error in for example XML lay out files in Android project in Eclipse IDE ,
The IDE does not work correctly and some red signs are appeared next to files that have
error in left side project browser of Eclipse.
Is the thing that i understood is correct and complete ???
And about part two .
I cant understand it . What it says ??
Thanks for your help
Click to expand...
Click to collapse
Whenever you add a resource(image, raw file, drawable, etc) in your app package, a separate class named as R.java forms in your gen folder. This cannot be edited by you and can only be modified by the IDE. All your resources will be given a unique id by which you can refer to them from your Java classes. It will revert to the generated version if you try to modify it manually.
I guess that the way you understood the first part is correct. But it also applies to Java code. In the Android Java code you use these identifiers to load resources. You don't use hard-coded Strings. That way the compiler can check whether a resource with that name exists by checking whether the reference to the field in R is valid. If you had to put in hard-coded Strings, there would be no (easy) way to check that.
About the second part: I guess that it means that Strings need more storage space.
If we talk about usefulness of resources, this is a much bigger point to me: You can define different resources for portrait and landscape mode, for different countries, for different screen sizes, for different OS versions, etc. and Android cares about using the right one. You don't need to decide which one to use yourself.
You can also refer to them from Java and xml very easily. You just need to change one line of code to change a String that is used multiple times in your app. You can't forget one.
Link for a much more detailed description: http://developer.android.com/guide/topics/resources/overview.html (including the sub-topics)
However, I guess that you won't need that many details in the beginning. Your book should explain the most important things.
Related
Hi all,
my father got MS Visual Studio 2005 some time ago and I just discovered that it's capable of creating mobile applications as well so I'm playing with it, trying to do some cool stuff (program for recording my marks at school atm ). The fact is, that I'm not extremely experienced in C# (in which I'm working in the MSVS2005) so I have to look up syntaxes or parts of code in help database every now and then. I have always succeeded so far, but now I have a problem I need someone to help me with.
I just started working with files, everything is fine, I think i quite understand the syntax and stuff, but I can't figure out how file paths under Windows Mobile work. In help file, they say that this should work:
string path = @"c:\temp\MyTest.txt";
but i think this is for desktop Windows only. If I try to use this in my programme, "Catch (Exception Ex)" command returns error saying: System.IO.DirectoryNotFoundException.
I tried various variants of the file path and the only one working was just plain name of file, for example
string path = @"MyTest.txt"
This way, I managed to write into the file and read the input back..but I couldn't find the file anywhere in my phone's memory :S
So if there was someone who would be so kind and told me how to specify file paths under WM correctly, I would really appreciate it. btw if the "someone" gave me his MSN/ICQ too, and was willing to give me real-time help once a time, it would be absolutely perfect
The root of the Windows Mobile filesystem is "\". If you want to place the file in the temp dir of the root, use this:
string path = @"\temp\MyTest.txt";
Øystein
As I am sure there are quite a few ppl around who can write ARM ASM application, I thought it might be fun/useful for them to have a look at my project which is a purely web-based ARM assembler. This is my university project, so I'd appreciate any feedback on it.
It's written entirely in PHP5 and it supports all instructions of ARM9. THUMB mode is not yet supported, but that's just a matter of encoding those instructions. Right now the assembler produces a single executable, but it's capable of producing DLLs and BINary ROM files too. It accepts both file-upload input and simple text. If there are no problems compiling your code, you'll get a link to executable, simple error reporting is available too. Compiled binaries are stored for 24h and then deleted.
It supports DLL linkage by .INCLUDE/.IMPORT directives, for instance:
Code:
.include coredll.inc
.import MessageBoxW
Right now it only has COREDLL header prepared, but I can make it for any other DLL you want, just let me know.
The assembler is available here:
http://arm.piopawlu.net - There is an example application "hello world!" included
Currently there is no way to edit Point UI but here wat we know!!
It have many jif files
Jif files are images but for some wierd reason not any jif viewer can open it
Cdl files
NetCDF (network Common Data Form) is a set of interfaces for array-oriented data access and a freely-distributed collection of data access libraries for C, Fortran, C++, Java, and other languages. The netCDF libraries support a machine-independent format for representing scientific data. NetCDF files should have the file name extension .NC. The recommended extension for netCDF files was changed from .CDF to .NC in 1994 in order to avoid a clash with the NASA CDF file extension, and now it also avoids confusion with Channel Definition Format files. CDL files contain metadata.
A Hex of the Home.exe
said this program should not be used with dos which lead me even more to believe this is a port of a program
Plz add more detail so we can customize this wonderful program
I don't think we need to go through all that trouble to change the look of it... Its just released and you want to hack something that's absolutly free??
My guess is that they will release some sort of customization app to go with it later. Also, I wouldn't be surprised if they released some sort of framework, so that we can add more new stuff to it.
Just my 2cents...
Don't you wish smalis referenced xml by their tag name instead of those hex numbers? It would be so much easier to port smalis from one framework to another.
Changing every id that is different from the original fw to the destination fw by hand is feasible, but very time consuming. Thus, I made this little java program to automate the task. It runs in the command line, and takes four arguments: the smali you want to change, the smali to be created, the original public.xml, and the target public.xml
It is meant to be used with the script that is also attached, to change all the smali files in any directory. It should work also in windows, but I don't include a .bat file since I only tested this in ubuntu.
the idea is to use it like this:
Code:
./changeAllIds.sh in/ out/ original.xml target.xml > log 2 > err.log
Known issues/bugs/TODO-list:
- The bad news is that the program will throw an exception if there is an id in the smali file that is present in the original.xml but not in the target.xml. The good news is that it will output to stderr the name of the smali file and the line that has that reference, so you can immediately know which one is and add it to the target fw.
- For some reason, the ids 'ok' and 'cancel' will make this program crash. It was for me faster to temporally remove those references in the smali file and continue (adding them back later) rather than fixing the code. You're welcome to fix it if you feel like.
Source code can be found here:
https://github.com/aleadam/xml_id_changer
Well, thank you Sine for linking me to another post in the Vibrant forum.
There is a java program made by untermensch posted 3 days ago that does the same. Except, as judging by the description and the comments, that it's well done, as opposed to the crude and amateur code I posted above
http://forum.xda-developers.com/showthread.php?t=945637
Hi all!
I'm a fairly inexperienced one-man developer, and I'm looking to make my apps viewable in different languages, in order to increase its popularity/usefulness in other countries.
My apps are quite text-heavy, so ideally it could be as simple as re-directing to text files with the proper language included, but I honestly have NO idea and I haven't been able to find any step-by-step tutorials simple enough to make sense to me.
Can anyone here help? Or at least point me in the right direction?
Thanks.
Also, if this topic is in the wrong section, please feel free to move it....
You can use resources files in Visual Studio. Create a folder named AppLocalResources for just a folder in you project and a folder named App_GlobalResources for your entire solution. In this folders you can add a Resource file name like your objects. See more on MSDN
TrivialPanPan said:
You can use resources files in Visual Studio. Create a folder named AppLocalResources for just a folder in you project and a folder named App_GlobalResources for your entire solution. In this folders you can add a Resource file name like your objects. See more on MSDN
Click to expand...
Click to collapse
thanks for your help .
Here is a link in MSDN :
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff637520(v=vs.105).aspx
hope to help you