AS3/AIR: Finger-Scrolling a text document embeded within the app - android

I'm making my first mobile application on Flash/AS3 for both iOS and Android platforms.
It's been months now that I'm working on the project, and as a final step, I'm making a help document to explain to the fellow users how to use the application.
The problem is: The HELP document is an 8 pages long WORD document (also saved in PDF and HTML format), and I dicovered that displaying a local document (embedded within the app), with finger-scrolling enabled, is a harder task than I thought it would be!!
So far, my researches lead to the following solutions (without a 100% satisfaction though):
I. USING StageWebView or StageWebViewBridge:
I tried StageWebViewBridge on AIR Desktop, it works, and the hyperlinks inside the document work too.
But the display of some characters/letters in HTML file are distorted, and pictures are hard to display..
On android, displaying a local file simply didn't work.
On AIR iOS, I haven't tried it yet.
Also, I haven't figured out how to launch a PDF file using these classes.
Displaying local files on iOS and Android using these classes is a nightmare.
II. USING "scrolling" classes:
These classes enables the finger-scrolling of a movieClip containing text and pictures.
a. Free
a1/ airmobile scroll controller:
https://github.com/freshplanet/Air-Mobile-ScrollController
I gave this one a try, and what happenned was interesting:
First this class works, I created a MovieClip with a textField inside of it, I pasted my text, and with the help of this class, I was able to display the movieClip on screen and scroll it.
BUT, creating such a big movieClip (remember: 8 Pages!) created some unexpected issues.
The compiling time became oddly long, and my PC freezes for a few seconds during the compiling step.
The app starts now with a blank screen with 5 blinking tiny dots, and you'll have to wait for a few seconds before you can use the app.
Clearly, the idea of adding to the project library a huge MovieClip with such long text made the app development a nightmare.
Not to mention that pasting my text inside a movieclip textField makes me lose my text formating, my hyperlinks etc..
a2/ Erichlotto AIRScroll:
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
a3/ TouchScrolling:
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
b. With Charge
b1. Creative FLash Scroller
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
b2. AIR AS3 Touch Scroll
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
It is somehow frustrating that such an easy and common task (displaying a scrollable local document, in-app embedded for offline use) took me a few days of research (and without a definitive way to solve it).
I'm ready to settle with a class that makes a movieclip scrollable, but without the gigantic movieClip height.
Any ideas?
Thank you!

cannot answer this question, as it's too broad and too little detail, but I can give you some suggestions. a) StageWebView should work on iOS and Android with HTML and PDF with local files. Performance may be an issue. If you encounter a problem regarding local files, check if they are loading correctly. Post some code, if you need help there b) You may consider to open the file in an external "native" app as PDF Reader or Polaris Office. But this may require an Native Extension. c) converting into a movieclip seems to be a bad idea. TextField itself is capable of displaying HTML content, with limitations, though. You could consider to change your document to fit the needs of Flash/AIR rather than the other way round. Hope this helps...

To display local embedded files on Android with StageWebView you will have to copy these files from applicationDirectory to applicationStorageDirectory:
Refer to this article/answer:
https://forums.adobe.com/message/3485503#3485503
Since AIR 3.9 there is no other workaround on Android anymore.
There is a feature request here for it - please feel free to vote for it:
https://bugbase.adobe.com/index.cfm?event=bug&id=3832886

Related

Android chart library that's able to generate a PNG without showing the chart before that

Let's start with why do I want to do that:
The project my company's currently working in, involves the possibility to have one of our client's employee to go to the end of the world, with absolutely no way of having a connection to a mobile network, taking a portable printer with him, and print a report from his tablet. We currently have a working report already being printed this way, but they added a little detail that caused lots of trouble, which is the reason I'm here, I need to put 3 charts at the end of a Jasper report.
In a web application that would be extremely easy, since Jasper itself offer this functionallity, but since it's a mobile project, we tried using PDFReporter. This API generates a PDF from a .jrxml file, but it doesn't support every single feature from Jasper, and charts are one of them. Searching the web I've found that we could export a chart to a PNG and then add it to the report, which would work with PDFReporter.
Starting today by 8am I've spent my day searching and testing different chart-generating APIs, just to discover that, so far, 100% of the android APIs are meant to generate a chart directly on a view you specified on your activity, but that doesn't work for me at all.
I've also tested a few Java APIs, but got an issue there too, since most of them use java.awt resources to manipulate images, and that package is not included in android's SDK, nor is it supported (discovered that by adding JFreeChart to my project, which made my build take about 15 minutes and in the end fail with an OOM error).
So what I need help with is: is there an API I can use directly on a mobile project, with no connection whatsoever, that generates a pie chart as a PNG without having to render it on a view and just then fetching the Image?
I'd just like to make it clear that I'm NOT 100% sure about most of the things I've said above, except for the limitations of PDFReporter, those are confirmed, so please, any kind of help will be GREATLY appreciated, even a little "that's not how it works" will help.
Thanks in advance if you at least took your time reading it :)
I am not sure why you say "... generate a chart directly on a view you specified on your activity, but that doesn't work for me at all". Everything you see of your Android app is in some View anyway (in your case it would probably be an ImageView).
Do you just want to generate the chart as a PNG in memory and store it or manipulate it further? In that case, you could first generate it in a hidden ImageView using the API of your choice, then extract it using ImageView.getDrawable() for example. Assuming the API has no problem with the view being hidden. Maybe this helps

Hyperlinks working while viewing page from web browser on PC but not on Mobile (Android)

To begin, my web programming knowledge is very dated. I learned some html/java back in high school about 15 years ago and for fun have decided to put it to use and help a friend make an offline web based html database for a collection of his data that up until now he's kept in nothing but word and excel docs. So there is nothing fancy here. I'm mainly just formatting and linking pages. And make a ton of use out of tables. Lame, I know.
Anyway, here's the issue I've run into...
I'm pretty much done. I've just been going and fixing mistakes here and there. Grunt work. Every so often I've tried to display it on my Samsung Galaxy Note 2 and been rather pleased with the results. I'm not using any program that alters the display for mobile or anything. Just straight html/java with a bit of css I've started to learn while taking on this project. So sometimes I have to pinch to zoom and make the page fit on my mobile device, but I'm not too worried about it.
The problem I've come across is that a series of the pages with tables on them don't appear to work correctly. Each table has links to anchor points further down the same page. On PC, these links function properly. But for some reason on my phone when I tap on those links they don't respond at all. Not every page with tables has this issue I should note, only a small cluster.
All I'm using for code is an 'a href' tag in the table leading to an 'a name' anchor further down the page.
Any ideas?
You might be using HTML5, a tags don't have a name attribute.
try using:
id="titleofyourchoice"
instead of:
name="titleofyourchoice"

Android app in HTML

I've looked at this doc: http://developer.android.com/guide/webapps/webview.html
It seems it might be attractive strategy to use HTML/Javascript to get:
result faster (I can use my browser to create a prototype very quickly, just updating my page in the browser, and not waiting for emulator to be update my changes)
avoid to to learn Android API too deep (but use what I know HTML/CSS/JS instead)
reuse my code, putting it to iOS, BlackBerry (not only Android)
The only question I have.. Is whether someone already did it for real? Because tutorials that I've found - just show how to print 'Hello world!' message in simple HTML.
But what would be more interesting to get is 'how it works with embedded database' in android,
OR better say, as an example what I mean:
How to handle JS' "onClick" to get some data stored to db?
UPDATE:
Yeah.. there are a lot of PRODUCTS. But what if I need just a storage support (need to put and read data from db). no need anything sophisticated like camera support. What I really want to avoid is:
waiting for Emulator updated
write simple and easy components and layout in HTML to get instant result (it seems more natural for me, even though I'm Java Dev.. but it's lame to wait for result building and waiting when working with UI)
I'm looking for someone's existing experience to avoid addition complexity and time gaps between builds/tries while working with UI.
Look into Phonegap to convert HTML, CSS, and JS code into a native phone app for android or iOS. Very useful as it puts a web wrapper around the web code to run it natively on your phone. This should solve storage issues as well, lots of documentation around for phonegap, be sure to check it out!
I just released http://www.protocoder.org under MIT license, give it a try! Its meant to basically do what you mention in the first point (prototype fast), and on the second avoid to learn the Android API to deeply.
Its still a young project but I hope it will grow really fast :)

Create a Booklet like app in Phonegap

I am making a Book like app in Phonegap with Quiz... I want to keep 20 chapters for learning C. I am confused on how to use the single page architecture for such an app. I have also made a similar app for Android using JQuery Mobile and Android WebView before I was familiar with Phonegap but the application contained a number of (around 15 ) pages..and the Look & Feel was no more much native.
Any Suggestions on how to follow a single page architecture to create a book accessing its page contents from WebSQL for e.g. Chapter_title, page_heading, topic_contents ... and images if any.
Couple of months back I was in your situation. I experimented with jquery mobile, native application and phonegap. Building a web application at first seemed very attractive at first as the coding is a lot easier compared to native applications.Even though my answer is not very specific to your question it might be helpful to others. Here is my opinion based on my research:
Using phonegap slows your application responses, it loads slowly and together with jquery mobile the response and load time increases. So I didnot use it.
Using jquery alone was no different in Gingerbread mobile and on emulator you can clearly see the lag in switching between one div to another div. I didnot use it either.
What I did was android Webview. I wrote my own javascript and css and placed them on the section of my page. Used .... for changing pages on button click. This approach worked wonders for me and gave nearly native performance.
To follow the single page architecture in html use div element as I have mentioned in step 3 above. You can write a script to convert your WebSql data to json format. Then in your page where you need to call the data using javascript parse the data. Using json in really simple.

Android: Simple Display of multiple, flippable images

as a Java developer I have been tasked to develop a small application for Android. Basically, it should download certain images from a web source of ours, then display them. Usually, there are four images, the number will not change.
The download works fine, checking a version number, fetching the files, and they get sent to the application specific files directory.
Now, leaving the safe Java haven and sailing into Android waters, I find myself struggling alot. There's an almost impenetrable wall of incompatabilites, wrong information and bad or non-working examples.
I have found at least 15 examples for displaying images and switching between them. I've tested 5 so far, including a professional training DVD. Each and every one of those had at least one problem that made it impossible to continue. From not having an "R.styleable" to using varaibles where they are not available to implementations of inner classes that are different from the example.
As this could mostly be a problem of compatability and badly written information sources (I'm looking at you, developer.android.com), I'll try to ask you, the friendly guys of StackOverflow.
So far, I understand that by downloading the images dynamically, I need to use an Adapter that provides the images to the Gallery. I am using API level 7 or 8 (I've tried the most recent level, but the examples did not work there, as well), and I'm just looking for an example that will actually work.
Please help a fellow out. I really want to like the platform, as it's openness and community speak to my freedom-loving side.
You have done hard bit, this is easy. First you scan the folder and save file paths into an array. Then in a gallery view which gets its images from a custom BaseAdapter in getView you display them. At which stage do you get stuck?
Have you tried this: http://developer.android.com/resources/tutorials/views/hello-gallery.html

Categories

Resources