BEGINNER’S GUIDE TO MOBILE APP DEVELOPMENT IN ANDRIOD STUDIO
Finally, let‟s place a TextView below the ImageView in which we‟ll display the orientation angle in real time. I set its ID as tv_degrees (short for TextView_degrees), and made it 24sp with a bold text as shown below:
Figure 8.7. Adding the TextView to display the orientation angle
8.3. Writing the Main Code of the App We completed the design of the user interface and now ready to continue with the coding. Please open the MainActivity.java file in Android Studio. This file will have the default contents as follows: package com.example.atomic.compassapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } Code 8.3 148