Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 8 Jahren, 1 Monat
Letzter Beitrag:
vor 6 Jahren, 6 Monaten
Beteiligte Autoren:
Georgio, Arie, Alan S, HenryB.

How to access Android SDK (Contacts List example) - WM15 - New Video Link

Startbeitrag von Georgio am 18.06.2010 01:06

Hi All,

I posted another tutorial on youtube on how to access the contact list from an
Android phone in Windev Mobile 15.

[ Link removed - see below]

Hope this helps

Georgio

Antworten:

Re: How to access Android SDK (Contacts List example) - WM15

YouTube says it's too long and was removed.
Alan


von Alan S - am 18.06.2010 01:45

Re: How to access Android SDK (Contacts List example) - WM15

Hi All,

Sorry, the original post on youtube was removed because the video was about
a minute too long. Here's the edited version.

This is another example on how to access the contact list from an Android phone
in Windev Mobile 15

The new link is:

http://www.youtube.com/watch?v=_8f0YvAUfmc


Hope this helps

Georgio


How to access Android SDK (Contacts List example) - WM15 - New Video Link

von Georgio - am 18.06.2010 16:42
Hi All,

Just in case you watch the video before it finishes processing (as youtube video quality usually improves once processing is complete), I've posted the java code below:

(Of course, I explain what all this code means in the video)

Create a global procedure and click the WL to convert the code to a Java method:



import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;

public static String chkContacts()
{

String contactId = null;
String phoneNo = null;
String contactName = null;
String hasPhone = null;

ArrayList myArr = new ArrayList();

Context context = getApplicationContext();
Cursor cursor = context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

while (cursor.moveToNext()) {
contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));

if (Integer.parseInt(hasPhone)==1) {
Cursor phone = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null);

while (phone.moveToNext()){
phoneNo = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
}

myArr.add(contactName + ":" + phoneNo);
}
}

return myArr.toString();
}





And here's the code for the Button:



HourGlass(True)
sContactList is string = chkContacts()
HourGlass(False)

IF sContactList "" THEN
srecord is string = ExtractString(sContactList,firstRank,",")
WHILE srecord EOT
LooperAddLine(LOOP_Looper1,ExtractString(srecord,1,":"),ExtractString(srecord,2,":"))
srecord = ExtractString(sContactList,nextRank,",")
END
END




Any questions, please let me know.

Thanks!
Georgio



von Georgio - am 18.06.2010 16:52

Re: How to Connect to a Bluetooth device Android SDK - WM15

Hello Georgio,
I wondered if you had examples of connecting to a specific Bluetooth device and
sending output. We are trying to connect to a bluetooth printer and send text.
We are able to detect bluetooth devices (with your help in the youtube video). We
are also able to find out the paired device name and mac address.
I would appreciate any help using the Windev Mobile 15 and Javacode.

Thank you.
Henry B.

von HenryB. - am 01.03.2011 22:12
Georgio,
I tried your code and get this error

Error returned:
Note: src\nl\ariezona\km_box\wdgen\GWDCPSET_GlobalProcedures.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.


Can you tell me how to fix things like this?
(I'm definitely not a java guy....)


von Arie - am 23.12.2011 19:13

Re: SOLVED How to access Android SDK (Contacts List example) - WM15 - New Video Link

Found it already:

ArrayList myArr = new ArrayList();
must be
ArrayList myArr = new ArrayList();

This comes up in Java 5 and later if you're using collections without type specifiers

von Arie - am 23.12.2011 19:48
Hi Arie,

The error "Recompile with -Xlint:unchecked for details." is a compiler command
passed by windev. This works on older versions of java but has since been
depreciated.

I usually run compilation without the flags.

Thanks
Georgio

von Georgio - am 27.12.2011 18:02
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.