This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<data> | |
<import type="android.view.View"/> | |
</data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
<data> | |
<variable | |
name="user" | |
type="com.ladwa.aditya.databinding_blitzkrieg.User"/> | |
<variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); | |
//Set presenter binding | |
binding.setPresenter(new Presenter(this)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Presenter { | |
private Context context; | |
public Presenter(Context context) { | |
this.context = context; | |
} | |
public void onClickMethod(View view) { | |
Toast.makeText(this.context, "Clicked Method reference button", Toast.LENGTH_SHORT).show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<variable | |
name="presenter" | |
type="com.ladwa.aditya.databinding_blitzkrieg.Presenter"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClickReference(User user) { | |
Toast.makeText(this.context, "Clicked Listener method " + user.getFirstName() + user.getLastName(), Toast.LENGTH_SHORT).show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClickMethod(View view) { | |
Toast.makeText(this.context, "Clicked Method reference button", Toast.LENGTH_SHORT).show(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); | |
User user = new User("Aditya", "Ladwa", 22); | |
binding.setUser(user); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
private final String firstName; | |
private final String lastName; | |
private final int age; | |
public User(String firstName, String lastName, int age) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.age = age; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
<data> | |
<variable | |
name="user" | |
type="com.ladwa.aditya.databinding_blitzkrieg.User"/> | |
</data> |