Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<android.support.constraint.ConstraintLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
public class MainActivity extends AppCompatActivity {
public static final ArrayList<String> TABS_TITLE = new ArrayList<>();
private static final String FRAGMENT_MAP_TITLE = "Map";
private static final String FRAGMENT_LIST_TITLE = "List";
/* */
private FragmentPoisBinding mBinding;
/* */
public class PoisViewModel extends ViewModel {
private LiveData<List<Poi>> mData;
@Inject
public PoisViewModel(PoisRepository repository) {
mData = repository.getObservableAllPois();
}
public LiveData<List<Poi>> getObservableAllPois() {
@Entity(tableName = "pois")
public class Poi {
@PrimaryKey
private String id;
private String title;
private String description;
private long timestamp;
private double locationLat;
private double locationLng;
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto">
<data>
<variable name="user" type="it.communikein.myunimib.User"/>
</data>
<merge>
<include layout="@layout/name"
bind:user="@{user}"/>
<include layout="@layout/contact"
public class UserDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DataBindingIncludeMainLayout mBinding = DataBindingUtil
.setContentView(this, R.layout.data_binding_include_main_layout);
User user = new User("username", "password");
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="secondaryUser"
type="it.communikein.myunimib.User" />
</data>
@communikein
communikein / data_binding_include_main_layout.xml
Last active December 28, 2017 10:28
Main layout with data binding. It includes a secondary layout and pass to it a variable.
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:bind="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="mainUser"
type="it.communikein.myunimib.User" />
12-20 14:27:38.602 2122-2302/? I/PGServer: report state:10000 event type:1 pid:0 uid:0 pkg:com.google.android.googlequicksearchbox to pid: 1064
12-20 14:27:38.602 2122-2302/? I/PGServer: report state:10000 event type:1 pid:0 uid:0 pkg:com.google.android.googlequicksearchbox to pid: 2122
12-20 14:27:38.603 2122-2302/? I/SceneReceiver: state type: 10000 eventType:1 pid:0 uid:0 pkg:com.google.android.googlequicksearchbox
12-20 14:27:38.603 1064-13043/? W/AudioEffectLowPowerTaskImpl: onStateChanged, stateType = 10000, eventType = 1, pid = 0, pkg = com.google.android.googlequicksearchbox, uid = 0
12-20 14:27:38.614 498-3278/? E/BufferQueueProducer: [com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity] connect: already connected (cur=1 req=1)
12-20 14:27:38.615 7752-7752/? I/GoogleInputMethod: onFinishInput() : Dummy InputConnection bound
12-20 14:27:38.615 7752-7752/? I/GoogleInputMethod: onStartInput() : Dummy InputConnection bound
12-20 14:27:38.732 2122-2302/? I/PGS