I am fairly new to the Android Development. I am just learning all about it but thanks to my web programming background it is being really fast.
I have a question about webviews. When I have a simple component (like a chart) but hard to draw with Java I am building it with HTML and CSS and using it as a webview.
My question can look like opinion based but I am asking this in terms of performance.
I am wondering, how is having couple of simple webviews affects performance? I know that there is libraries almost for everything but importing a big library for a simple chart or something else seems like an overkill to me when I can make it with ~50 lines of HTML and CSS code.
Which one is more powerful? WebView or importing libraries for everything?
I guess importing libraries are much better for performance because those are you know stored locally whereas mostly web-views are very slow and unresponsive but if you don't have technical skills to work with library you can go with webview but in future try to use any library or you can take help of youtube there are lots of videos which teach you how to do
Maybe video like this
https://www.youtube.com/watch?v=qWBA2ikLJjU
Related
I'm developing a flow chart drawing tool for Android and even though it has been a month I still couldn't find a good, reliable graphics library to help me develop this app.
Here are a few things I tried:
1-) Android views. Since a flowchart would naturally include lots and lots of shapes, this option wasn't satisfactory in terms of performance. Plus, I didn't even know how to draw arrows.
2-) Canvas. It was quite good when it comes to performance but canvas does nothing more than coloring pixels, so I can't go back to editing them after placing a shape on the screen.
3-) Now I'm working on Qt to see if I can achieve my goals and so far it seems as though it's very doable but using a cross-platform development software for only Android doesn't make a lot of sense.
4-) Libgdx and Unity are also options but using a game engine for such a lightweight app didn't seem like a very good idea to me.
Can you suggest me a good library or any other development tool?
There is https://github.com/mocircle/cidrawing library. Maybe useful for this type of task with link to https://github.com/Team-Blox/GraphView library.
Hope it helps.
So I have a project for school, and they have not taught us android studio in the least and I have little experience with Javascript. I have looked at countless YouTube tutorials trying to figure my way out.
The project requires me to develop an android application that communicates with an ELM327 adapter. I am allowed to use open source software. I would like to take this: https://github.com/pires/android-obd-reader
and improve the layout as well as add some additional features such as live graph plotting and live gauges.
The first thing I'd like to do is change the layout to a tabbed layout rather than the layout the app currently has. Can anyone assist me in the best possible way to begin doing this? I am reading as much as I can but seem to be making no progress.
I have a great idea for an Android app, but as I'm only familiar with php/js, I'm uncertain of which approach I should choose for creating it. The app will be based on a google map with a lot of position markers. There won't be any fancy animations or other heavy resource-demanding activities.
As I see it there are three different options:
Read up on Java and program the whole thing in Java
Create the map activity in Java as a mapview and then use webviews for the other activities (which can easily be scripted as html5 webpages.)
Script everything as a webapp (not really an option, as this is not a real mobile app imho.
I'm most keen on using no. 2 as I'm quite familiar with html/php/js/mysql. Have to read up on the html5 specifics, though. Questions:
I need access to GPS and camera hardware. Is that acheivable in webviews?
How complicated is it to pass variables between js in webview activities and java in other activities?
How big a difference in performance can I expect if I use option 1 vs option 2?
Other thoughts?
Kind regards,
Anders
You can choose number 2, but as we are talking about an android phone, you might want to get really accurate coordinates for your map, and you can only achieve this by accessing your phone GPS, through webviews the best you can get is the location trought the device internet IP adress, wich doesnt lead to a very accurate geo position.
The best choice is a 100% java application in my opinion.
1) Yes it's possible, but as commented it will be less accurate and probably slow.
2) Not complicated. Painful if you need loads of interaction between a webview and native app. Using a Javascript Interface that can be set up from the native app. You can basically inject javascript in a webview's html.
3) Heterogeneity of performance depending on device. Because your implementation will be based on the device's browser you can expect to get really sluggish behavior for older devices. Anything to do with HTML events (Dragging, Tabbing...) will have a knock on most devices, from my experience.
4) As #vodich comments there are other party frameworks. My benchmarking on PhoneGap and other js-based options is that they're a waste of time if you are looking at developing a professional app. I haven't developed on Adobe AIR but find a pain the need to be installing plugins to get native functionality (access to sensors, camera, etc) Mobile is all about fast, responsive behaviour. HDI is your finger, user is fast, so app needs to be fast.
EDIT: So hell yeah! Java FTW!
Albert.
4.Other toughts?
Yes, if you really want to make a great Android app, you should be using only Android and specific Android UI components, and give it a native look and feel. And regarding 1,2 yes it is possible, I would say not so complicated to just integrate them, but I think you'll eventually get in big problems.
Learn Java and write your application natively.
Webviews might allow you to use your php skills to present something to the user, but it's entirely one-way - you'll not be able to interact with what's inside.
The Android developer site offers fantastic documentation and jumping from PHP to Java isn't greatly difficult, though you'll need to get used to strict typing and "real" OOP.
Other thoughts? Don't go down the PhoneGap/Cross platform toolkit road - it might allow you to write applications for multiple platforms and using your current skills, but in the end you get a subpar app that doesn't feel right on either platform and doesn't fair well as future versions of iOS and Android are released.
Good afternoon.
I hasten to add that I am new to developing for Android. I am writing a geolocation service (application).
Standard elements of the user who provides Google does not suit me. In many of the Internet once faced with information which says that you can write a user interface for Android using CSS and html.
After reading a lot of information on this topic, I realized that Most developers tend to use frameworks (PhoneGap. ..). But this approach does not suit me, for two reasons:
javascript - it is used everywhere, and I do not know
This absence of adequate (understandable) documentation or guides for frameworks.
It is for these reasons that I'm wondering whether it is possible to write the user interface using html and CSS, and all the features in Java without using frameworks.
As communication between fallback interface and native code, even with the assistance of javascript, but without the use of frameworks.
P.S. I am not good in English - I hope you have understood the point of my question. I hope for your help.
Normally an Android app defines UI in Android-specific XML and the code is in Java or, if really necessary, C/C++.
Probably you could use a WebView in your Android application which will display an html page from your assets directory.
Such html page can have javascript in it which will invoke some hooks in your code. It's described in the book The Busy Coder's Guide to Advanced Android Development Chapter 1, I believe
yes you can.
your html+css will all be in a webview and there're elements like the webview client that can communicate with what's inside the webview.
But I would like to leave you with a warning:
Every single web based app IS slower and with a poorer interface than proper native apps. Also, without the use of a framework you still will have to know a good portion of the native stuff.
I want to make some 2d games that I may want to submit to a game site, such as newgrounds.com. Even if I decide not to submit, I'd still like to know which is a better choice.
Which has a faster startup time?
Which performs faster in a 2d game?
Which IDE should I use?
Thanks in advance!
EDIT:
Also, a couple more quick questions.
I have used xna quite a bit, and silverlight a little. Where do I get started with flash? And what 2d libraries do i need? Also, is flash going to be anything like xna with an update loop and a draw loop?
The de facto standard for browser games is Flash. While there are game submission sites like ArcadePod.com that accept Java, most (including Newgrounds) are Flash exclusive.
Notably, Adobe Flash Pro and Adobe Flash Builder both cost $700.
Performance-wise and deployment-wise, Java using JOGL is probably the best I've seen in a browser.Check this out: https://jogl-demos.dev.java.net/applettest.html
That said, Flash and HTML5 should be hardware accelerated... at some point in the future. We should be seeing some very nice DHTML5 graphics libraries very soon. Combined with more Javascript-targeting compilers like GWT, I'm guessing that this is where we'll be seeing much game development in the future.
Definitley Flash over Java for in browser. Silverlight is also decent. Don't expect Flash or Silverlight to perform as well as XNA, as XNA makes use of the GPU with programmable shaders etc.
I recommend using FlashDevelop if you don't want to pay for any tools.
Realtime games in Flash use a loop. There are two ways of achieving this. The first is to create a Timer object and create a listener for it. The second is to listen to an ENTER_FRAME event (which is dependant on the Framerate you set). I personally use the second way of doing it. Since you can not guarantee the framerate its good practise to use a time delta to adjust values.
The best thing about Flash is there are a lot of mature engines out there, I will only focus on 2D ones here.
For physics, Box2D is the way to go, its a port of the C++ Box2D engine. Very powerful.
For keyboard input grab this class: KeyPoll
Depending on the type of game, the as3 game engine fixel might be useful
As for rendering, the simplest way is to use Sprites and Movieclips. You can draw programmatically, or if you use Adobe Flash Pro you can draw them by hand. An alternate way to render is to create a bitmap object and draw pixels to it.
I think it would be worth investing in a good book. For learning ActionScript3.0 everyone recommends Essential ActionScript 3.0 by Colin Mook.
For games development: Foundation Actionscript 3.0 Animation:
Making Things Move! and AdvancED ActionScript 3.0 Animation by Keith Peters are great. You can find his blog at Bit-101
And last but not least, a fairly new book The Essential Guide To Flash Games looks great but I have not read it yet.
Also if you search stackoverflow you will find similar questions about learning AS3 with links to online resources.
JavaFx is a very upcoming technology in developing both 2D/3D games and infact it gives same effect as Flash.you can have its libraries and inbuilt support IDE in Netbeans IDE.
I have developed both in Java2d/swings/graphics and Flash. Flash uses VECTOR Graphics which has a very good output irrespective of any screen resolution. Plus it will become fun and easier to design objects in flash rather doing everything by coding in Java.
That does not mean that you have everything ready in Flash. You still have to work with Actionscripts which obviously involves coding but it will be really fun once you learn it. You can always post your problems in this community where you have nice support for any actionscript related issues.
All the best!
If you are building a game, mass outreach is more important than any of the factors listed. Far more people have flash installed than JRE/Java Plugin, So I would advise you to go with Flash. Of course performance matters a lot, but getting people to play is more important.
For flash games, you can use Adobe creative suite or flex.
BTW, another good game development platform is MS silverlight, but thats out of the question too. It has even lesser market penetration than Java
Flash is better suited to 2D graphics rendering, was made for the browser environment, everyone has it installed and it's easier to learn than Java IMHO.
Here is a good way to get started looking for good libraries, although to be honest, Flash comes built-in with everything you "need", per se.
22 ActionScript 3.0 API's
Also, don't leave home without your API Documentation!
I'll try to dig through my history of API's and apps; it's been a while since I dabbled in AS3, but those were some nice times.
The sites you are looking to submit to will most likely take flash games over java versions.
I would recommend picking up flash its self and actionscript 3.
You may also want to pick up a free copy of the PushButton game engine which will take a lot of your development time away and allow you to focus more on actually building the games and not so much on getting the physics and collisions etc working.
http://pushbuttonengine.com/
In terms of user accessibility, I suggest flash.I believe it's easier to develop 2d games in flash...