Simple Converter For Beginners - Android

View: 50    Dowload: 0   Comment: 0   Post by: daii   Category: Mobile applications   Fields: Game - Entertainment

0 point/0 review File has been tested

Download  simple-converter-for-beginners.zip (650.60 KB)

You need to Sign In to download the file simple-converter-for-beginners.zip
If you do not have an account then Sign up for free here

In this tutorial we will try to create a Simple Converter Using Android. Android is a widely-adopted open-source project. Android is an open source so that developer find it easy to develop and expand new features. Android is available to any devices such as TV, phones, watches etc. So now let's do the coding.....

Getting Started:

First you will have to download & install the Android Development IDE (Android Studio or Eclipse). Android Studio is an open source development feel free to develop your things.

Here's the link for the Android Studio https://developer.android.com/studio/index.html.

Layout Design

We will now create the design for the application, first locate the activity_main.xml and click text to view the script. Then copy and paste the code below.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="<a href="http://schemas.android.com/apk/res/android"
  3. " rel="nofollow">http://schemas.android.com/apk/res/android"
  4. </a> xmlns:app="<a href="http://schemas.android.com/apk/res-auto"
  5. " rel="nofollow">http://schemas.android.com/apk/res-auto"
  6. </a> xmlns:tools="<a href="http://schemas.android.com/tools"
  7. " rel="nofollow">http://schemas.android.com/tools"
  8. </a> android:layout_width="match_parent"
  9. android:layout_height="match_parent"
  10. tools:context="com.razormist.simpleconverter.MainActivity">
  11.  
  12. <TextView
  13. android:id="@+id/tv_foot"
  14. android:layout_width="wrap_content"
  15. android:layout_height="wrap_content"
  16. android:text="Foot"
  17. android:textSize="20sp"
  18. android:layout_alignBaseline="@+id/et_foot"
  19. android:layout_toLeftOf="@+id/et_inches"/>
  20.  
  21. <EditText
  22. android:id="@+id/et_foot"
  23. android:layout_height="wrap_content"
  24. android:layout_width="match_parent"
  25. android:layout_centerInParent="true"
  26. android:layout_alignParentTop="true"
  27. android:layout_marginTop="100dp"
  28. android:layout_toRightOf="@+id/tv_foot"
  29. android:inputType="number"/>
  30.  
  31. <TextView
  32. android:id="@+id/tv_inches"
  33. android:layout_height="wrap_content"
  34. android:layout_width="wrap_content"
  35. android:text="Inches"
  36. android:textSize="20sp"
  37. android:layout_alignBaseline="@+id/et_inches"
  38. android:layout_alignBottom="@+id/et_inches"/>
  39.  
  40. <EditText
  41. android:id="@+id/et_inches"
  42. android:layout_height="wrap_content"
  43. android:layout_width="match_parent"
  44. android:layout_centerInParent="true"
  45. android:layout_below="@+id/et_foot"
  46. android:layout_toRightOf="@+id/tv_inches"
  47. android:inputType="number"/>
  48.  
  49. android:id="@+id/btn_convert"
  50. android:layout_height="wrap_content"
  51. android:layout_width="wrap_content"
  52. android:layout_centerInParent="true"
  53. android:layout_below="@id/et_inches"
  54. android:text="Convert"/>
  55.  
  56. android:id="@+id/btn_clear"
  57. android:layout_width="wrap_content"
  58. android:layout_height="wrap_content"
  59. android:layout_centerInParent="true"
  60. android:layout_below="@+id/btn_convert"
  61. android:text="Clear"/>
  62.  
  63. </RelativeLayout>

Android Manifest File

The Android Manifest file provides essential information about your app to the Android system in which the system must required before running the code.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="<a href="http://schemas.android.com/apk/res/android"
  3. package="com.razormist.simpleconverter">
  4.  
  5. <application
  6. " rel="nofollow">http://schemas.android.com/apk/res/android"
  7. package="com.razormist.simpl...</a> android:allowBackup="true"
  8. android:icon="@mipmap/ic_launcher"
  9. android:label="@string/app_name"
  10. android:roundIcon="@mipmap/ic_launcher_round"
  11. android:supportsRtl="true"
  12. android:theme="@style/AppTheme">
  13. <activity android:name=".MainActivity"
  14. android:configChanges="orientation"
  15. android:screenOrientation="portrait">
  16. <intent-filter>
  17. <action android:name="android.intent.action.MAIN" />
  18.  
  19. <category android:name="android.intent.category.LAUNCHER" />
  20. </intent-filter>
  21. </activity>
  22. </application>
  23. </manifest>

The Main Function

This code contains the main function of the application.This code will automatically calculate the values of each Edit Text when Convert button is click.

  1. package com.razormist.simpleconverter;
  2.  
  3. import android.os.Debug;
  4. import android.provider.Settings;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.util.Log;
  8. import android.view.View;
  9. import android.widget.Button;
  10. import android.widget.EditText;
  11. import android.widget.Toast;
  12.  
  13. public class MainActivity extends AppCompatActivity {
  14.  
  15. EditText et_foot, et_inches;
  16. Button btn_convert, btn_clear;
  17.  
  18. @Override
  19. protected void onCreate(Bundle savedInstanceState) {
  20. super.onCreate(savedInstanceState);
  21. setContentView(R.layout.activity_main);
  22.  
  23. et_foot = (EditText)findViewById(R.id.et_foot);
  24. et_inches = (EditText)findViewById(R.id.et_inches);
  25. btn_convert = (Button)findViewById(R.id.btn_convert);
  26. btn_clear = (Button)findViewById(R.id.btn_clear);
  27.  
  28. btn_convert.setOnClickListener(new View.OnClickListener() {
  29. @Override
  30. public void onClick(View v) {
  31. String strCentimeter = et_foot.getText().toString();
  32. String strInches = et_inches.getText().toString();
  33.  
  34. if(!strCentimeter.equals("") && strInches.equals("")) {
  35. double foot = Double.valueOf(et_foot.getText().toString());
  36. double inches = foot * 12;
  37. et_inches.setText(String.valueOf(inches));
  38.  
  39. }else if (!strInches.equals("") && strCentimeter.equals("")){
  40. double inches = Double.valueOf(et_inches.getText().toString());
  41. double foot = inches * 0.0833333;
  42. et_foot.setText(String.valueOf(foot));
  43.  
  44. }else if(!strCentimeter.equals("") && !strInches.equals("")){
  45. Toast.makeText(getApplicationContext(), "Please clear the text field first!", Toast.LENGTH_SHORT).show();
  46. }
  47. }
  48. });
  49.  
  50. btn_clear.setOnClickListener(new View.OnClickListener() {
  51. @Override
  52. public void onClick(View v) {
  53. et_foot.setText("");
  54. et_inches.setText("");
  55. }
  56. });
  57.  
  58. }
  59. }

There you have it we successfully created a Simple Convert using Android. I hope that this simple tutorial help you to learn android in a basic way. For more updates and tutorials just kindly visit this site. Enjoy Coding!!

Simple Converter For Beginners - Android

Simple Converter For Beginners - Android Posted on 13-03-2018  In this tutorial we will try to create a Simple Converter Using Android. Android is a widely-adopted open-source project. Android is an open source so that developer find it easy to develop and expand new features. Android is available to any devices such as TV, phones, watches etc. So now let's do the coding..... 5/10 50

Comment:

To comment you must be logged in members.

Files with category

  • Beautiful and Simple Todo list iOS App

    Beautiful and Simple Todo list iOS App

    View: 15    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    TodoList is an iOS app for making todo lists. It uses core data to save the notes. The app is an excellent starting point to start learning iOS Application Development using swift and getting familiar with Model View Controller architecture. Liked...

  • E - Commerce

    E - Commerce

    View: 16    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    If you’re in a hurry, then E-Commerce App is the best option for you. Late delivery, cold food, no change, low quantity, or same old Dal or Pizza - we wanted to solve this madness for you. So we built a whole new App for you that is a single point to...

  • iSignUp - iOS 6 & Parse

    iSignUp - iOS 6 & Parse

    View: 18    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    Basic iOS 6 App created using Objective C & Parse as its Primary data storage..... Parse - ( www.parse.com ) *Features 1.basic C.R.U.D. Process 2.pushing from 1 UIViewController to other UIViewController 3.Populating/Fetching UITableView using...

  • UIAlertViews - iOS

    UIAlertViews - iOS

    View: 13    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    The UIAlertView class displays a blue popup box on the screen and the UIActionSheet causes a panel to slide up from the bottom of the screen.

  • iPhone with MapKit and the MKMapView Class

    iPhone with MapKit and the MKMapView Class

    View: 357    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    The MapKit Framework is based on the Apple Maps data and APIs and provides iPhone developers with a simple mechanism for integrating detailed and interactive mapping capabilities into any application. The core element of the MapKit framework from...

  • Upturn Task Reminder app

    Upturn Task Reminder app

    View: 27    Download: 1   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    Time management techniques say that it's better to keep track of tasks using a reminder system rather than your memory. Owing to intensive agenda, working person may have dozens of works and others tasks that should be done and it is normal that even...

  • Instagram Clone App (Android)

    Instagram Clone App (Android)

    View: 103    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    This is an Instagram Clone app for android phone. More information contact on: whatsapp :+918285672453 skype: nirbhay.success mail: nirbhayiise@gmail.com

  • Text To Speech Application in Android Eclipse (Pronunciation Made Easy App)

    Text To Speech Application in Android Eclipse (Pronunciation Made Easy App)

    View: 242    Download: 0   Comment: 0

    Category: Mobile applications     Fields: Game - Entertainment

    This Android application entitled Pronunciation Made Easy was programmed by my younger brother as his project for their mobile application development subject. This application aims to help individuals who have difficulties or questions on how to...

 
File suggestion for you
File top downloads
Codetitle.net - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.net Develope by Vinagon .Ltd