Blogger Tips and TricksLatest Tips And TricksBlogger Tricks

Implement an application that implements Multi threading

1)Open eclipse or android studio and select new android project
2)Give project name and select next
3) Choose the android version.Choose the lowest android version(Android 2.2) and select next
4) Enter the package name.package name must be two word seprated by comma and click finish
5)Go to package explorer in the left hand side.select our project.
6)Go to res folder and select layout.Double click the main.xml file.Add the code below

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/info" >
      <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="fetchData"
        android:text="Start MULTITHREAD" />
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Main thread" />
</LinearLayout>
7) Now select mainactivity.java file and type the following code.
Ypackage multi.threading;


//import your.first.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.TextView;
public class MultiThreadingActivity extends Activity {
    private  TextView tvOutput;
    private  static final int t1 = 1;
    private  static final int t2 = 2;
    private  static final int t3 = 3;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tvOutput = (TextView) findViewById(R.id.textView1);
    }
    public void fetchData(View v) {
        tvOutput.setText("Main thread");
        thread1.start();
        thread2.start();
        thread3.start();
    }
    Thread thread1 = new Thread(new Runnable() {
    @Override
    public void run() {
    for (int i = 0; i < 5; i++) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    handler.sendEmptyMessage(t1);
    }
    }
    });
    Thread thread2 = new Thread(new Runnable() {
      @Override
        public void run() {
        for (int i = 0; i < 5; i++) {
        try {
        Thread.sleep(1000);
        } catch (InterruptedException e) {
        e.printStackTrace();
        }
        handler.sendEmptyMessage(t2);
        }
  
        }
        });
    Thread thread3 = new Thread(new Runnable() {
        @Override
        public void run() {
        for (int i = 0; i < 5; i++) {
        try {
        Thread.sleep(1000);
        } catch (InterruptedException e) {
        e.printStackTrace();
        }
        handler.sendEmptyMessage(t3);
        }
             }
        });
       Handler handler = new Handler() {
    public void handleMessage(android.os.Message msg) {
    if(msg.what == t1) {
    tvOutput.append("\nIn thread 1");
    }
    if(msg.what == t2) {
        tvOutput.append("\nIn thread 2");
        }
    if(msg.what == t3) {
        tvOutput.append("\nIn thread 3");
        }
    }
    };
}
8)Now go to main.xml and right click .select run as option and select run configuration
9) Android output is present in the android emulator as shown in below.





Write an application that draws basic graphical primitives on the screen in android

1)Open eclipse or android studio and select new android project
2)Give project name and select next
3) Choose the android version.Choose the lowest android version(Android 2.2) and select next
4) Enter the package name.package name must be two word seprated by comma and click finish
5)Go to package explorer in the left hand side.select our project.
6)Go to res folder and select layout.Double click the main.xml file.Don't change anything in layout.Leave as default.
7) Now select mainactivity.java file and type the following code.
package Basic.primitive;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
public class BasicprimitiveActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new myview(this));
                     }
    private class myview extends View
    {
        public myview(Context context)
        {
        super(context);
        }
        @Override
         protected void onDraw(Canvas canvas)
        {
            super.onDraw(canvas);
            Paint paint=new Paint();
            paint.setTextSize(40);
            paint.setColor(Color.GREEN);
            canvas.drawText("Circle", 55, 30, paint);
            paint.setColor(Color.RED);
            canvas.drawCircle(100, 150,100, paint);
            paint.setColor(Color.GREEN);
            canvas.drawText("Rectangle", 255, 30, paint);
            paint.setColor(Color.YELLOW);
            canvas.drawRect(250, 50,400,350, paint);
            paint.setColor(Color.GREEN);
            canvas.drawText("SQUARE", 55, 430, paint);
            paint.setColor(Color.BLUE);
            canvas.drawRect(50, 450,150,550, paint);
            paint.setColor(Color.GREEN);
            canvas.drawText("LINE", 255, 430, paint);
            paint.setColor(Color.CYAN);
            canvas.drawLine(250, 500, 350, 500, paint);          
        }
         }
}
8)Now go to main.xml and right click .select run as option and select run configuration
9) Android output is present in the android emulator as shown in below.


Develop a native calculator application


1)Open eclipse or android studio and select new android project
2)Give project name and select next
3) Choose the android version.Choose the lowest android version(Android 2.2) and select next
4) Enter the package name.package name must be two word seprated by comma and click finish
5)Go to package explorer in the left hand side.select our project.
6)Go to res folder and select layout.Double click the main.xml file
7)Now you can see the Graphics layout window.

8)Click the main.xml file and type the code below


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1"
android:layout_marginLeft="10pt"
android:layout_marginRight="10pt"
android:layout_marginTop="3pt">
<EditText
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginRight="5pt"
android:id="@+id/etNum1"
android:layout_width="match_parent"
android:inputType="numberDecimal">
</EditText>
<EditText
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="5pt"
android:id="@+id/etNum2"
android:layout_width="match_parent"
android:inputType="numberDecimal">
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout2"
android:layout_marginTop="3pt"
android:layout_marginLeft="5pt"
android:layout_marginRight="5pt">
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1"
android:text="+"
android:textSize="15pt"
android:id="@+id/btnAdd">
</Button>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1"
android:text="-"
android:textSize="15pt"
android:id="@+id/btnSub">
</Button>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1"
android:text="*"
android:textSize="15pt"
android:id="@+id/btnMult">
</Button>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1"
android:text="/"
android:textSize="15pt"
android:id="@+id/btnDiv">
</Button>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="5pt"
android:layout_marginRight="5pt"
android:textSize="12pt"
android:layout_marginTop="3pt"
android:id="@+id/tvResult"
android:gravity="center_horizontal">
</TextView>
</LinearLayout>

9)Go to project explorer and select src folder.Now select mainactivity.java file and type the following code MainActivity.java coding
package CALCU.CALU;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class CALCULATORActivity extends Activity implements OnClickListener {
    EditText input1;
    EditText input2;
      Button addition;
      Button subtraction;
      Button multiplication;
      Button division;
      TextView tvResult;
      String oper = "";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        input1 = (EditText) findViewById(R.id.etNum1);
        input2 = (EditText) findViewById(R.id.etNum2);
        addition = (Button) findViewById(R.id.btnAdd);
        subtraction = (Button) findViewById(R.id.btnSub);
        multiplication = (Button) findViewById(R.id.btnMult);
        division = (Button) findViewById(R.id.btnDiv);
        tvResult = (TextView) findViewById(R.id.tvResult);
        // set a listener
        addition.setOnClickListener(this);
        subtraction.setOnClickListener(this);
        multiplication.setOnClickListener(this);
        division.setOnClickListener(this);
      }
      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        float num1 = 0;
        float num2 = 0;
        float result = 0;
        // check if the fields are empty
        if (TextUtils.isEmpty(input1.getText().toString())
            || TextUtils.isEmpty(input2.getText().toString())) {
          return;
        }
        // read EditText and fill variables with numbers
        num1 = Float.parseFloat(input1.getText().toString());
        num2 = Float.parseFloat(input2.getText().toString());
        // defines the button that has been clicked and performs the corresponding operation
        // write operation into oper, we will use it later for output
        switch (v.getId()) {
        case R.id.btnAdd:
          oper = "+";
          result = num1 + num2;
          break;
        case R.id.btnSub:
          oper = "-";
          result = num1 - num2;
          break;
        case R.id.btnMult:
          oper = "*";
          result = num1 * num2;
          break;
        case R.id.btnDiv:
          oper = "/";
          result = num1 / num2;
          break;
        default:
          break;
        }
        // form the output line
        tvResult.setText(num1 + " " + oper + " " + num2 + " = " + result);
      }
}
10)Now go to main.xml and right click .select run as option and select run configuration

11) Android output is present in the android emulator as shown in below. Output

Develop an application that uses GUI components, Font and Colours

 Simple application to change font size and color of textview

1)Open eclipse or android studio and select new android project
2)Give project name and select next
3) Choose the android version.Choose the lowest android version(Android 2.2) and select next
4) Enter the package name.package name must be two word seprated by comma and click finish
5)Go to package explorer in the left hand side.select our project.
6)Go to res folder and select layout.Double click the main.xml file
7)Now you can see the Graphics layout window.

8)Click the main.xml file and type the code below

<?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" >
    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20sp"
        android:gravity="center"
        android:text="HELLO WORLD"
        android:textSize="20sp"
        android:textStyle="bold" />
    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Change font size"
        android:textSize="20sp" />
    <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Change color"
        android:textSize="20sp" />
     <Button
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Change font"
        android:textSize="20sp" />
</LinearLayout>
9)Again click the graphics layout tab and screen layout is look like below
 10)Go to project explorer and select src folder.Now select mainactivity.java file and type the following code

//import android.R;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class AndroidActivity extends Activity {
     float font =24;
     int i=1;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final TextView t1=(TextView) findViewById(R.id.textView1);
      Button  b1 = (Button) findViewById(R.id.button1);

        b1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                t1.setTextSize(font);
                font=font+4;
                if(font==40)
                    font=20;
            }
        });
        Button  b2 = (Button) findViewById(R.id.button2);
        b2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                switch(i)
                {
                case 1:
                    t1.setTextColor(Color.parseColor("#0000FF"));
                    break;
                case 2:
                    t1.setTextColor(Color.parseColor("#00FF00"));
                    break;
                case 3:
                    t1.setTextColor(Color.parseColor("#FF0000"));
                    break;
                case 4:
                    t1.setTextColor(Color.parseColor("#800000"));
                    break;
                }
                i++;
                if(i==5)
                    i=1;
                 
            }
              
        });
   
}
}
11)Now go to main.xml and right click .select run as option and select run configuration

12) Android output is present in the android emulator as shown in below.

MOBILE APPLICATION DEVELOPMENT LABORATORY(Subject code-IT6611 and CS6611)

Lab manual features
*A complete Lab Manual with pdf,source code,Procedure,download project and download android apk file for all experiment.
*Step by step procedure to install and execute all the programs.
*Anna University Latest Sylabus.Common to CSE and IT department
*Easy to execute all the experiment simply download the project.
*Have a android executable(.apk) file.Download and Run in your android device.
*Step by step procedure is available with the manual.So that  easily Run the experiment without the help of other.

A complete Lab Manual with source code for all experiment.

One day  Workshop:
                                Workshop on Mobile application development  is available for colleges.Content for the workshop are as follows
                                *Recent trends in mobile application development 
                                *Introduction about mobile application development environment(Android).
                                *Life cycle of android .Working nature of android software.
                                *Step by step installation for android software.
                                *Execution of  all lab experiments.
            Contact:8344790950

LabManual cost details
                     LAB MANUAL DVD(Rs 1000)
                                              The labmanual with dvd it includes all experiment in pdf,software and installation procedure.The labmanul cost RS1000.The dvd will be reach you with in one or two days.
                    LAB MANUAL SOFT COPY(Rs 700)
                                              The softcopy of lab manual is availabe via email.It includes all experiment in pdf,installation procedure.The labmanual cost RS700.The email will reach you shortly after payment.

Payment method:
                                              The payment has  be made to the following bank account.After payment contact as we will send our lab manual.

contact details:
CELL:8344790950
     
EMAIL:hitechguil@gmail.com 

Bank Account Details:

BANK NAME :STATE BANK OF INDIA
ACCOUNT NO:20222847933
ACCOUNT HOLDER NAME:P GUILBERT RAJ
IFSC CODE:SBIN0010501



Lab manual screen shot:
1.Gui component font and color
2.Layout manager:

3.Calculator:

4.Basic graphical pimitives:

5.Database application:

6.Rss Feed:

7.Multithreading Application:

8.GPS LOCATION:

9.Sdcard data storage:

10.Alert application :

11.Alarm Clock:


Lab manual in android app:



Lab manual feedback:



STUCTURE AND UNION EXAMPLE C PROGRAM

#include<stdio.h>
#include<conio.h>
// Structure Definition
struct stud
{       
            int rno;
            char name[10];
            float m1,m2,m3;
};
struct stud s;//Structure Variable Declaration
//Union Definition
union result
{
            char grade;
            float percentage;
};
Union result r; //Union variable Declaration
void main()
{
            int choice;
            float per,temp,total;
            clrscr();
            printf("\nEnter your Roll No");
            scanf("%d",&s.rno);
            printf("\nEnter your Name");
            scanf("%s",&s.name);
            printf("\nEnter your mark1");
            scanf("%f",&s.m1);
            printf("\nEnter your mark2");
            scanf("%f",&s.m2);
            printf("\nEnter your mark3");
            scanf("%f",&s.m3);
            total=s.m1+s.m2+s.m3;
            temp=(float)(total/300);
            r.percentage=temp*100;
            per=r.percentage;
            printf("\nEnter your choice");
            printf("\n1.Percentage\n2.Grade");
            scanf("%d",&choice);
            printf("\nyour name is %s",s.name);
            printf("\nyour roll no is %d",s.rno);
            printf("\nyour total is%f",total);
switch(choice)
{
            case 1:             printf("\nyour percentage is %f",r.percentage);
                                    break;
            case 2:            if(per<=100 && per>=90)
                                    {r.grade='S';}
                                    else if(per<=90 && per>=80)
                                    {r.grade='A';}
                                    else if(per<=80 && per>=70)
                                    {r.grade='B';}
                                    else if(per<=70 && per>=60)
                                    {r.grade='C';}
                                    else if(per<=60 && per>=55)
                                    {r.grade='D';}
                                    else if(per<=55 && per>=50)
                                    {r.grade='E';}
                                    else
                                    {r.grade='U';}
                                    printf("\nYour grade is%c",r.grade);
                                    break;
}
getch();
}


Flag Counter