In the Android SampleSyncAdapter there is the following piece of code:
/**
* Adds a profile action
*
* @param userId the userId of the sample SyncAdapter user object
* @return instance of ContactOperations
*/
public ContactOperations addProfileAction(long userId) {
mValues.clear();
if (userId != 0) {
mValues.put(SampleSyncAdapterColumns.DATA_PID, userId);
mValues.put(SampleSyncAdapterColumns.DATA_SUMMARY, mContext
.getString(R.string.syncadapter_profile_action));
mValues.put(SampleSyncAdapterColumns.DATA_DETAIL, mContext
.getString(R.string.view_profile));
mValues.put(Data.MIMETYPE, SampleSyncAdapterColumns.MIME_PROFILE);
addInsertOp();
}
return this;
}
I added this as filter for my activity
<intent-filter>
<action android:name="@string/syncadapter_profile_action" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.myapp.profile"
android:host="contacts" />
</intent-filter>
where SampleSyncAdapterColumns.MIME_PROFILE = vnd.android.cursor.item/vnd.myapp.profile
I added a contact and I can see the entry but when I click on it nothing happens. What should I do to start an activity when the user clicks on it?
I was trying to do what is suggested Here for Pre-honeycomb devices: The trick is to insert a data row, "Edit in MyApp", which would take the user to your app and your app
would then provide an editor activity
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…