Skip to content

Instantly share code, notes, and snippets.

private void setView() {
viewList.add(tvContactDetails);
viewList.add(llContactDetails);
tvLocation.setText(event.getFull_address());
String phone = "";
if (!event.getMobile_phone().isEmpty()) {
phone = event.getMobile_phone();
if (!event.getTelephone().isEmpty()) {
phone = phone + "\n" + event.getTelephone();
}
<!-- SyncAdapter related -->
<string name="sync_account_type">syncadaptertutorial.example.com</string>
<string name="content_authority">com.fortyonestudio.syncadaptertutorial</string>
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/sync_account_type"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:smallIcon="@mipmap/ic_launcher" />
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@string/content_authority"
android:accountType="@string/sync_account_type"
android:userVisible="false"
android:supportsUploading="false"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true" />
package com.fortyonestudio.syncadaptertutorial;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
package com.fortyonestudio.syncadaptertutorial.services;
import com.fortyonestudio.syncadaptertutorial.model.DataWeather;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
/**
* Created by Riris.
package com.fortyonestudio.syncadaptertutorial.services;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
//import okhttp3.logging.HttpLoggingInterceptor;
import okhttp3.logging.HttpLoggingInterceptor;
package com.fortyonestudio.syncadaptertutorial.sync;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
@ririsrismawati
ririsrismawati / ExampleSyncService.java
Created June 13, 2016 06:38
SyncService for SyncAdapterTutorial
package com.fortyonestudio.syncadaptertutorial.sync;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
/**
* Created by Riris.
*/
@ririsrismawati
ririsrismawati / ExampleAuthenticatorService.java
Created June 13, 2016 06:33
ExampleAuthenticatorService for SyncAdapterTutorial
package com.fortyonestudio.syncadaptertutorial.sync;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
/**
* Created by Riris.
*/
public class ExampleAuthenticatorService extends Service {