Tuesday, March 19, 2013

SecureIt

Well,

After a day of boredom over long weekend, thought of making an Android app.....

Earlier in 2009, once I thought of a security system based on Camera that catches images, compares it and sends SMS to predefined number if difference is detected.

Applications could be as simple as home security system when you are away...

Well, I made that stuff using ARM 7 processor in late 2009 but it was sort of a costly model considering, ARM, Camera and GSM modem.

So thought of making it for J2ME phones. Managed to make itin late 2011 but it used to work with selected phones only. Thanks to different Camera API.

So last week, spent a day to convert it in Android App. and it worked.....

Only stuff I struggled was in creating infinite loop....

Forgot to use simple thread stuff.... LOL

So, the app is working and available at Google Play :-)


https://play.google.com/store/apps/details?id=ind.zaki.android.tools.secureit


So download it guys and enjoy. Any suggestions/comments/feedback are welcome.

Tuesday, February 26, 2013

Simplest Android App

Here is one of the simplest Android App:

Temperature Converter - It converts Temperature from Degree Celsius to Degree Fahrenheit and vice versa.



Tha App can be found in Market at :


https://play.google.com/store/apps/details?id=ind.zaki.android.temp.converter



Here is the code:


Androidmanifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="ind.zaki.android.temp.converter"
    android:versionCode="2"
    android:versionName="2.0"
    android:installLocation="auto"
     >

    <uses-sdk android:minSdkVersion="10" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:label="@string/app_name"
            android:name=".DtoFActivity" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>





DToFActivity.java

package ind.zaki.android.temp.converter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class DtoFActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

((Button) findViewById(R.id.calculate))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {

final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);

final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);

if (!"".equals(degreesText.getText().toString())) {
fahrenheitText.setText(String.valueOf((Float
.valueOf(degreesText.getText().toString()) * 9 / 5) + 32));
}
}
});

((Button) findViewById(R.id.calculate2))
.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {

final EditText degreesText = (EditText) DtoFActivity.this
.findViewById(R.id.degrees);

final EditText fahrenheitText = (EditText) DtoFActivity.this
.findViewById(R.id.fahrenheit);

if (!"".equals(fahrenheitText.getText().toString())) {
degreesText.setText(String.valueOf((Float
.valueOf(fahrenheitText.getText()
.toString()) - 32) * 5 / 9));
}
}
});

}
}




main.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/background">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/degrees" />

    <EditText
        android:id="@+id/degrees"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="phone" >

        <requestFocus />
    </EditText>

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/fahrenheit" />

    <EditText
        android:id="@+id/fahrenheit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="phone" />

    <Button
        android:id="@+id/calculate"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Degrees to FahrenHeit" />

    <Button
        android:id="@+id/calculate2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="FahrenHeit to Degrees" />

</LinearLayout>