Follow some steps with the Contact custom field.

I added a custom field for my contacts. It consists of:

<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android"> <ContactsDataKind android:icon="@drawable/ic_launcher" android:mimeType="vnd.android.cursor.item/vnd.com.mob.my_new.profile" android:summaryColumn="data2" android:detailColumn="data3" android:detailSocialSummary="true" /> 

till. I want to perform some action (for example, start an action) when a user selects this my field in Android Contacs. How can i implement this? (It will look like a custom facebook field - shows a profile page)

+6
android contacts
source share
1 answer

I have found the answer. We can implement such functions: 1) creating a new type of contacts (see the link at the end of the answer);

2) creating an Activity that will perform this action:

 if (getIntent().getData() != null) { Cursor cursor = managedQuery(getIntent().getData(), null, null, null, null); if (cursor.moveToNext()) { String username = cursor.getString(cursor.getColumnIndex("DATA1")); TextView tv = (TextView) findViewById(R.id.profiletext); tv.setText("This is the profile for " + username); } } else { // How did we get here without data? finish(); } 

3) adding a special intent to the Activity in our Manifest.xml:

 <activity android:name=".ProfileActivity" android:label="Profile"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.item/vnd.org.c99.SyncProviderDemo.profile" /> </intent-filter> </activity> 

The answer (and the full tutorial) was found here .

+11
source share

All Articles