Skip to content

Instantly share code, notes, and snippets.

@brunoazevedomendonca
Created September 6, 2017 16:35
Show Gist options
  • Save brunoazevedomendonca/930cc6895da1dbce9ea54d8d5f6f0caf to your computer and use it in GitHub Desktop.
Save brunoazevedomendonca/930cc6895da1dbce9ea54d8d5f6f0caf to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txTexto"
android:textSize="30sp"
android:layout_margin="16dp"/>
</LinearLayout>
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
exibe("Hello World!");
}
private void exibe(String texto){
TextView textView = (TextView) findViewById(R.id.txTexto);
textView.setText(texto);
}
private void exibe(int numero){
exibe(String.valueOf(numero));
}
private void exibe(double numero){
exibe(String.valueOf(numero));
}
private void exibe(float numero){
exibe(String.valueOf(numero));
}
private void exibe(char letra){
exibe(String.valueOf(letra));
}
private void exibe(boolean condicao){
exibe(String.valueOf(condicao));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment