Fundamentals
Introduction
1st Android Application

OOPS Concepts
Class
Object
Abstraction
Encapsulation

Polymorphism
Inheritance
Message Passing
Dynamic Binding

UI Controls
TextView
Button
Toggle Button
CheckBox
Radio Button
Spinner
ProgressBar
SeekBar
RadioGroup
RatingBar
Switch
EditText
AutoComplete
TextView

MultiAutoComplete
TextView

ImageView
ImageButton
Gallery
MediaPlayer
VideoView
MediaController

TimePicker
DatePicker
CalendarView
Chronometer
Analog Clock
Digital Clock

Layouts
LinearLayout
RelativeLayout
GridLayout
TableLayout
FrameLayout
Fragment

Composite
ListView
ExpandableListView
GridView
ScrollView
SearchView
Sliding Drawer
Tab Widget
WebView

Transitions
Image Switcher
StackView
TextSwitcher
ViewAnimator
View Flipper
View Switcher

Advanced
Request Focus
View
View Stub
TextureView
Gesture Overlay View

SurfaceView
NumberPicker
Zoom Button
Zoom Controls
AbsoluteLayout

Database
SharedPreference
SQLite DB
MySQL DB

Webservices
Check HttpURLConnection
Single Webservice Call
Multi Webservice Call
ListView from Webservice
SQLite from Webservice
Data from Database

Telephone Manager
IMEI
IMSI
Phone Type
Sim Type
Network Type

Content Providers
Contact Provider
BookMark Provider
Own Provider


Message & Networking
Send SMS
SMS with Reports
Group SMS

Send E-Mail
Download Binary Data


Location Based Service
Display Google Map
Events with Google Map

Android Services
Create Service
Create Longtime Service

Asynchronous Task
Repeating Services
IntentService

Activity from a Service
Bind Activity to Service


Sample Projects
HMS
CNB
Login Screen
Camera Event
Browse Option
QR Code Events
Accelerometer Sensor
EditText from Spinner

Android Sample Projects - Handle Mathematical Solution


Note                     Download ADT Plugin Here.
Here I am using,
OS : Linux (Ubuntu 12.04)
Eclipse : Juno (Version 4.2.0)
Android API Level : 3 to 'n' as per need
Emulator API Level : It will be displayed in output image


Here i developed one Android Application to solve mathematical solutions automatically in simple manner. HMS deals with Factorisation, Differentiation, Integration & Linear Equation..

Step 1 : Select File -> New -> Project -> Android Application Project (or) Android Project. Fill the forms and click "Finish" button. If you have any doubt regarding create a new project Click Here.

Step 2 : Open res -> layout -> activity_main.xml (or) main.xml and add following code :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
 
    <TextView
        android:id="@+id/textView1"
        android:textSize="20dp"
        android:textColor="#4169E1"
        android:gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="60dp"
        android:text="Handle Mathematical Solution in Android" />
 
    <TextView
        android:id="@+id/textView2"
        android:textSize="18dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="64dp"
        android:text="Select your Chapter below" />
 
    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView2"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="50dp" />
 
</RelativeLayout>

Step 3 : Open res -> layout -> factorisation.xml and add following code :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    
    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        
        <TextView
	        android:id="@+id/textView1"
	        android:text="Factorisation"
	        android:textSize="20dp"
	        android:textColor="#4169E1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_alignParentTop="true"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <TextView
	        android:id="@+id/textView2"
	        android:gravity="center"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <EditText
	        android:id="@+id/editText1"
	        android:hint="Enter Co-efficient of x^2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="32dp" />
	    
	    <EditText
	        android:id="@+id/editText2"
	        android:hint="Enter Co-efficient of x^1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/editText1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
	    
	    <EditText
	        android:id="@+id/editText3"
	        android:hint="Enter Co-efficient of x^0"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/editText2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <Button
	        android:id="@+id/button1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/editText3"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="32dp"
	        android:text="Get Solution" />
 
	    <TextView
	        android:id="@+id/textView3"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/button1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="32dp"
	        android:text="x1" />
	    
	    <TextView
	        android:id="@+id/textView4"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView3"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="32dp"
	        android:paddingBottom="30dp"
	        android:text="x2" />
	    	            
    </RelativeLayout>
 
</ScrollView>

Step 4 : Open res -> layout -> differentiation.xml and add following code :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    
    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        
            <TextView
	        android:id="@+id/textView1"
	        android:text="Differentiation"
	        android:textSize="20dp"
	        android:textColor="#4169E1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_alignParentTop="true"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <TextView
	        android:id="@+id/textView2"
	        android:gravity="center"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <EditText
	        android:id="@+id/editText1"
	        android:hint="Enter 'n' Value here"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
	    
	    <Button
	        android:id="@+id/button1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/editText1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:text="Gooooooo" />
	    
	    <LinearLayout 
	        android:id="@+id/linear1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:orientation="vertical"
	        android:layout_centerHorizontal="true"
	        android:layout_below="@+id/button1"
	        android:layout_marginTop="30dp" >
	        
	        
	        
	    </LinearLayout>
	    
 
	    <Button
	        android:id="@+id/button2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/linear1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:text="Get Solution" />
 
	    
	    <LinearLayout 
	        android:id="@+id/linear2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:orientation="vertical"
	        android:layout_centerHorizontal="true"
	        android:layout_below="@+id/button2"
	        android:paddingBottom="50dp"
	        android:layout_marginTop="30dp" >
	        
	        
	        
	        
	    </LinearLayout>
	    	            
    </RelativeLayout>
 
</ScrollView>

Step 5 : Open res -> layout -> integration.xml and add following code :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    
    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        
            <TextView
	        android:id="@+id/textView1"
	        android:text="Integration"
	        android:textSize="20dp"
	        android:textColor="#4169E1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_alignParentTop="true"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <TextView
	        android:id="@+id/textView2"
	        android:gravity="center"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <EditText
	        android:id="@+id/editText1"
	        android:hint="Enter 'n' Value here"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
	    
	    <Button
	        android:id="@+id/button1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/editText1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:text="Gooooooo" />
	    
	    <LinearLayout 
	        android:id="@+id/linear1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:orientation="vertical"
	        android:layout_centerHorizontal="true"
	        android:layout_below="@+id/button1"
	        android:layout_marginTop="30dp" >
	        
	        
	        
	    </LinearLayout>
	    
 
	    <Button
	        android:id="@+id/button2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/linear1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:text="Get Solution" />
 
	    
	    <LinearLayout 
	        android:id="@+id/linear2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:orientation="vertical"
	        android:layout_centerHorizontal="true"
	        android:layout_below="@+id/button2"
	        android:paddingBottom="50dp"
	        android:layout_marginTop="30dp" >
	        
	        
	        
	        
	    </LinearLayout>
	    	            
    </RelativeLayout>
 
</ScrollView>

Step 6 : Open res -> layout -> linear.xml and add following code :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    
    <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        
            <TextView
	        android:id="@+id/textView1"
	        android:text="Linear Equation"
	        android:textSize="20dp"
	        android:textColor="#4169E1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_alignParentTop="true"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <TextView
	        android:id="@+id/textView2"
	        android:gravity="center"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
 
	    <EditText
	        android:id="@+id/editText1"
	        android:hint="a1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_toLeftOf="@+id/editText2"		
		android:layout_marginRight="30dp"
	        android:layout_marginTop="30dp" />
	    
	    <EditText
	        android:id="@+id/editText2"
	        android:hint="b1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp" />
	    
	    <EditText
	        android:id="@+id/editText3"
	        android:hint="c1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_toRightOf="@+id/editText2"		
		android:layout_marginLeft="30dp"
	        android:layout_marginTop="30dp" />
	    
	    
	    <EditText
	        android:id="@+id/editText4"
	        android:hint="a2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
		android:layout_toLeftOf="@+id/editText5"		
		android:layout_marginRight="30dp"
	        android:layout_marginTop="80dp" />
	    
	    <EditText
	        android:id="@+id/editText5"
	        android:hint="b2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="80dp" />
	    
	    <EditText
	        android:id="@+id/editText6"
	        android:hint="c2"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_toRightOf="@+id/editText5"
	        android:layout_marginLeft="30dp"
	        android:layout_marginTop="80dp" />
 
	    <Button
	        android:id="@+id/button1"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView2"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="150dp"
	        android:text="Get Solution" />
 
	    <TextView
	        android:id="@+id/textView3"
	        android:textSize="18dp"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/button1"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:text="x value" />
	    
	    <TextView
	        android:id="@+id/textView4"
	        android:textSize="18dp"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_below="@+id/textView3"
	        android:layout_centerHorizontal="true"
	        android:layout_marginTop="30dp"
	        android:paddingBottom="30dp"
	        android:text="y value" />
	    	            
    </RelativeLayout>
 
</ScrollView>

Step 7 : Open src -> package -> MainActivity.java and add following code :

package balaji.hms;
 
import java.util.ArrayList;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
 
public class MainActivity extends Activity {
	
	Spinner Spinn_Chapter;
	List<String> List_Chapter;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Spinn_Chapter = (Spinner) findViewById(R.id.spinner1);
        List_Chapter = new ArrayList<String>();
        
        List_Chapter.add("Select One");
        List_Chapter.add("Factorisation");
        List_Chapter.add("Differentiation");
        List_Chapter.add("Integration");
        List_Chapter.add("Linear Equation");
        
        ArrayAdapter<String> adp = new ArrayAdapter<String> 
        (this, android.R.layout.simple_list_item_1, List_Chapter);
        
        Spinn_Chapter.setAdapter(adp);
        Spinn_Chapter.setSelection(0);
        
        Spinn_Chapter.setOnItemSelectedListener(new OnItemSelectedListener() {
 
		@Override
		public void onItemSelected(AdapterView<?> arg0, View arg1,
				int arg2, long arg3) {
			// TODO Auto-generated method stub				
				
			switch(arg2) {
			
				case 1 :
					Intent i = new Intent(MainActivity.this, Factorisation.class);
					startActivity(i);
					break;
				case 2 :
					Intent j = new Intent(MainActivity.this, Differentiation.class);
					startActivity(j);
					break;
				case 3 :
					Intent k = new Intent(MainActivity.this, Integration.class);
					startActivity(k);
					break;
				case 4 :
					Intent l = new Intent(MainActivity.this, Linear.class);
					startActivity(l);
					break;
				default :
					break;
			}				
		}
 
		@Override
		public void onNothingSelected(AdapterView<?> arg0) {
			// TODO Auto-generated method stub
				
		}
	});
    }
 
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

Step 8 : Open src -> package -> Factorisation.java and add following code :

package balaji.hms;
 
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
 
public class Factorisation extends Activity {
 
	TextView Text_Eqn, Text_X1, Text_X2;
	String Str_Eqn, Str_X1, Str_X2;
	Button Butt_Get;
	EditText Edit_X2, Edit_X1, Edit_X0;
	
	double a, b, c;
	double x1, x2;
	int count;
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.factorisation);
 
		Text_Eqn = (TextView) findViewById(R.id.textView2);
		Edit_X2 = (EditText) findViewById(R.id.editText1);
		Edit_X1 = (EditText) findViewById(R.id.editText2);
		Edit_X0 = (EditText) findViewById(R.id.editText3);
		Butt_Get = (Button) findViewById(R.id.button1);
		Text_X1 = (TextView) findViewById(R.id.textView3);
		Text_X2 = (TextView) findViewById(R.id.textView4);
		
		Edit_X2.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL 
				| InputType.TYPE_NUMBER_FLAG_SIGNED);
		Edit_X1.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL 
				| InputType.TYPE_NUMBER_FLAG_SIGNED);
		Edit_X0.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL 
				| InputType.TYPE_NUMBER_FLAG_SIGNED);
 
		Str_Eqn = "Consider our equation is like below<br/><br/>" +
				"<font color = '#FF0000'> ax^2 + bx^1 + cx^0 = 0</font>";		
		Text_Eqn.setText(Html.fromHtml(Str_Eqn));
		
		Butt_Get.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
				try {
					count = 0;
					
					if(Edit_X2.getText().toString().equalsIgnoreCase(""));
					else 
						count ++;
					
					if(Edit_X1.getText().toString().equalsIgnoreCase(""));
					else 
						count ++;
					
					if(Edit_X0.getText().toString().equalsIgnoreCase(""));
					else 
						count ++;
					
					if (count == 3) 
						fact();
					
					else 
						error();
				} catch (Exception e) {
					Toast.makeText(getBaseContext(), "Enter The Values Correctly", 
							Toast.LENGTH_LONG).show();
				}
			}
		});
	}
	
	public void fact() {
				
		a = Double.parseDouble(Edit_X2.getText().toString());
		b = Double.parseDouble(Edit_X1.getText().toString());
		c = Double.parseDouble(Edit_X0.getText().toString());
		
		x1 = (-b + (Math.sqrt( (b*b) - (4*a*c)))) / (2*a);
		x2 = (-b - (Math.sqrt( (b*b) - (4*a*c)))) / (2*a);
		
		Str_X1 = "x1 : <font color = '#FF0000'>" + x1 + "</font>";
		Str_X2 = "x2 : <font color = '#FF0000'>" + x2 + "</font>";
		
		Text_X1.setText(Html.fromHtml(Str_X1));
		Text_X2.setText(Html.fromHtml(Str_X2));
	}
	
	public void error() {
		
		Text_X1.setText("Can't find x1");
		Text_X2.setText("Can't find x2");
	}
}

Step 9 : Open src -> package -> Differentiation.java and add following code :

package balaji.hms;
 
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Html;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
 
public class Differentiation extends Activity {
 
	TextView Text_Eqn;
	EditText Edit_N;
	String Str_Eqn;
	Button Butt_Get, Butt_Go;
	LinearLayout Linear1, Linear2;
	
	EditText Edit_Input[];
	TextView Text_OutPut[];
	int count, n, temp;
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.differentiation);
 
		Text_Eqn = (TextView) findViewById(R.id.textView2);
		Edit_N = (EditText) findViewById(R.id.editText1);
		Butt_Go = (Button) findViewById(R.id.button1);
		Butt_Get = (Button) findViewById(R.id.button2);
		Linear1 = (LinearLayout) findViewById(R.id.linear1);
		Linear2 = (LinearLayout) findViewById(R.id.linear2);
 
		Str_Eqn = "Consider our equation is like below<br/><br/>" +
				"<font color = '#FF0000'> ax^n + bx^n-1 + ...... + z</font>";		
		Text_Eqn.setText(Html.fromHtml(Str_Eqn));
		
		Butt_Go.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
				try {
					n = 0;
					removeView();
					if(Edit_N.getText().toString().equalsIgnoreCase(""));
					else {
						n = Integer.parseInt(Edit_N.getText().toString());
						InputBoxes(n);
					}
					
				} catch (Exception e) {
					Toast.makeText(getBaseContext(), "Enter 'n' value Correctly", 
							Toast.LENGTH_LONG).show();
				}
			}
		});
		
		Butt_Get.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
			
				try {
					
					Linear2.removeAllViewsInLayout();
					count = 0;
					
					for(int i=0; i<=n; i++) {
						
						if(Edit_Input[i].getText().toString().equalsIgnoreCase(""));
						else
							count ++;
					}
					
					if (count == n+1) {
						
						diff();
					}
					else {
						
						error();
					}
				} catch (Exception e) {
					
					Toast.makeText(getBaseContext(), "Enter The Values Correctly", 
							Toast.LENGTH_LONG).show();
				}
			}
		});
	}
	
	public void removeView() {
		
		Linear1.removeAllViewsInLayout();
		Linear2.removeAllViewsInLayout();
	}
	
	public void InputBoxes(int n) {
		
		Edit_Input = new EditText[n+1];
		temp = n;
		
		for(int i=0; i<=n; i++) {
			
			Edit_Input[i] = new EditText(Differentiation.this);
			Edit_Input[i].setHint("Enter Co-efficient of x^"+ (temp-i));
			Edit_Input[i].setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL 
					| InputType.TYPE_NUMBER_FLAG_SIGNED);
			Linear1.addView(Edit_Input[i]);
		}
	}
 
	public void diff() {
				
		Text_OutPut = new TextView[n];
		
		for(int i=0; i<n; i++) {
			
			String str = (temp-i) * (Float.parseFloat(Edit_Input[i].getText().toString())) 
					+ " x^" + (temp-i-1);
			Text_OutPut[i] = new TextView(Differentiation.this);
			Text_OutPut[i].setText(str);
			Text_OutPut[i].setTextSize(16);
			Text_OutPut[i].setTextColor(Color.RED);
			Linear2.addView(Text_OutPut[i]);
		}		
	}
	
	public void error() {
		
		Toast.makeText(getBaseContext(), "Enter the values", Toast.LENGTH_LONG).show();
	}
}

Step 10 : Open src -> package -> Integration.java and add following code :

package balaji.hms;
 
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Html;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
 
public class Integration extends Activity {
 
	TextView Text_Eqn;
	EditText Edit_N;
	String Str_Eqn;
	Button Butt_Get, Butt_Go;
	LinearLayout Linear1, Linear2;
	
	EditText Edit_Input[];
	TextView Text_OutPut[];
	int count, n, temp;
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.integration);
 
		Text_Eqn = (TextView) findViewById(R.id.textView2);
		Edit_N = (EditText) findViewById(R.id.editText1);
		Butt_Go = (Button) findViewById(R.id.button1);
		Butt_Get = (Button) findViewById(R.id.button2);
		Linear1 = (LinearLayout) findViewById(R.id.linear1);
		Linear2 = (LinearLayout) findViewById(R.id.linear2);
 
		Str_Eqn = "Consider our equation is like below<br/><br/>" +
				"<font color = '#FF0000'> ax^n + bx^n-1 + ...... + z</font>";		
		Text_Eqn.setText(Html.fromHtml(Str_Eqn));
		
		Butt_Go.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
				try {
					
					n = 0;
					removeView();
					if(Edit_N.getText().toString().equalsIgnoreCase(""));
					else {
						n = Integer.parseInt(Edit_N.getText().toString());
						InputBoxes(n);
					}
					
				} catch (Exception e) {
					Toast.makeText(getBaseContext(), "Enter 'n' value Correctly", 
							Toast.LENGTH_LONG).show();
				}
			}
		});
		
		
		Butt_Get.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
			
				try {
					
					Linear2.removeAllViewsInLayout();
					count = 0;
					
					for(int i=0; i<=n; i++) {
						
						if(Edit_Input[i].getText().toString().equalsIgnoreCase(""));
						else
							count ++;
					}
					
					if (count == n+1) {
						
						integ();
					}
					else {
						
						error();
					}
					
				} catch (Exception e) {
					
					Toast.makeText(getBaseContext(), "Enter The Values Correctly", 
							Toast.LENGTH_LONG).show();
				}
			}
		});
	}
	
	public void removeView() {
		
		Linear1.removeAllViewsInLayout();
		Linear2.removeAllViewsInLayout();
	}
	
	public void InputBoxes(int n) {
		
		Edit_Input = new EditText[n+1];
		temp = n;
		
		for(int i=0; i<=n; i++) {
			
			Edit_Input[i] = new EditText(Integration.this);
			Edit_Input[i].setHint("Enter Co-efficient of x^"+ (temp-i));
			Edit_Input[i].setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL 
					| InputType.TYPE_NUMBER_FLAG_SIGNED);
			Linear1.addView(Edit_Input[i]);
		}
	}
 
	public void integ() {
				
		Text_OutPut = new TextView[n+1];
		
		for(int i=0; i<=n; i++) {
			
			String str = ((Float.parseFloat(Edit_Input[i].getText().toString())) / 
					((temp-i)+1)) + " x^" + ((temp-i)+1);
			
			Text_OutPut[i] = new TextView(Integration.this);
			Text_OutPut[i].setText(str);
			Text_OutPut[i].setTextSize(16);
			Text_OutPut[i].setTextColor(Color.RED);
			Linear2.addView(Text_OutPut[i]);
		}
		
		
	}
	
	public void error() {
		
		Toast.makeText(getBaseContext(), "Enter the values", Toast.LENGTH_LONG).show();
	}
}

Step 11 : Open src -> package -> Linear.java and add following code :

package balaji.hms;
 
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
 
public class Linear extends Activity {
 
	TextView Text_Eqn, Text_X, Text_Y;
	EditText Edit_a1, Edit_b1, Edit_c1, Edit_a2, Edit_b2, Edit_c2;
	String Str_Eqn;
	Button Butt_Get;
	
	float a1, a2, b1, b2, c1, c2;
	float x, y;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.linear);
 
		Text_Eqn = (TextView) findViewById(R.id.textView2);
		Text_X = (TextView) findViewById(R.id.textView3);
		Text_Y = (TextView) findViewById(R.id.textView4);
		
		Edit_a1 = (EditText) findViewById(R.id.editText1);
		Edit_b1 = (EditText) findViewById(R.id.editText2);
		Edit_c1 = (EditText) findViewById(R.id.editText3);
		Edit_a2 = (EditText) findViewById(R.id.editText4);
		Edit_b2 = (EditText) findViewById(R.id.editText5);
		Edit_c2 = (EditText) findViewById(R.id.editText6);
		
		Butt_Get = (Button) findViewById(R.id.button1);
		
 
		Str_Eqn = "Consider our equation is like below<br/><br/>" +
				"<font color = '#FF0000'> a1 x + b1 y = c1" +
				"<br/>a2 x + b2 y = c2</font>";		
		Text_Eqn.setText(Html.fromHtml(Str_Eqn));
		
		Butt_Get.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				
				try {
					
					a1 = Float.parseFloat(Edit_a1.getText().toString());
					b1 = Float.parseFloat(Edit_b1.getText().toString());
					c1 = Float.parseFloat(Edit_c1.getText().toString());
					
					a2 = Float.parseFloat(Edit_a2.getText().toString());
					b2 = Float.parseFloat(Edit_b2.getText().toString());
					c2 = Float.parseFloat(Edit_c2.getText().toString());
					
					linear();
					
				} catch (Exception e) {
					Toast.makeText(getBaseContext(), "Enter The Values Correctly", 
							Toast.LENGTH_LONG).show();
					Log.e("df", e.toString());
				}
			}
		});
	}
	
	public void linear() {
				
		float da1, da2, db1, db2, dc1, dc2;
		
		da1 = a1; da2 = a2;
		db1 = b1; db2 = b2;
		dc1 = c1; dc2 = c2;
		
		da1 = a1 * b2;
		db1 = b1 * b2;
		dc1 = c1 * b2;
		
		da2 = a2 * b1;
		db2 = b2 * b1;
		dc2 = c2 * b1;
		
		if(db1 == db2) {
			
			da2 = da2 * -1;
			db2 = db2 * -1;
			dc2 = dc2 * -1;
		}
		
		float sum_a = da1 + da2;
		float sum_c = dc1 + dc2;
		
		x = sum_c / sum_a;
		y = (c1 - (a1 * x)) / b1;
		
		String Str_X = "x value : <font color = '#FF0000'>" + x + "</font>";
		String Str_Y = "y value : <font color = '#FF0000'>" + y + "</font>";
		
		Text_X.setText(Html.fromHtml(Str_X));
		Text_Y.setText(Html.fromHtml(Str_Y));
	}
	
	public void error() {
		
		Toast.makeText(getBaseContext(), "Enter the values", Toast.LENGTH_LONG).show();
	}
}

Step 12 : Open AndroidManifest.xml and add following code :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="balaji.hms"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk
        android:minSdkVersion="3"
        android:targetSdkVersion="17" />
 
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="balaji.hms.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=".Factorisation"></activity>
        
        <activity android:name=".Differentiation"></activity>
        
        <activity android:name=".Integration"></activity>
        
        <activity android:name=".Linear"></activity>
        
    </application>
 
</manifest>

Step 13 : Open res ->values ->strings.xml and add following code :

<?xml version="1.0" encoding="utf-8"?>
<resources>
 
    <string name="app_name">HMS</string>
    <string name="menu_settings">Settings</string>
 
</resources>

Step 14 : Our output will be like this :


Output


Output


Output


Output


Output


Output


Output


Output


Output


Output


Output


Output


Output


Output









SHARE THIS PAGE



product 2

product 3

product 4

Feedbacks : balaji.scz@gmail.com