Android: Simple Display of multiple, flippable images - android

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

Related

Just starting Android Studio, I need guidance

I just decided today that I wanted to make a gallery app for my phone, pretty much just combine several features I like from different apps I've tried into one, perfect app, for me. The problem however is that although I know some java, took Programming 1 & 2 and currently taking AP Computer Science in high school, I have no idea where to begin. I roughly know and even less so understand the layout of Android Studio, but I can get by. I need help finding useful resources online to help me learn or even someone who is able to answer the probably many questions I have. I've watched some youtube videos and tried reading some tutorials but I haven't found anything that clears things up for me. I will ask a few questions now:
1.) I have no idea where to start or what to use to get the app to show images from device storage and micro sd card in a grid view. I have read things about using the RecyclerView to not use as much resources, and also something about Glide for better performance(I think thats what both those do, if I understand correctly) but I have no idea what to do with either or even how to use either.
2.) In the xml design portion I'm not good at navigating everything and understanding what I should use for what. I can make a good design in photoshop or other programs but I'm not sure how to actually take that vision and translate it into working pieces.
3.) Pretty much I just need help and will probably think of more questions as someone tries to answer those.
Thanks!
There are lots of good, free tutorials on the net. For example on the official Android Developer site: https://developer.android.com/training/index.html
- where you can find a lot of useful example code snippets, but there are other sites also - https://www.tutorialspoint.com/android/index.htm . It starts with the very basics and has lots of examples too.
Other non-free tutorials can be found at
udacity.com - Android Developer Nanodegree by Google
udemy.com
To reach data from your device storage or from your micro SD card you have to understand the principle working of content providers.
I do not recommend Recycle View, when you are a beginner, because it is a more complex thing than a List View (or Grid View). Start with these and then upgrade.
Glide is cool thing, because it saves you from a lot of useless coding and easy to use. On their GitHub page you find detailed instructions how to import it to your project - I recommend Gradle - and how to use it.
In my point of view, start reading one of the free sites patiently and than you are going to get answer for your questions, but it is very important to understand the basics.
I hope I helped! Sorry for my bad English, I used it a long time ago.

How to build OCR data for Android app with known layout and font

After trying several available eng.traineddata files with an Android app that employs Tesseract, I have less than stellar accuracy. Since my application will be using just a few fonts (font sizes, bold and regular), I thought I could get much better accuracy by building my own data. An example of the kind of thing (an 8.5x11 inch paper) that users will taking a picture of is here:
I have looked at jTessBoxEditor, but wondered if that was an appropriate path to investigate. And if so, I was unsure how to proceed with respect to a starting point, or to try from scratch. The font (which looks like Times New Roman) is very common, and didn't want to re-invent the wheel. I also wondered about how to treat the font on the two different color backgrounds.
Also, I wondered if I could just print-out ABC... abc... 123... in Times New Roman font and get that into a custom eng.traineddata file. If I understand correctly, you want the 'cleanest' data (i.e. no 'bad examples' of letters) in the source material used to train your system. But it would seem as if there would be a tutorial or procedure defined for how to build trained data for a specific font. If there is, it's been eluding me.
I would consider using machine learning, but so you don't have to do it on your own, look at Tensorflow Mobile. This is a version that is for mobile devices, and to help with character recognition you can look at this article.
To train any neural net a set of training data along with correct
outputs must be provided. In this case this will be a set of 128x64
images along with the expected output.
This will help you easily implement a solution to recognize the characters, and by going with this approach you can extend to more fonts if you desire by just doing more training.

Always connect to Webservice or local storage Android?

I'm developing a personal project with Android and struggling here with some doubts about the better way to develop it.
Well, my project consists of my app consuming a Rest Webservice (which I already developed with Java and Spring) and showing up a list of places on it. The thing is: This list could be huge, something like 2000- 3000 records with description and picture of each place.
I'm using volley and OKHttp to take care of my networking stuff, so far my list of places isn't that long, so everything is alright, but I'm afraid when the list starting to get big, I don't know how my app will handle this.
My questions would be:
1- Should I store the that list on my device and update the list every time I connect to the webservice?
2 - Am I doing correct, retrieving the entire list with just one request? If not, how's the best way to do it?
Thank you guys, I'm new to android stuff, and I'm developing everything by myself, don't have anyone experience around to ask that.
Cheers!
As mentioned in comments You need your app to do "paging" and to load some of the content every time you scroll down.
For example if you will open Facebook app and go over photos you will notice that the first ones always loading the fastest and as you keep scrolling some will be left blank for few moments, thats what paging is all about.
Make sure though not to overload the app with info, specially if you use bitmaps
You can read some good tutorials here

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

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

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

Categories

Resources