Subscribe via email

Enter your email address and get Latest Material :

Tag

%temp% Android Application to understand Activity Android Applicaton login button should remain disabled Android Program C Language GTU MCA Syllabus PPT/Notes C full ppt by keval nagaria C++ GTU MCA CPI/CGPA To Percentage Calculator Core JAVA GTU MCA Core Java Create Bootable USB flash Drive Using DISKPART utility Create USB Pen Drive Create an application that will create database with table of User credential. Create an application that will have spinner with list of animation names. On selecting animation name Create an application to call specific entered number by user in the EditText Create an application to make Insert Crimping DBMS GTU MCA Syllabus PPT/Note DISKPART DOS Command to Erase temp file DS GTU MCA Delete and retrieve operation on the database. Erase/Delete Temp file Ethernet FON GTU MCA FON Practical Solution FON Program Fundamental Of Networking GTU MCA PPT GTU Student FInd CPI/CGPA To Percentage Converter Intent Java Chapter Wise Slide Show For GTU MCA Student Sem-3 LAN Cable Online CPI/CGPA Converter/Calculator PL_SQL GTU MCA Syllabus PPT/Note RG45 Connector Read messages from the mobile and display it on the screen. SS(System Software) GTU MCA Understand Menu option. a. Create an application that will change color of the screen Understand resource folders : a. Create spinner with strings taken from resource folder b. On changing spinner value WTAD GTU MCA WTAD Practical Solution Web Technology And Application Development (WTAD) Windwos 7 USB Pen Drive application that will play a media file from the memory car application to send message between two emulators based on selected options from the menu. change image. delete temp file into C drive draw line on the screen as user drag his finger gtu mca android program open any URL inside the application and clicking on any link from that URl should not open Native browser but that URL should open the same screen. read file from asset folder and copy it in memory card. take picture using native application that animation should affect on the images displayed below. to pick up any image from the native application gallery and display it on the screen. update

Exercise : 21
Create an application to send message between two emulators.
Screen Shot:



XML :
main.xml :


             
    
         
              
    
JAVA :
TwentyOneActivity.java :

package kmn.TwentyOne;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class TwentyOneActivity extends Activity 
{
 /**  @author Y@@D  */
 Button btnSendSMS;
 EditText txtPhoneNo;
 EditText txtMessage;

 //@Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
        txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
        txtMessage = (EditText) findViewById(R.id.txtMessage);
        
        /*
        Intent sendIntent = new Intent(Intent.ACTION_VIEW);
        sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); 
        sendIntent.setType("vnd.android-dir/mms-sms");
        startActivity(sendIntent);
        */
                
        btnSendSMS.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {             
             String phoneNo = txtPhoneNo.getText().toString();
             String message = txtMessage.getText().toString();              
                if (phoneNo.length()>0 && message.length()>0)                
                    sendSMS(phoneNo, message);                
                else
                 Toast.makeText(getBaseContext(),"Please enter both phone number and message.", Toast.LENGTH_SHORT).show();
            }
        });        
    }
    
    //---sends a SMS message to another device---
    private void sendSMS(String phoneNumber, String message)
    {      
      
     String SENT = "SMS_SENT";
     String DELIVERED = "SMS_DELIVERED";
     
        PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT),0);
        
        
        PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0);
     
        //---when the SMS has been sent---
        registerReceiver(new BroadcastReceiver()
        {
  // @Override
   public void onReceive(Context arg0, Intent arg1) 
   {
    switch (getResultCode())
    {
        case Activity.RESULT_OK:
         Toast.makeText(getBaseContext(), "SMS sent",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
         Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
         Toast.makeText(getBaseContext(), "No service",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
         Toast.makeText(getBaseContext(), "Null PDU",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
         Toast.makeText(getBaseContext(), "Radio off",Toast.LENGTH_SHORT).show();
         break;
    }
   }
        }, new IntentFilter(SENT));
        
        //---when the SMS has been delivered---
        registerReceiver(new BroadcastReceiver()
        {
   //@Override
   public void onReceive(Context arg0, Intent arg1)
   {
    switch (getResultCode())
    {
        case Activity.RESULT_OK:
         Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show();
         break;
        case Activity.RESULT_CANCELED:
         Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show();
         break;         
    }
   }
        }, new IntentFilter(DELIVERED));        
     
        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);               
    }    
}
SmsReceiver.java :
package kmn.TwentyOne;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.widget.Toast;

public class SmsReceiver extends BroadcastReceiver
{
	/**  @author Y@@D */
	//@Override
	public void onReceive(Context context, Intent intent) 
	{
        //---get the SMS message passed in---
        Bundle bundle = intent.getExtras();        
        SmsMessage[] msgs = null;
        String str = "";            
        if (bundle != null)
        {
            //---retrieve the SMS message received---
            Object[] pdus = (Object[]) bundle.get("pdus");
            msgs = new SmsMessage[pdus.length];            
            for (int i=0; i


Step to Creat two emulator and send sms.

1)goto windows->Android SDK and AVD Mangaer.
2)creat two emulator and give the different name.
3)start emulator by clicking start button
3)now enter the emulator number to phone number and send it.

Note:- see the give OutPut Image..

Enjoy.........

Related Posts Plugin for WordPress, Blogger...