I am integrating Fusion chart in my Flex 4.6 web application, it is working fine but when i try to use the same set of code in AIR it throws run time error as like below
VerifyError: Error #1014: Class mx.controls::Image could not be found.
at FusionChartSample/init()[D:\WorkspaceLocal\TabletSamples\FusionChartAppln\FusionChartSample.mxml:15]
at FusionChartSample/___FusionChartSample_Application1_creationComplete()[D:\WorkspaceLocal\TabletSamples\FusionChartAppln\FusionChartSample.mxml:4]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at mx.core::UIComponent/set initialized()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
Here is my sample code working fine in Web application but not in AIR,
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:components="com.fusioncharts.components.*" xmlns="*" creationComplete="init()" >
<fx:Script>
<![CDATA[
import com.fusioncharts.components.*;
import spark.components.Button;
private var _fusionChart: FusionCharts;
private var sampleXml:XML;
private function init():void {
_fusionChart = new FusionCharts();
_fusionChart.FCChartType = "StackedColumn2D";
_fusionChart.FCDataXML = sampleXml;
_fusionChart.FCFolder = "../fusioncharts/";
_fusionChart.FCRender();
this.addElement(_fusionChart);
}
]]>
</fx:Script>
</s:Application>
If anyone comes across this problem, kindly provide me some idea. Thanks in advance.
The above code snippets has few problems. First ensure that you are not using Spark Only Component set. Set MX + Spark Component.
I am not sure why the above code snippet is showing "s:Application". If this is an AIR app it should be "s:WindowedApplication".
The attribute FCDataXML is pointing towards a string which is probably the name of the XML file. You need to specify the actual XML there.
Related
I have an existing Android Cordova project which uses an embedded WebView. What this means is that the Activity does not extend CordovaActivity, but instead embeds the SystemWebView and initializes within the onCreate.
The following is currently how this is being done:
Within the layout XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
.... other layout elements not related to Cordova....
<org.apache.cordova.engine.SystemWebView
android:id="#+id/cdvWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Within the Activity's onCreate:
SystemWebView systemWebView = (SystemWebView) findViewById(R.id.cdvWebView);
CordovaWebView cdvWebView = new CordovaWebViewImpl(new SystemWebViewEngine(systemWebView));
ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(this);
cdvWebView.init(this, parser.getPluginEntries(), parser.getPreferences());
Due to the bug in Lollipop versions 5.0.+ missing the "set" button, I want to implement the Crosswalk plugin into the project.
Unfortunately, all the documentation I'm finding assumes that a typical Cordova install is being used. I haven't been able to get the embedding and initialization of the XWalkWebView working correctly and keep getting a blank white screen.
Has anybody has success with a similar scenario?
I'm not sure, but this might answer your question. It seems to show implementing an XWalkWebView outside of a typical cordova project:
https://github.com/kurli/crosswalk-website/wiki/How-to-use-Crosswalk-Embedded-API-on-Android
i wanted to incororate a Leaflet Map into an ios and android air mobile application using the StageWebView class.
Unfortunately the quality of the map images is so jagged, that it is hard to make out the streetnames. There seems to be some minor scaling going on.
For test purposes i used the Leaflet tutorial mal at http://leafletjs.com/examples/quick-start-example.html
When viewed in the Android browser ( chrome ) the images look fine.
Here is some simple code to show the issue:
package {
import flash.display.MovieClip;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.desktop.NativeApplication;
import flash.utils.setTimeout;
public class Main extends MovieClip{
private var _stageWebView:StageWebView
public function Main()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
setTimeout( init, 100 );
}
private function init():void {
_stageWebView = new StageWebView();
_stageWebView.stage = this.stage;
_stageWebView.viewPort = new Rectangle( 0, 0, stage.stageHeight, stage.stageWidth );
_stageWebView.loadURL( "http://leafletjs.com/examples/quick-start-example.html" );
}
}
}
Any ideas? Does it have to do with a resolution problem maybe?
Thanks
The problem that you got is a rendering problem which you can avoid by enabling hardware acceleration (force GPU rendering) when it's supported of course.
Beginning in Android 3.0 (API level 11), the Android 2D rendering pipeline supports hardware acceleration, meaning that all drawing operations that are performed on a View's canvas use the GPU.
So to force GPU rendering, you can :
1 - Enable hardware acceleration in your application's manifest file, where you should set the android:hardwareAccelerated attribute of the application element to true :
<android>
<manifestAdditions>
<![CDATA[
<manifest>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>
And this is an example of a full manifest file (my test browser-app.xml) :
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/19.0">
<id>browser</id>
<versionNumber>1.0.0</versionNumber>
<versionLabel/>
<filename>browser</filename>
<description/>
<name>browser</name>
<copyright/>
<initialWindow>
<content>browser.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<fullScreen>false</fullScreen>
<renderMode>auto</renderMode>
<autoOrients>true</autoOrients>
</initialWindow>
<icon/>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<android>
<manifestAdditions>
<![CDATA[
<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>
</application>
then you have just to publish your AIR app, you will get something like this :
and you can see the result when I comment <application android:hardwareAccelerated="true"/> :
2 - You can also force GPU rendering from the Developer Options of your Android device :
and you can get the same result even when <application android:hardwareAccelerated="true"/> is commented :
That's all !
Hope that can help.
If you change it to use nativeMode new StageWebView(true) it solves the problem for me but the mouse/touch events don't work :/
In Android project I'm trying to add databindings using CrossLight part of MvvmCross.
Bindings to standard TextView/Buttons work great. But simplest markup with Mvx.Control:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<Mvx.MvxListView />
</LinearLayout>
Gives an error
"Binary XML file line #1: Error inflating class Mvx.MvxListView"
The same thing is with Mvx.Spinner.
However, when instantiating it from code in Activity.OnCreate:
_bindingContext = new MvxAndroidBindingContext(this, new LayoutInflaterProvider(LayoutInflater), _viewModel);
var view = (LinearLayout)_bindingContext.BindingInflate(Resource.Layout.Main, null);
SetContentView(view);
var spinner = new MvxSpinner(this, null, new MvxAdapter(this, _bindingContext));
view.AddView(spinner);
Everything works great (including bindings). What am I doing wrong? Is this scenario supported in general?
Or maybe I should reference anything else except nuget MvvmCross.HotTuna.CrossCore?
P.S. Haven't found any samples with custom controls and CrossLight neither on github, nor on N+1 videos
If you want to use namespace abbreviations within your non-MvvmCross application, then you'll need to add those abbreviations. This can be done using a custom binding builder or using a 'light' setup step like:
var viewResolver = Mvx.Resolve<IMvxAxmlNameViewTypeResolver>();
viewResolver.ViewNamespaceAbbreviations["Mvx"] = "Cirrious.MvvmCross.Binding.Droid.Views";
viewResolver.ViewNamespaceAbbreviations["MyApp"] = "MyApp.Controls";
When doing this within a full MvvmCross application, then you can override the Setup property ViewNamespaceAbbreviations
protected override IDictionary<string, string> ViewNamespaceAbbreviations
{
get
{
var toReturn = base.ViewNamespaceAbbreviations;
toReturn["MyApp"] = "MyApp.UI.Droid.Controls";
return toReturn;
}
}
When markup was changed to using the full namespace and layout_width and layout_height attribute was added it started to work!
<Cirrious.MvvmCross.Binding.Droid.Views.MvxSpinner
android:id="#+id/MySpinner"
android:layout_width="fill_parent"
android:layout_height="20dp"
/>
It was found when I switched to default Android inflater and it was complaining about missing layout_width in Exceptions.
I'm trying to figure out how to write apps for Android using Adobe Air. I've choosen Axel Framework (simple game engine based on Stage3D) and FlashDevelop as my tools. I wrote my first app which should display an image and some text on screen. When I run this app in desktop mode, it works. Unfortunately when I install it on Android emulator it displays only blank screen (with color specified in [SWF] tag). I really don't know what's wrong.
Addtional compile arguments: -swf-version=13
Target framework: AIR mobile 3.3
application.xml
<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/3.0">
<id>air.TestAndroidAxl</id>
<versionNumber>0.1</versionNumber>
<supportedProfiles>mobileDevice</supportedProfiles>
<filename>TestAndroidAxl</filename>
<name>TestAndroid_Axl</name>
<android>
<manifestAdditions><![CDATA[<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:required="true"android:name="android.hardware.touchscreen.multitouch" />
</manifest>]]></manifestAdditions>
</android>
<initialWindow>
<title>TestAndroid_Axl</title>
<content>TestAndroidAxl.swf</content>
<visible>true</visible>
<fullScreen>false</fullScreen>
<!--<autoOrients>false</autoOrients>-->
<!--<aspectRatio>landscape</aspectRatio>-->
<renderMode>direct</renderMode>
<systemChrome>standard</systemChrome>
<aspectRatio>landscape</aspectRatio>
</initialWindow>
<icon>
<image48x48>icons/icon_48.png</image48x48>
<image57x57>icons/icon_57.png</image57x57>
<image72x72>icons/icon_72.png</image72x72>
<image114x114>icons/icon_114.png</image114x114>
<image512x512>icons/icon_512.png</image512x512>
</icon>
</application>
Main.as
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
public class Main extends Sprite {
public function Main() : void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.DEACTIVATE, deactivate);
// touch or gesture?
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
// entry point
var game : AxlGame = new AxlGame();
addChild(game);
}
private function deactivate(e:Event) : void {
NativeApplication.nativeApplication.exit();
}
}
AxllGame.as
import org.axgl.Ax;
public class AxlGame extends Ax {
public function AxlGame() {
super(PlayState);
}
}
You might want to try it on emulator with GPU emulation. Here's how to set it up:
Add Android 4.0.3 (or later) image.
Edit the image. Next to “Hardware:”, Select “New…”
Add “GPU emulation”.
Set its value to “Yes”.
I am a PHP programmer who is having to do some work in the android development environment. I have 2 books on this and have tried 30 search engine topics and still have not found just a simple example of everything that you need to do to place a working hyperlink in a Java android application.
I just need a very simple but complete ingredient for doing so. I have the 2.2 android development environment with Eclipse and an emulator. I have tried the WebView control which just simply loads a web site into the window when I run the application. I need a basic hyperlink to a web site example.
I don't want anything else thrown in with it (just an application with a working hyperlink and nothing else), because I am trying to learn the different controls bit by bit along with the Java and XML code that controls them.
This is so different from PHP, ASP, etc. that it has me totally fishing for answers. Thanks;
Cullan
Android is a GUI, not a Web browser. Hence, "place a working hyperlink in a Java android application" is akin to "place a snowplow blade on a dishwasher" or "implement a Web app in COBOL". It is technically possible but probably is the incorrect solution to whatever problem it is that you really trying to solve.
So, as MatrixFrog indicates, one possibility is to use a TextView and some HTML:
TextView tv=(TextView)findViewById(R.id.whatever_you_called_it_in_your_layout);
tv.setText(Html.fromHtml("Who knows?"));
But, doing that would be unusual in a GUI environment. Most developers would use a button, or a menu choice, or something along those lines, to trigger viewing some URL.
CommonsWare, That is not what I call a detailed explanation or example of how to place a hyperlink inside an android application. It is just a small snippet of code with no further explanation. I found what works on my own and here is the Java code for it:
package com.practice.weblink;
import android.app.Activity;
import android.os.Bundle;
import android.text.util.Linkify;
import android.widget.TextView;
public class WebLink extends Activity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textview = (TextView) findViewById(R.id.hyperlink);
Linkify.addLinks(textview, Linkify.WEB_URLS);
}
}
The TextView has the following qualities in the main.xml file:
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="#string/hyperlink"
android:id="#+id/hyperlink"
android:autoLink="web"
>
</TextView>
The strings.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WebLink</string>
<string name="hyperlink">http://google.com</string>
</resources>
That is how you give a working example of something. Next time don't assume that people can just piece together what you are mentioning in your answer.
How about using onClick in the XML layout file?
layout.xml
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:clickable="true"
android:text="#string/market_url"
android:textColor="#00f"
android:onClick="openURL"
/>
MyActivity.java
public void openURL(View v) {
String url = ((TextView) v).getText().toString();
final Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url));
startActivity(intent);
}