I am trying to do something like this. Have you decided this? I think I have to do it manually! I think that use the phone number as a login (not all companies store the number on the phone), and then compare the message number with the registered number. On the layout you can have something like this:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:weightSum="1.0" > <TextView android:id="@+id/txtMessageDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginBottom="5dip" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:layout_marginTop="10dip" android:maxWidth="250dip"/> <TextView android:id="@+id/txtMessageRight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/righttext" android:layout_marginLeft="16dp" android:maxWidth="250dip" /> <TextView android:id="@+id/txtMessageLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginLeft="37dp" android:layout_toRightOf="@+id/lefttext" android:maxWidth="250dip"/> </RelativeLayout>
Write down the number that you can find out if the number, if from your number or from another number of the party, so in the code you can inflate the layout and using "if" you can write your name or the name of the contact. Something like this:
if(o.getOriginatingAddress().equals(MainActivity.loggedNumber)) tvOutMessage.setText("me: " + o.getMessageBody()); else tvInMessage.setText("contact:" + o.getMessageBody());
I do not know if this is the best solution, but I hope this helps.
source share