Let's update MainActivity to look like this:
@BindView(R.id.hello_world_salute)
TextView helloText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
Observable.just("Hello! Please use this app responsibly!")
.subscribe(new Consumer<String>() {
@Override
public void accept(String s) {
helloText.setText(s);
}
});
}
The import block for the preceding code is as shown:
import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
If you are in doubt as to which imports are used at any point in the book, feel free to check out the code that's provided with the book.
The contents of activity_main.xml at the moment are set to the following:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
tools:context="packt.reactivestocks.MainActivity">
<TextView
android:id="@+id/hello_world_salute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</RelativeLayout>
This will create a very basic screen with a single text element that will say "Hello! Please use this app responsibly!".