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
class HomeActivity : AppCompatActivity() { | |
private val USER_NAME = "Albert Eisten" | |
private val TIMER_SECONDS = 5 | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val binding: ActivityHomeBinding = DataBindingUtil.setContentView(this, R.layout.activity_home) | |
val user = User(USER_NAME) | |
binding.setVariable(BR.user, user) | |
binding.executePendingBindings() |
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 HomeActivityJava extends BaseActivityJava { | |
private final String USER_NAME = "Albert Eisten"; | |
private final int TIMER_SECONDS = 5; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ActivityHomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_home); | |
User user = new User(USER_NAME); | |
binding.setVariable(BR.user, 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
fun simpleMethod(param1: Int, param2: Int = 0) : Int { return param1 + param2 } |
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
someButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
btnActions() | |
} | |
}); |
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"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" | |
android:orientation="vertical" | |
android:layout_margin="40dp"> | |
<EditText |
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
class HomeActivity : Activity() { } |
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
someButton.setOnClickListener { view -> btnActions() } |
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
private fun btnSendActions(binding: ActivityHomeBinding) { | |
if (binding?.editTextUserName?.text?.toString()?.isNotBlank()!!) { | |
val intent = Intent(this, WelcomeActivity().javaClass) | |
intent.putExtra(EXTRA_PARAM_USER_NAME, binding.editTextUserName.text.toString()) | |
startActivity(intent) | |
return | |
} | |
val alert = AlertDialog.Builder(this).create() | |
alert.setMessage("Please, fill input correctly.") |
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
class HomeActivity : AppCompatActivity() { | |
val layoutFile = R.layout.activity_home | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val binding: ActivityHomeBinding = DataBindingUtil.setContentView(this, layoutFile) | |
binding?.btnSend?.setOnClickListener { btnSendActions(binding) } | |
} | |
} |
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
if ( binding != null | |
&& binding.editTextUserName != null | |
&& binding.editTextUserName.getText() != null | |
&& binding.editTextUserName.getText().toString() != null | |
&& binding.editTextUserName.getText().toString().length() > 0 ) |
OlderNewer