Simple Activityjava

SimpleActivity.java (see Listing 13-20) is not an essential class for live folders, but its inclusion in the project gives you a common pattern for all your projects. Plus, it allows you to deploy the application and see it onscreen when you are debugging through Eclipse.

Listing 13-20. SimpleActivity Source Code public class SimpleActivity extends Activity {

^Override public void onCreate(Bundle savedlnstanceState) {

super.onCreate(savedlnstanceState); setContentView(R.layout.main);

You can use any simple XML layout that you would like for the main.xml identified by R.layout.main. Listing 13-21 shows an example.

Listing 13-21. Simple XML Layout File <?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent"

android:layout_height="fill_parent" >

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Live Folder Example" />

</LinearLayout>

Now you have all the classes you need to build, deploy, and run the sample live-folder project through Eclipse. Let us conclude this section on live folders by showing you what happens when you access the live folder.

0 0

Post a comment