Detect if Android or iOS within Flex Mobile application

Sometimes there is a need when you need to detect what environment your Flex mobile application is running. Common scenario with my projects is to launch a Link to PDF to a external browser rather than using StegeWebView which is built in to Flex SDK. There could be many other scenarios that I can think of but it depends on the Application writer why and when its required Here is the code snippet that will help ya out public function getOS():String { [crayon-651e271f9fd9b637127329/] [crayon-651e271f9fda0041719713/] [crayon-651e271f9fda1106192961/] [crayon-651e271f9fda2578085740/] [crayon-651e271f9fda3687141682/] [crayon-651e271f9fda4516971277/] If you would like to add anything to the above code please leave a comment.   Cheers   .   … [Read more...]

Changing default browser in Android Devices

I have tested this on Samsung Galaxy S but the instruction should apply to all other devices out there. Download the file below, Dont worry its not a virus :), the size of the file is 1 Byte. {filelink=3} or if you do not want to download the file below then follow the instructions below open notepad type "hello" save it as "default.html" somewhere on your computer where you can remember the path. Now transfer the above file that you created or the downloaded one to your Android phone or tablet. Remember which folder you copied it to. Now Follow the instructions below Open File Manager App in your Android phone Navigate to the folder to which you have copied above file to Now Click on default.html file. you will be asked what application you would like to use to open the above file. Choose the already installed new browser and remember to check "Set as default" checkbox Groovy you are good to go. Default browser changed :). You can do this to many supported file extensions. Hope this helps Cheers … [Read more...]

Android How to Open Pdf file within the browser

So today was the day I found out how :) with lot of google and bing surfing. Its only a workaround not a actual fix according to me but is good enough for till the actual support comes up. wont take too much space to explain but let me tell you one thing. At this moment even with Android 3.2 the default browser do not have in built support for opening PDF files within the browser. Consider you are a student studying full time and have all your lectures delivered to you in PDFs. What now? Oh yeah! download them all and read them one by one. That works but over the time your PDF files accumulate and after some time it become impossible to look to certain PDF for THAT content. This sort of functionality should be default as it is with Safari browser on iOS devices Lets see a work around that I found Follow these steps Download Dolphin Browser from the Market Install it. Now Download PDF reader plugin for Dolphin Install it There you are, good to go Direct your browser to an HTML page with a PDF link. Click on the PDF link now, the file should in the same browser instance. Catch here is that Pdf plugin for Dolphin browser use Google Docs to read and open the PDF files. Smart! I've tested it on my Samsung Galaxy Tab and Samsun Galaxy phone II. This technique should work across all other Android enable phones aswell if you set if up properly. I hope this helps guys! Cheers … [Read more...]

Flash Builder java NullPointerException when debugging

Well I like working Flash Builder as an IDE but there are some times when it gives weird things. This happened to me last week so I thought I should share. Now it gets frustrating when I try to debug my in development App and It always gives me NullPointerException In my case it turned out to be  XML service for my website feed that i created to display news on the App I am developing. After I removed the service the debugging started as per normal. Now I am not sure why would this be the case and why FB fail to register XML service in debug mode. I guess I may be doing something really wrong somehow and somewhere I am running Flash Builder for PHP 4.5.1. Another thing i observe sometimes is that the service you create (PHP) becomes corrupted altogether, no matter what you do, you'll have to remove that service and re-add it to make things work. But sometime even deleting the service won't work. I'll discuss in my next post about how to go about removing the service if your IDE doesn't help. Leave a comment if You'ld like to add something to my experience. Cheers   . … [Read more...]

How do you persist data between Flex Mobile Views

Well simple answer to this is that you got few ways to do this. lets see a few of them to start with in you main application tag add persistNavigatorState="true"  so that it looks like below code snippet. When persistNavigatorState is set to true, your application will save the state of your Views and data to a Local Shared Object which by no means is encrypted. You have to write your own custom persistentManager by implementing IPersistenceManager interface. [crayon-651e271fa02d2168497431/] this tell the mobile environment to start persisting View data. but remember that once you pop out of view that View is destroyed completely. but the Views that are the the stack should be set destructionPolicy to never so that you View element looks like this [crayon-651e271fa02d5126781679/] [crayon-651e271fa02d6758557070/] [crayon-651e271fa02d7815419205/] [crayon-651e271fa02d8554508089/] persistenceManager.setProperty("myStoredProperty","myStoredVal"); // setup custom property:myStoredProperty persistenceManager.getProperty("myStoredProperty"); // retrieve the value of custom property:myStoredProperty [crayon-651e271fa02d9482416185/] [crayon-651e271fa02da418152169/] [crayon-651e271fa02db719255202/] [crayon-651e271fa02dc458458929/] [crayon-651e271fa02dd794485955/] [crayon-651e271fa02de648700846/] [crayon-651e271fa02df095354908/] [crayon-651e271fa02e0873813104/] … [Read more...]

How to: Flex Mobile Grouping radio buttons and getting the value of selected one

Question: How to Group Radio Buttons in Flex Mobile app and get value for the selected One? When I was messing around with my first mobile app I was lost when working with Radio buttons. I asked above question to myself. so lets find out how this is done. First create radio buttons for you app. put them where ever you like inside the view tag [crayon-651e271fa0539288809153/] [crayon-651e271fa053c494513015/] [crayon-651e271fa053d748245439/] [crayon-651e271fa053e610439119/] [crayon-651e271fa053f919945960/] [crayon-651e271fa0540095615763/] [crayon-651e271fa0541736708729/] [crayon-651e271fa0542153461725/] [crayon-651e271fa0543460312757/] [crayon-651e271fa0544111251278/] [crayon-651e271fa0545623223153/] [crayon-651e271fa0546202787874/] [crayon-651e271fa0547974623616/] [crayon-651e271fa0548605334579/] protected function getRadioValue():String { [crayon-651e271fa0549001455949/] return rbg.selectedValue.toString(); [crayon-651e271fa054a300913947/] } [crayon-651e271fa054b979826393/] [crayon-651e271fa054c072485374/] [crayon-651e271fa054d946582717/] There are other things that you can do but it all depends on individual need.   [crayon-651e271fa054e161685297/] [crayon-651e271fa054f177531064/] [crayon-651e271fa0550749629385/] [crayon-651e271fa0551074499104/] … [Read more...]

Rounded Corners For Flex Mobile Application’s List/ListForm

This technique is applicable to probably any component that is on the Mobile phones screen inside a group. Lets take a look how to do this I am using Flash Builder 4.5.1 for this exercise. First create a project called roundedcorners, In your Mobile settings check either Android, Apple iOS or BlackBerry > Select View Based application > Click Finish In the roundedcornersHomeView.mxml file you will see code similar to this [geshi lang="actionscript3" nums="1" ] [crayon-651e271fa082f196732503/] Now add a rectangle to the above code shown below [geshi lang="actionscript3" nums="1" highlight="7" ] [crayon-651e271fa0833135982576/] [crayon-651e271fa0834429360857/] Lets add a List Control to our little app now as shown below [geshi lang="actionscript3" nums="1" highlight="39" ] [crayon-651e271fa0836508845746/] [crayon-651e271fa0837137286022/] Above code just had one problem with padding and margins, when you scroll your list the the List item are visible in the Gap between ActionBar and Rect border. To fix that try these margin and padding settings [crayon-651e271fa0838339323075/] [crayon-651e271fa083a578220887/] Run this application now and you will get lovely rounded corners for your Mobile View. Adjust padding as per liking.     This final result is shown below Hope this helps Download project files by clicking this link roundedcorners Flash Builder project … [Read more...]

AIR for Apple iOS Support in Flash Builder is not installed

I recently came across this error when starting a project in Adobe Flash Builder 4.5. This error is mainly due to the either if iOS support was not installed with your Flash builder or you are using a incompatible Fled sdk, AIR version with Flash builder. e.g. Flex SDK 4.6 is incompatible with Flash builder 4.5.x. As mentioned somewhere on Adobe's website that iOS support will be introduced soon i.e. with Flex SDK 4.5 onwards and they did that. I was so excited to start off my new project but when I tried to run/debug my application choosing iOS environment i got this error AIR for Apple iOS Support in Flash Builder is not installed Now where to go from here? I searched google for it and find out an article on Adobe KB These are the steps that you follow as per this article Install the components required to enable AIR for Apple iOS Support manually Download the Adobe AIR SDK from www.adobe.com/products/air/sdk/. From the downloaded AIR SDK, copy the folders \lib\aot\lib\gcc, \lib\aot\bin\as, and\lib\aot\bin\strip to the equivalent folders within the Flex SDK directory as follows: Copy from AIR SDK directory  To Flex SDK directory* \lib\aot\lib\gcc Adobe Flash Builder 4.5 Installation\sdks\4.5.0\lib\aot\lib \lib\aot\bin\as Adobe Flash Builder 4.5 Installation\sdks\4.5.0\lib\aot\bin \lib\aot\bin\strip Adobe Flash Builder 4.5 Installation\sdks\4.5.0\lib\aot\bin *Note: If you have installed the Flash Builder 4.5.1 update, copy the files to the Flex 4.5.1 SDK directory. From the downloaded AIR SDK, copy the folders \lib\aot\lib\gcc, \lib\aot\bin\as, and \lib\aot\bin\strip to the equivalent folders within the Utilities directory as follows: Copy from AIR SDK directory  To Utilities directory* \lib\aot\lib\gcc Adobe Flash Builder 4.5 Installation\utilities\ipa_packager\lib\aot\lib \lib\aot\bin\as Adobe Flash Builder 4.5 … [Read more...]