Hi All,
      I have tried it. But message is not getting displayed in
logcat.Actually i am using 2 emulator at a time. so is this a reason for not
working?
Thank you.

On Tue, Mar 15, 2011 at 1:43 PM, cuil yahoo <[email protected]> wrote:

> System.out.println won't work here.
> Use Log.d("Tag", "String") for printing inside the logcat.
>
> --
> Cuil
>
>
>
> On Tue, Mar 15, 2011 at 1:12 PM, kajal patil <[email protected]>wrote:
>
>> Hi All,
>>               I have problem in displaying message on logcat.I tried
>> different ways  but i didn't get my application as working.So i m also
>> posting my code.I have two files send.java and receive.java.From send.java i
>> sent information like first name,last name from my application to another
>> emulator which considered it as a message. i want to display some string on
>> console after receiving message but its not working for me.Please kindly
>> suggest the solution.
>> Thank you.
>>
>> //Receive.java
>> package com.example;
>> import java.util.StringTokenizer;
>> import android.util.Log;
>> import android.os.Bundle;
>> import android.content.BroadcastReceiver;
>> import android.content.Context;
>> import android.content.Intent;
>> import android.telephony.SmsMessage;
>> import android.widget.Toast;
>>
>> public class receive extends BroadcastReceiver
>> {
>>        public void onReceive(Context context, Intent intent)
>>        {
>>         //---get the SMS message passed in---
>>         Bundle bundle = intent.getExtras();
>>         SmsMessage[] msgs = null;
>>         String name="",mobile=" ",address="",skill="",salary="";
>>         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<msgs.length; i++){
>>
>>                 msgs[i] =
>> SmsMessage.createFromPdu((byte[])pdus[i]);
>>                 str += "SMS from " +
>> msgs[i].getOriginatingAddress();
>>                 str += " :";
>>                 str += msgs[i].getMessageBody().toString();
>>                 str += "\n";
>>
>>             }
>>
>>             //HERE I am trying to display this message.But its not
>> working.
>>
>>             //Log.d("string1", "string2");
>>            System.out.println("string");
>>
>>
>>             StringTokenizer st = new StringTokenizer(str);
>>             while (st.hasMoreTokens()) {
>>                 String token=st.nextToken();
>>                       if(token.equalsIgnoreCase("name:"))
>>                       {
>>                                token=st.nextToken();
>>                                while(token.equals("address:")==false)
>>                                {
>>                                           name=name+" "+token;
>>                                           token=st.nextToken();
>>                                }
>>                     }
>>                     if(token.equals("address:"))
>>                     {
>>                         token=st.nextToken();
>>                         while(token.equals("skill:")==false)
>>                         {
>>                              address=address+" "+token;
>>                             token=st.nextToken();
>>                         }
>>                     }
>>
>>                     if(token.equals("skill:"))
>>                     {
>>                         token=st.nextToken();
>>                         while(token.equals("mobile no:")==false)
>>                         {
>>                            skill=skill+" "+token;
>>                             token=st.nextToken();
>>                         }
>>                     }
>>
>>                     if(token.equals("mobile no:"))
>>                     {
>>                         token=st.nextToken();
>>                         while(token.equals("salary:")==false)
>>                         {
>>                             mobile=mobile+" "+token;
>>                             token=st.nextToken();
>>                         }
>>                     }
>>
>>                 }
>>             }
>>
>>             //HERE I am also trying
>>
>>             System.out.println("b4 uima");
>>             Uima obj=new Uima();
>>             obj.printProducts1(str, name, address, skill);
>>             System.out.println("after uima");
>>             //---display the new SMS message---
>>             Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
>>         }
>>     }
>> }
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to