Page 79

Android Programming Cookbook

71 / 143

Figure 4.4: Add an activity to Mobile. Choose: Add no activity. Now, our project has just been created!

4.2

Create the layout and the source code of a simple AndroidStartServiceOnBoot Activity

Add a new Java class Activity inside src/com.javacodegeeks.androidserviceonbootexample/ so that we are going to have the src/com.javacodegeeks.androidserviceonbootexample/AndroidCustomFontExample. java file and paste the code below. MainActivity.java package com.javacodegeeks.androidserviceonbootexample; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }

main.xml

SKY MAGZ  

This is Yahya Christian School Magazine

Advertisement