Using the DDMS view in Eclipse, I see there is the possibility of using KML files to feed locations to the AVD. I have an app that listens for locations and moves a Google mapview around, drawing lines from one spot to another. When I manually feed it using the manual tab it works fine.
However when I try to open a valid KML file, nothing happens. I have hundreds of valid KML files that work just fine in Google Earth, Bing Maps, and Google Maps. But the DDMS emulator control does not open them. No error of any kind, it just doesn't open them. I pasted a small KML file below.
(There is a problem with this forum software. When I paste code and such it does not capture everything so it looks like an invalid file but it's not. It usually catches the first line, skips a bunch of other lines, and then shows the rest of the file. It does this with Java code too).
Thanks,
Gary
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Name>_Name</Name>
<Style id="mTTPathStyle">
<LineStyle>
<color>aaff0000</color>
<width>4</width>
</LineStyle>
</Style>
<Style id="StartIconStyle">
<IconStyle>
<Icon><href>http://dl.dropbox.com/u/39662979/start.png</href></Icon>
<hotSpot x="0.5" y="0.0" xunits="fraction" yunits="fraction" />
</IconStyle>
</Style>
<Style id="FinishIconStyle">
<IconStyle>
<Icon><href>http://dl.dropbox.com/u/39662979/finish.png</href></Icon>
<hotSpot x="0.5" y="0.0" xunits="fraction" yunits="fraction" />
</IconStyle>
</Style>
<Folder>
<name>Test1</name>
<open>1</open>
<Placemark><name><![CDATA[6/3/2012 4:00:34 PM]]></name><visibility>1</visibility><styleUrl>#StartIconStyle</styleUrl><Point><coordinates>-111.03501118, 31.79118389, 893.5 </coordinates></Point></Placemark>
<Placemark><name><![CDATA[6/3/2012 4:01:55 PM]]></name><visibility>1</visibility><description>Test1 0.37 Miles 1 min, 21 sec 16.7 MPH</description><styleUrl>#FinishIconStyle</styleUrl><Point><coordinates>-111.03053401,31.79307061,932.299987792969 </coordinates></Point></Placemark>
<Folder><name><![CDATA[Path]]></name><open>0</open><Placemark><name>only Segment for now</name><styleUrl>#mTTPathStyle</styleUrl><LineString><extrude>0</extrude><tessellate>1</tessellate><altitudeMode>clampToGround</altitudeMode><coordinates>-111.03501118,31.79118389,893.5 -111.0352843,31.79227626,917.299987792969 -111.03510817,31.79219134,927.099975585938 -111.03491294,31.79222276,927.5 -111.03483045,31.79230171,928 -111.03465771,31.79236738,929.799987792969 -111.03418779,31.79235829,933.799987792969 -111.03282738,31.79241828,934.799987792969 -111.03200371,31.79269077,932.099975585938 -111.03157208,31.79302646,933.900024414063 -111.0311052,31.79310853,933.599975585938 -111.03053401,31.79307061,932.299987792969 </coordinates></LineString></Placemark></Folder>
</Folder>
As it turns out what is valid KML for Google Earth, Google Maps, and Bing Maps is not valid KML for Eclipse. However there is a KML converter at http://ge2adt.appspot.com/ (need Google groupslogin creds). I converted several of my KML files and they work great now in Eclipse.
Gary Blakely
Related
I have installed Android Studio 2.2 and I try to use the location option to set up a location. I want to do it through a KML file but always I receive the same error:
The file that I use to load the location is:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.x">
<Placemark>
<name>Casa de ACME</name>
<description>Casa de ACME</description>
<Point>
<coordinates>-1.705219,38.267902,0</coordinates>
</Point>
</Placemark>
</kml>
What is wrong in my file? What am I doing wrong?
I've just tried your file and it loaded correctly (on my machine). Most probably this means the issue is machine-specific. Looking at the code, I see the following very config-dependent block:
GpsFix new_fix;
while(3 == sscanf(coordinates + offset,
"%f , %f , %f%n",
&new_fix.longitude,
&new_fix.latitude,
&new_fix.elevation,
&n)) {
fixes->push_back(new_fix);
offset += n;
}
This code doesn't work if the decimal separator is set to anything but '.' on your machine.
Emulator bug: https://code.google.com/p/android/issues/detail?id=224400
I've just started Windows phone 8 development with previous experience of Android Development.
I was just searching if there is any strings.xml like file in windows phone 8 where we can keep strings and specially color codes. Yes i want to keep my own color codes in windows phone 8 project so that i may refer these colors in my Pages XML and in code.
Suggestions are highly appreciated.
Special color codes can be placed in your App.xaml file in the resources part.
Use like the following:
<Application.Resources>
<SolidColorBrush x:Key="ColorWhite"
Color="#FFFFFFFF" />
<ImageBrush x:Key="BackGroundBrush"
ImageSource="SplashScreenImage.jpg" />
<Style x:Key="MyPageStyle"
TargetType="phone:PhoneApplicationPage">
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="Background_WindowsPhone.png"
Stretch="UniformToFill" />
</Setter.Value>
</Setter>
</Style>
</Application.Resources>
In your page you might then use the following:
<phone:ApplicationPage Style="{StaticResource MyPageStyle">
<Grid Background="{StaticResource BackGroundBrush}">
<TextBlock Text="Hi"
Foreground="{StaticResource ColorWhite}" />
</Grid>
</phone:ApplicationPage>
Here's one that's driving me crazy:
I have recently started looking into Appcelerator Titanium. I have built a few small apps both with a normal project and using Alloy so I understand the basics at least.
One thing I just cannot get working is the i18n folder/files.
Here is what ive done:
- Create a "Default Project"
- add folder to root directory "i18n"
- add "en" and "es" folder to "i18n"
- add "strings.xml" to both those new folders.
- added:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome TEST</string>
</resources>
to both the strings.xml, except in the es strings I put "ES Welcome TEST".
- In Resources -> app.js I changed "I am Window 1" to L('welcome_message')
- Ran the application
Both the normal and alloy versions just show a blank screen. I would like to get my alloy app working the most but from what I understand the localization code should work the same in both apps. In alloy I may just have to put it in the style.
Any pointers would be great! I have looked at other post claiming its not working but all of them were either syntax errors or just set it up wrong. I have copied their code and have the exact same issue with it not working so I have a feeling im missing a newbie step.
-- Here are some screenshots, I just created a brand new regular(not alloy) project, added the code above and try to use L('welcome_message') to no luck. I tried installing everything on a new PC to make sure I wasn't messing anything up on my main computer.
Heres the answer:
https://wiki.appcelerator.org/display/guides/Internationalization
Ends up by default your manifest file is not setup by default to allow localization UNLESS you choose a tabbed project.
Kinda silly if you ask me.
For the topic poster:
My new string.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Don't Help Austin</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
Screenshot of my non-Alloy experiment:
For those looking to answer the question in the topic, this is a possible answer below.
My i18n folder is on the same hierarchy level as app and plugins, so mine isn't inside the app folder like the rest of the Alloy resources.
index.xml
<Alloy>
<Window class="container">
<Label id="label" onClick="doClick"></Label>
</Window>
</Alloy>
index.tss
".container": {
backgroundColor:"white"
},
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000",
text: L("welcome_message")
}
strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome to Kitchen Sink for Titanium</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
When I placed the L("welcome_message") inside the index.xml, it didn't work.
Hi I'm having a problem with my xml file for my android app. It's spitting out this error
error: invalid start tag Category . . . here is the source code.
<?xml version="1.0" encoding="UTF-8" ?>
<Category>
<destination id="1" main_cat="Hotel">
<timestamp></timestamp>
<business_name><![CDATA[ Sugarland Hotel ]]></business_name>
<alias><![CDATA[ Sugarland Hotel ]]></alias>
<address><![CDATA[ Araneta Avenue ]]></address>
<city><![CDATA[ Bacolod ]]></city>
<subcategory><![CDATA[ Hotel ]]></subcategory>
<cuisine><![CDATA[ Italian,Asian ]]></cuisine>
<budget> </budget>
<features> </features>
<working_days><![CDATA[ Everyday ]]></working_days>
<opening><![CDATA[ 24/7 ]]></opening>
<ending> </ending>
<contact><![CDATA[ (34)435-2690 , (34)435-2780 ]]></contact>
<fax><![CDATA[ (34)435-2645 ]]></fax>
<email><![CDATA[ rooms#sugarlandhotel.com ]]></email>
<website><![CDATA[ www.sugarlandhotel.com ]]></website>
<payment_type><![CDATA[ cash,credit card,master card, visa ]]></payment_type>
<lat><![CDATA[ 10.6524789N ]]></lat>
<long><![CDATA[ 122.9372838E ]]></long>
<desc><![CDATA[ Experience a modern hacienda retreat that nurtures the charm and romance of old world plantation living. Extensively renovated beginning 2010, Sugarland hotel unvails a celebrated balance of nostalgia and contemporary style, Capturing its original southern elegence, luxury, and decadence. Machuca tiles form cool geometric patterns in the hallways. Hacienda hardwoord floors contrast modern furnishings and amenities in the dramatic suits. The sugarland lifestyle offers guests the finest sensory indulgences: signature hacienda service, soothing organic toiletries, heirloom recipes, and unmatched privacy and tranquility. ]]></desc>
<image> </image>
</destination>
</Category>
also i tried testing CDATA would i rather use it or go with xml schema. Thanks for the help in advance
Remove the whitespace in front of <?xml version="1.0" encoding="UTF-8" ?>. Nothing can appear before it.
Both IntelliJ and my browser say your XML is fine. There must be something else wrong.
Let's go to the point..
I make an Android application which target is Google APIs (Platform 2.2).
I want to parse the XML File which comes from the REST API.
The XML file likes this:
<title>EARTH WIND & FIRE Live in Concert</title>
I store that output in my String variable, which I can use later and since the output is in XML, I use XML Parser class of course.
And as you can see, since the rule of XML format doesn't allow the naked character, in this case my '&' character, it will show:
<title>EARTH WIND & FIRE Live in Concert</title>
So I change that character with this method: xml.replaceAll("&", "<![CDATA[&]]>");
xml is String and I replace my & with <![CDATA[&]]> tag.
And I follow this: Android how to parse CDATA TAG?
It says that I must use dbf.setCoalescing(true);
Everything goes fine and in my TextView shows the words EARTH WIND & FIRE Live in Concert. The ampersand character (&) is shown in my emulator (Platform 2.2).
But, when I try it in the device (Platform 2.1), it will show only EARTH WIND.
And I make the new emulator Google APIs (Platform 2.1), it shows EARTH WIND too.
Does anyone here face the same problem with me??
Is there any compatibility issue with the XML Parser or the <![CDATA[]]> tag in Android??
Thanks in advance...
In String.xml in resouces folder
<string name="my_string"><![CDATA[Please put Your long text here ]]></string>
if you want to access this string for textview:
<TextView
android:id="#+id/my_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/my_string"
android:textColor="#android:color/white"
android:textSize="14sp"
android:textStyle="bold" />