Sinhala Unicode – Sinhala Unicode Writer For Android

Screenshot_2014-09-08-14-50-36

Today I’m going to publish my brand new Android application called “Sinhala Unicode” .

This application will help you to type whatever you want in Sinhala just like you are typing an SMS.

Screenshot_2014-08-26-23-15-21

It is very easy and simple to use.All you have to do is type in your text with English keyboard, meantime app transliterates this text in to Sinhala for you Offline. After you type your post, status, email in Sinhala you could share it with your friends within app it self.

 

Screenshot_2014-09-08-14-51-16

 

As well as you can type both Sinhala and English words like below.

 

Screenshot_2014-09-08-16-46-22

Other than that there are more features…….

* Easy typing like sinhala sms
* Share on Facebook & Facebook Messenger
* Post to Twitter
* Send via Email, Bluetooth etc…
* Message a friend if device supports
* Supports both android phones and tabs.
* Supports both landscape and portrait moods.

You can download this application from Google Play Store for free . If you think this is useful for you do not forget to rate it and make comments.

Download Here

Google Maps Android API v2 – Current Location Example with GPS

Screenshot_2014-03-15-13-40-54

Today I am going to tell you how to work with Google Maps Android v2 . In here I will show you how to view your current location in Google Maps with GPS.

First of all you have to Add Google Play Service Library to your project because Google Map for Android is now integrated with Google Play Services. So we need to set up Google Play Service Library for developing Google Map application in Android.

Please follow the given below link to setup Google Play Service library in Eclipse.

How to setup Google Play Service library in Eclipse

This is how you add Google Play Service Library to your project

Screenshot at 2014-03-20 16:28:36

Next We need to get an API key from Google to use Google Maps in Android application. Please follow the given below link to get the API key for Google Maps Android API v2.

How to get API Key

then you are done with main steps. Now lets move to the coding part.

This is my Activity file >>>>>>>>>>>>>>


package com.madushanka.mylocation;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.madushanka.mylocation.R;

@SuppressLint("NewApi")
public class LocationActivity extends FragmentActivity implements LocationListener{
    private GoogleMap mMap;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (android.os.Build.VERSION.SDK_INT < 11)
		 {
			 requestWindowFeature(Window.FEATURE_NO_TITLE);

		 }
		else{
		ActionBar actionBar = getActionBar();
		actionBar.hide();}

        setContentView(R.layout.activity_location);

        loadMap();

        LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

        // Creating a criteria object to retrieve provider
        Criteria criteria = new Criteria();

        // Getting the name of the best provider
        String provider = locationManager.getBestProvider(criteria, true);

        // Getting Current Location
        Location location = locationManager.getLastKnownLocation(provider);

        if(location!=null){
            onLocationChanged(location);
        }
        locationManager.requestLocationUpdates(provider, 20000, 0, this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        loadMap();
    }
// this is method for create and load map with Support Map Fragment

    private void loadMap() {
        if (mMap != null) {
            return;
        }
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        if (mMap == null) {
            return;
        }
        mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
        mMap.setMyLocationEnabled(true);

    }

	@Override
	public void onLocationChanged(Location location) {
		 double latitude = location.getLatitude();

	        // Getting longitude of the current location
	        double longitude = location.getLongitude();

	        // Creating a LatLng object for the current location
	        LatLng latLng = new LatLng(latitude, longitude);

	        mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));

	        // Zoom in, animating the camera.
	        mMap.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);

	}

	@Override
	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub

	}
}

This is my Layout xml >>>>>>>>>>>>>>>>>>

<?xml version="1.0" encoding="utf-8"?>
<!--
See this page for more XML attribute options
https://developers.google.com/maps/documentation/android/map#using_xml_attributes
-->

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:map="http://schemas.android.com/apk/res-auto"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.SupportMapFragment"
          map:mapType="normal"/>




Next we have to add permissions , app key and openGl feature to app manifest.
This is my Android Manifest File >>>>>>>>>>>>>>>


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.madushanka.mylocation"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="18" />
    
    <permission
        android:name="com.maduzz.madushanka.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
 
    <uses-permission android:name="com.madushanka.mylocation.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
 
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.madushanka.mylocation.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.madushanka.mylocation.LocationActivity"
            android:label="@string/title_activity_location" >
        </activity>
        
         <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
             android:value="Your API Key Here"/>
        
    </application>

</manifest>


Now we almost finish. Next you have to enable GPS in the device from Settings.

This is a very simple example of Google Maps Android but you can get start from this example if it is helpful do not forget to make comments.

You can download and tryout this application from Google Play Store

Download My Location

Simple Game using C# – Arrow Key Event Example

g

Now days I’m learning C# there for I decide to tell you how to make simple game using C#.

In above picture you can see car and the background (road) if you watch the video example you can see the road is moving in order to move the road I used gif animation picture and as a car I used png image.

In here I’m using ProcessCmdKey() method to track the user input and change location of the car .

here is the code example >>>>


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SimpleGame
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // i want to hide the border of the car therefor i change the 
            // background of the car to tarnsperent
            // and locate the car top of the background image (Road)

            pictureBox1.BackColor = Color.Transparent;
            pictureBox1.Parent = pictureBox2;
       }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {

            if (keyData == Keys.Left) // Left arrow
            {
                // getting the current location of car and change the X parameter .
                // then set new location to picturebox

                Point cpoint = pictureBox1.Location;
                Point nw = new Point(cpoint.X-10, cpoint.Y);
                pictureBox1.Location = nw;

                return true;

            }
            else if (keyData == Keys.Right) // Right arrow
            {
                Point cpoint = pictureBox1.Location;
                Point nw = new Point(cpoint.X + 10, cpoint.Y);
                pictureBox1.Location = nw;

                return true;
            }

            else return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}