Thursday, 21 March 2013

Android Bluetooth UUID Sample.


 

This program uses BluetoothAdapter to get default adapter. Broadcast Intent(
ACTION_REQUEST_ENABLE) is used to turnon bluetooth. 
We can get UUID and MAC address from textview.

JAVA PROGRAM 


package com.example.bluetoothlist;

import java.util.Set;

import android.os.Bundle;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class Bluetoothlist extends Activity implements OnClickListener, android.view.View.OnClickListener {
    //private static final int REQUEST_ENABLE_BT = 0;
    TextView out;
    Button turnon;
    Button list;
    Button turnoff;
    int REQUEST_ENABLE_BT = 0;
    BluetoothAdapter mBluetoothAdapter = null;
   
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bluetoothlist);
        turnon=(Button)findViewById(R.id.button1);
        list=(Button)findViewById(R.id.list);
        turnoff=(Button)findViewById(R.id.turnoff);
         out = (TextView) findViewById(R.id.add);
       
        final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        mBluetoothAdapter.startDiscovery();
        if (mBluetoothAdapter == null) {
         //  out.append("device not supported");
        }
       
       
   

   
      turnon.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (!mBluetoothAdapter.isEnabled()) {
                    Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
                   
                    Set<BluetoothDevice> devices = mBluetoothAdapter.getBondedDevices();
                    for (BluetoothDevice device : devices) {
                        out.append("\nFound device: " + device);
                    
                    }
                }
            }
        });
      list.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
             
                    Set<BluetoothDevice> devices = mBluetoothAdapter.getBondedDevices();
                    for (BluetoothDevice device : devices) {
                       
                        //Menu mArrayAdapter = null;
                        out.append("\nFound device: " + device.getName()+ "\n" +"\nDevice name"+ device.getAddress());
                       
                    
                    }
                }
            });
       
        turnoff.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                  mBluetoothAdapter.disable();
              
            }
        });}

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
       
    }

    @Override
    public void onClick(DialogInterface arg0, int arg1) {
        // TODO Auto-generated method stub
       
    }}
   
   

    XML 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=".Bluetoothlist" >

    <Button
        android:id="@+id/list"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignLeft="@+id/button1"
        android:layout_alignParentTop="true"
        android:text="List" />

    <TextView
        android:id="@+id/add"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/button1"
        android:layout_marginTop="52dp"
        android:text="List of devices" />

    <Button
        android:id="@+id/button1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_below="@+id/list"
        android:layout_centerHorizontal="true"
        android:onClick="showMessage"
        android:text="TURN ON BT" />

    <Button
        android:id="@+id/turnoff"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/button1"
        android:layout_below="@+id/list"
        android:layout_toRightOf="@+id/list"
        android:text="TURN OFF" />

</RelativeLayout>

 

Manifest File

 

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
 
   
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.bluetoothlist.Bluetoothlist"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


 
 
 
 

Tuesday, 25 December 2012

Android phone call program.



This program helps you to call . Code used is very simple and easy to understand.


Code: (MainActivity)



package com.example.dialnumber;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;


public class MainActivity extends Activity {
    private Button buttonte1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        buttonte1 = (Button)findViewById(R.id.button1);
        buttonte1.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:123"));
            startActivity(callIntent);


        }});
    }

    @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;
    }

}
Code:(Activity_main.xml)
<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:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        />

    <Button
        android:id="@+id/button1"
        android:layout_width="500px"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="14dp"
        android:text="CustomerCare" />

</RelativeLayout>

Wednesday, 9 November 2011

Sign your application before posting it to Android Market.

Step 1:Right click your project in eclipse IDE.Select Android Tools.Click export signed applications package.
Step 2:Browse your project path in export window.

Step 3:Enter the password and location in keystore selection window.




Step 4:Enter Alias,password and the number of validity years for your application in keycreation window.




Step 5: Enter the path to save your signed .apk in Destination and key certificate checks .


Friday, 28 October 2011

Android Bluetooth sample app







This is a simple and powerful bluetooth app.Using this you can turn_on bluetooth,start discoverable with a simple touch,even turn_off your bluetooth.This will not work on emulator since bluetooth support is not added.

Java source code



package com.example.bluetooth;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {
      private static final int REQUEST_ENABLE_BT = 0;
        private static final int REQUEST_DISCOVERABLE_BT = 0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    final TextView out=(TextView)findViewById(R.id.out);
    final Button button = (Button) findViewById(R.id.button1);
    final Button button1 = (Button) findViewById(R.id.button2);
    final Button button2 = (Button) findViewById(R.id.button3);
    final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (mBluetoothAdapter == null) {
       out.append("device not supported");
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            if (!mBluetoothAdapter.isEnabled()) {
                Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
            }
        }
    });
    button1.setOnClickListener(new View.OnClickListener() {
     @Override
        public void onClick(View arg0) {
            if (!mBluetoothAdapter.isDiscovering()) {
//                   out.append("MAKING YOUR DEVICE DISCOVERABLE");
                   Context context = getApplicationContext();
                   CharSequence text = "MAKING YOUR DEVICE DISCOVERABLE";
                   int duration = Toast.LENGTH_SHORT;

                   Toast toast = Toast.makeText(context, text, duration);
                   toast.show();
                Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
                startActivityForResult(enableBtIntent, REQUEST_DISCOVERABLE_BT);
                 
            }
        }
    });
    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {  
            mBluetoothAdapter.disable();
//            out.append("TURN_OFF BLUETOOTH");
            Context context = getApplicationContext();
               CharSequence text = "TURNING_OFF BLUETOOTH";
               int duration = Toast.LENGTH_LONG;
               Toast toast = Toast.makeText(context, text, 15);
               toast.show();
            }
    });
}

}



Xml 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"
    android:background="@drawable/ic_launcher"
    tools:context=".MainActivity" >

<TextView android:text="" android:id="@+id/out" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="49dp"
        android:text="TURN_ON" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_below="@+id/button1"
        android:layout_marginTop="27dp"
        android:text="DISCOVERABLE" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button2"
        android:layout_below="@+id/button2"
        android:layout_marginTop="28dp"
        android:text="TURN_OFF" />

</RelativeLayout>

Manifest.xml

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.bluetooth.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>
    </application>

</manifest>





Download.apk file


http://www.4shared.com/zip/7OHBkCE_ce/Bluetooth.html




Saturday, 15 October 2011

Android rating bar.

Designing UI in android is the most interesting part.Here i have made a sample rating bar with some difference with other rating bar.Other rating bar gets the click from Click Listener.But here we can check conditions(          if(num==20){
             mSmallRatingBar.setNumStars(num);
         }in program and give stars to rating bar according to the condition.This sample program can be used for customized rating bar.


Java source code



package rating.bar;



import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;

public class RatingActivity extends Activity {
    RatingBar mSmallRatingBar;
    RatingBar mSmallRatingBar1;
    RatingBar mSmallRatingBar2;
    RatingBar mSmallRatingBar3;
    RatingBar mSmallRatingBar4;
    RatingBar mSmallRatingBar5;
    RatingBar mSmallRatingBar6;
   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mSmallRatingBar = (RatingBar) findViewById(R.id.small_ratingbar);
        mSmallRatingBar1 = (RatingBar) findViewById(R.id.small_ratingbar1);
        mSmallRatingBar2 = (RatingBar) findViewById(R.id.small_ratingbar2);
        mSmallRatingBar3 = (RatingBar) findViewById(R.id.small_ratingbar3);
        mSmallRatingBar4 = (RatingBar) findViewById(R.id.small_ratingbar4);
        mSmallRatingBar5 = (RatingBar) findViewById(R.id.small_ratingbar5);
        mSmallRatingBar6 = (RatingBar) findViewById(R.id.small_ratingbar6);
         int num = 20;
         if(num==20){
             mSmallRatingBar.setNumStars(num);
         }
       mSmallRatingBar1.setNumStars(18);
        mSmallRatingBar2.setNumStars(16);
        mSmallRatingBar3.setNumStars(12);
        mSmallRatingBar4.setNumStars(10);
        mSmallRatingBar5.setNumStars(8);
        mSmallRatingBar6.setNumStars(6);
       




      }
}
       
   
       
      
   
xml code


<?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"
    >
<RatingBar android:id="@+id/small_ratingbar"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar1"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar2"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar3"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar4"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar5"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
           <RatingBar android:id="@+id/small_ratingbar6"
           style="?android:attr/ratingBarStyleSmall"
           android:background="@drawable/rating"
           android:layout_marginLeft="5dip"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_gravity="center_vertical" />
</LinearLayout>

Source code



Thursday, 13 October 2011

Android Simple calculator program

Hi all,

This is a small calculator program for beginners.With this program you can learn adding buttons to UI,adding sliders to UI.This program uses simple functions like add(),sub(),div(),mul().



JAVA CODE

package simple.calculator;

//import sip.com.calc.R;
import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class SimpleCalculatorActivity extends Activity {
    private EditText txtinput1;
    private EditText txtinput2;
    private EditText txtinput3;
    private Button buttonte;
    private Button buttonte1;
    private Button buttonte2;
    private Button buttonte3;
  //  private Button buttonte4;
    private Button buttonte46;
    private Button buttonte47;
    private Button buttonte48;
    private Button buttonte49;
    private Button buttonte50;
    private Button buttonte51;
    private Button buttonte52;
    private Button buttonte53;
    private Button buttonte54;
    private Button buttonte55;
    private ImageView imageView;
    private double input1 =0;
    private double input2 =0;
    private double input3 =0;
   
   
   
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.calc);
        initctrls();
    }
    public void onCreate1(Bundle bundle) {
        super.onCreate(bundle);
        /**Hello World Image JFD*/
        /**BEGIN
        */
        /**Create the ImageView */
        ImageView HelloWorldImageView = new ImageView(this);
        /**Set the ImageView to helloworld.png */
        imageView.setImageResource(R.drawable.icon);
        /**Set the ContentView to the ImageView */
        setContentView(HelloWorldImageView);
        /**END
        */
        }

   private void initctrls(){
       txtinput1 = (EditText)findViewById(R.id.widget41);
       txtinput2 = (EditText)findViewById(R.id.widget43);
       txtinput3 = (EditText)findViewById(R.id.widget45);
       buttonte = (Button)findViewById(R.id.widget56);
       buttonte1 = (Button)findViewById(R.id.widget57);
       buttonte2 = (Button)findViewById(R.id.widget58);
       buttonte3 = (Button)findViewById(R.id.widget59);
       buttonte46 = (Button)findViewById(R.id.widget46);
       buttonte47 = (Button)findViewById(R.id.widget47);
       buttonte48 = (Button)findViewById(R.id.widget48);
       buttonte49 = (Button)findViewById(R.id.widget49);
       buttonte50 = (Button)findViewById(R.id.widget50);
       buttonte51 = (Button)findViewById(R.id.widget51);
       buttonte52 = (Button)findViewById(R.id.widget52);
       buttonte53 = (Button)findViewById(R.id.widget53);
       buttonte54 = (Button)findViewById(R.id.widget54);
       buttonte55 = (Button)findViewById(R.id.widget55);
       buttonte.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ add(); }});
       buttonte1.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ sub(); }});
       buttonte2.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ mul(); }});
       buttonte3.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ div(); }});
       buttonte46.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(1); }});
       buttonte47.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(2); }});
       buttonte48.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(3); }});
       buttonte49.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(4); }});
       buttonte50.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(5); }});
       buttonte51.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(6); }});
       buttonte52.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(7); }});
       buttonte53.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(8); }});
       buttonte54.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(9); }});
       buttonte55.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ num(0); }});
     txtinput1.setInputType(InputType.TYPE_CLASS_NUMBER);
     txtinput2.setInputType(InputType.TYPE_CLASS_NUMBER);
     txtinput3.setInputType(InputType.TYPE_CLASS_NUMBER);
  }
  
   void num(int y){
      // int i =Integer.parseInt(txtinput1.getText().toString());
        if(txtinput1.isFocused()){
           
             txtinput1.append(String.valueOf(y));
        }
        if(txtinput2.isFocused()){
             txtinput2.append(String.valueOf(y));
        }
       
      // txtinput1.setText("1");
      // txtinput2.setText("1");
   }

   private void add(){
       input1=Double.parseDouble(txtinput1.getText().toString());
      
      
      
       input2=Double.parseDouble(txtinput2.getText().toString());
      
       input3 = (input1+input2);
      
       txtinput3.setText(Double.toString(input3));
      
      
   }
   private void sub(){
       input1=Double.parseDouble(txtinput1.getText().toString());
       input2=Double.parseDouble(txtinput2.getText().toString());
       input3=(input1-input2);
       txtinput3.setText(Double.toString(input3));
      
      
   }
   private void mul(){
       input1=Double.parseDouble(txtinput1.getText().toString());
       input2=Double.parseDouble(txtinput2.getText().toString());
       input3=(input1*input2);
       txtinput3.setText(Double.toString(input3));
      
      
   }
   private void div(){
       input1=Double.parseDouble(txtinput1.getText().toString());
       input2=Double.parseDouble(txtinput2.getText().toString());
       input3=(input1/input2);
       txtinput3.setText(Double.toString(input3));
      
      
   }
  
}

Sourcecode

XML CODE



<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout android:id="@+id/LinearLayout1"
xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<HorizontalScrollView
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 xmlns:android="http://schemas.android.com/apk/res/android">
 <ScrollView
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 xmlns:android="http://schemas.android.com/apk/res/android">
<AbsoluteLayout android:id="@+id/AbsoluteLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent">
<AbsoluteLayout android:id="@+id/AbsoluteLayout1" android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
<TextView android:id="@+id/widget40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="I1"
android:layout_x="15px"
android:layout_y="16px"
>
</TextView>
<EditText android:id="@+id/widget41"
android:layout_width="350px"
android:layout_height="80px"
android:inputType="number"
android:text=""
android:textSize="18sp"
android:layout_x="40px"
android:layout_y="16px"
>
</EditText>
<TextView android:id="@+id/widget42"
android:layout_width="350px"
android:layout_height="wrap_content"
android:text="I2"
android:layout_x="15px"
android:layout_y="100px"
>
</TextView>
<EditText android:id="@+id/widget43"
android:layout_width="350px"
android:layout_height="80px"
android:text=""
android:textSize="18sp"
android:layout_x="40px"
android:layout_y="90px"
>
</EditText>
<TextView android:id="@+id/widget44"
android:layout_width="wrap_content"
android:layout_height="28px"
android:text="Output"
android:layout_x="2px"
android:layout_y="190px"
>
</TextView>
<EditText android:id="@+id/widget45"
android:layout_width="425px"
android:layout_height="80px"
android:text=""
android:textSize="18sp"
android:layout_x="19px"
android:layout_y="205px"
>
</EditText>
<Button android:id="@+id/widget46"
android:layout_width="55px"
android:layout_height="55px"
android:text="1"
android:layout_x="40px"
android:layout_y="323px"
>
</Button>
<Button android:layout_width="55px"
android:layout_height="55px"
android:text="2"
android:layout_x="138px"
android:layout_y="321px"
android:id="@+id/widget47">
</Button>
<Button android:id="@+id/widget48"
android:layout_width="55px"
android:layout_height="55px"
android:text="3"
android:layout_x="236px"
android:layout_y="321px"
>
</Button>
<Button android:id="@+id/widget49"
android:layout_width="55px"
android:layout_height="55px"
android:text="4"
android:layout_x="40px"
android:layout_y="383px"
>
</Button>
<Button android:id="@+id/widget50"
android:layout_width="55px"
android:layout_height="55px"
android:text="5"
android:layout_x="138px"
android:layout_y="381px"
>
</Button>
<Button android:id="@+id/widget51"
android:layout_width="55px"
android:layout_height="55px"
android:text="6"
android:layout_x="236px"
android:layout_y="381px"
>
</Button>
<Button android:id="@+id/widget52"
android:layout_width="55px"
android:layout_height="55px"
android:text="7"
android:layout_x="40px"
android:layout_y="443px"
>
</Button>
<Button android:id="@+id/widget53"
android:layout_width="55px"
android:layout_height="55px"
android:text="8"
android:layout_x="138px"
android:layout_y="441px"
>
</Button>
<Button android:id="@+id/widget54"
android:layout_width="55px"
android:layout_height="55px"
android:text="9"
android:layout_x="236px"
android:layout_y="441px"
>
</Button>
<Button android:id="@+id/widget55"
android:layout_width="55px"
android:layout_height="55px"
android:text="0"
android:layout_x="138px"
android:layout_y="501px"
>
</Button>
<Button android:layout_width="105px"
android:layout_height="55px"
android:text="+"
android:layout_x="361px"
android:layout_y="321px"
android:id="@+id/widget56">
</Button>
<Button android:id="@+id/widget57"
android:layout_width="105px"
android:layout_height="55px"
android:text="-"
android:layout_x="361px"
android:layout_y="381px"
>
</Button>
<Button android:id="@+id/widget58"
android:layout_width="105px"
android:layout_height="55px"
android:text="*"
android:layout_x="361px"
android:layout_y="441px"
>
</Button>
<Button android:id="@+id/widget59"
android:layout_width="105px"
android:layout_height="55px"
android:text="/"
android:layout_x="361px"
android:layout_y="501px"
>
</Button>
<ImageView android:src="@drawable/icon"
android:layout_width="wrap_content"
 android:layout_height="wrap_content"
  android:layout_x="-5dip"
  android:layout_y="380dip"
   android:id="@+id/imageView1">
   </ImageView>
</AbsoluteLayout>
</AbsoluteLayout>
</ScrollView>
</HorizontalScrollView>

</AbsoluteLayout>

Friday, 16 September 2011

Installing new apk in android emulator using ubuntu.

Steps:

1.Go to sdk/platform-tools

Cmd:   cd  /home/android-sdk/platform-tools

2. List the devices

Cmd:   ./adb devices

Ex:    ./adb devices
List of devices attached
emulator-5554    device


3.To install

Cmd:  ./adb install .filename.apk

Ex:   ./adb install AndExplorer.apk
1083 KB/s (338651 bytes in 0.305s)
    pkg: /data/local/tmp/AndExplorer.apk
Success




Before Installation


 After Installation.



Work Done:


tec@tec-G41M-Combo:~$ sudo su
root@tec-G41M-Combo:/home/tec# cd /home/tec/
root@tec-G41M-Combo:/home/tec# chmod 777 -R android-sdk-linux_x86/
root@tec-G41M-Combo:/home/tec# clear

root@tec-G41M-Combo:/home/tec# cd android-sdk-linux_x86/platform-tools/
root@tec-G41M-Combo:/home/tec/android-sdk-linux_x86/platform-tools# ls3dspusbbus         dexdump        Maid with the Flaxen Hair.mp3
3dspusbwlan.ko     dhd.ko         NOTICE.txt
3dspusbwlanpriv    dmesg.log      Ny
aapt               dmesg_mod.txt  pdf
adb                dmesg.txt      sample
aidl               drive          Sleep Away.mp3
apps               Driver         source.properties
binary             driver_src     test2
BlueW-2310U_2.0.0  dx             untitled folder
con                img            uwb
config             lib            uwbtest
config~            llvm-rs-cc     wlan
root@tec-G41M-Combo:/home/tec/android-sdk-linux_x86/platform-tools# ./adb devices
List of devices attached
emulator-5554    offline

root@tec-G41M-Combo:/home/tec/android-sdk-linux_x86/platform-tools# ./adb devices
List of devices attached
emulator-5554    device

root@tec-G41M-Combo:/home/tec/android-sdk-linux_x86/platform-tools# ./adb install AndExplorer.apk
1083 KB/s (338651 bytes in 0.305s)
    pkg: /data/local/tmp/AndExplorer.apk
Success