Sunday, June 8, 2014

Calling Javascript from Android Java coding

In Android application, WebView is the component for display web pages. As Hybrid application are popular now, there are needs of calling javascript method from Android Java coding. We can do this by implement the addJavascriptInterface method in WebView.

The following example demonstarte this:
Step 1: Create a new Android project "JavascriptDemo" in Eclipse. A html web page is created in the assests directory.



Creating 4 different Tween Animation effects

Android platform facilitates three different types of animation you can define in your application resources: property, tween and frame. In this example, we show you how to do 4 different tween animation effect.


Wednesday, May 28, 2014

Simple Android Database Application

Today we are going to build a simple database application in Android. First see the project resources screenshot indicated below.




Android Login System using SQLite

I have already written several posts regarding Android database applications. This post might be similar to those tuts. However this is more complete Android Login System which uses SQLite as its database. All files can be downloaded here.


Android Session Management Using SharedPreferences

In this example creating login page fuctionality and save user data as like in session. After loging user will redirect to login screen and after back button click do not show login page. Using shared preferences to save and get user data globally through out the application


Share With Intents

[This post is by Alexander Lucas, an Android Developer Advocate bent on saving the world 5 minutes. —Tim Bray]

[Please join the discussion on Google+.]



Intents are awesome. They are my favorite feature of Android development. They make all sorts of stuff easier. Want to scan a barcode? In the olden platforms, if you were lucky, this involved time and effort finding and comparing barcode-scanning libraries that handled as much as possible of camera interaction, image processing, an internal database of barcode formats, and UI cues to the user of what was going on. If you weren’t lucky, it was a few months of research & haphazard coding to figure out how to do that yourself.

Saturday, May 24, 2014

Accelerometer Basic Example - Detect Phone Shake Motion

In this example detecting Accelerometer Motion, when Accelerometer force value cross thersold showing an alert for motion detected.

Use:

  1. You can use this example in games based on Accelerometer Motion (Phone Tilt).
  2. You can use this example for battary consumption when using GPS Calls. Combine Screen Wake Sleep Example with this example to consume less battary when calling GPS calls.Later We will give combined example to consume less battery.


Note:


Check this example in real device.

Project Structure:



The ABCs of Android game development: Detect collisions

In the fourth installment of his five-part app developer series, William J. Francis provides the code to be able to detect when the asteroid and the ship collide in this Android game.


The goal of the Android game we are developing in this series is to adjust the flying saucer’s momentum in order to avoid getting smashed to bits by the asteroid. While simplistic, the project incorporates all the essential aspects of a video game: a canvas, sprites, animation, collision detection, and user input.

In our last tutorial we managed to get our sprites moving around the screen. (If you're new to this series, catch up on parts one and two, respectively: Prepare the canvas and Load and display sprites.) Now we need to be able to detect when the asteroid and the ship collide. There are basically two techniques for collision detection: bounding algorithms and image masking. Bounding is easier and takes up fewer CPU cycles than image masking; however, bounding is not normally accurate enough for arcade type games. Just what is the difference? Well, consider our two images. I have them both on a 50x50 pixel background, but the contents of those sprites don't fill the entire 50x50 pixel grid. Take a look at the illustrations in Figure A and Figure B.

Figure A


Friday, May 23, 2014

Intro to Collision Detection: Collision Detection Basics



In this lesson, we will be discussing a few methods of collision detection and how one would go about implementing them.

What exactly does collision detection describe?
To put simply, collision detection is a way of checking for object interaction.

In most real-time games (both old and new), collision detection is an integral element that holds everything together. As such, a poor collision detection system can make the gaming experience painfully frustrating and, in worst scenarios, may even "break" your game.
No one likes broken games.

You should make every effort to implement as fluid and accurate a collision detection system as needed by your game.

Delete row in SQLite database

android.database.sqlite.SQLiteDatabase class provide a convenience method for deleting rows in the database.