![]() ![]() In the onCreate method, set the user interface using the setContentView method and the layout resource: setContentView(R.layout.main) The onCreate(Bundle savedInstanceState) method is invoked when the activity is started. In the RSSFeed class, define a variable to output the RSS feed: String rssResult = "" Recall that the RSSFeed class extends Activity. Start by importing the following classes: Next we'll use the to parse our RSS feed. The RSSFeed activity, the intent-filter, and action are specified with the activity element and sub-elements, as shown in Listing 2. Specify the minimum Android version with the uses-sdk element. Add the following uses-permission element: To access the RSS feed from the Web on an Android device we need to enable the permission in AndroidManifest.xml, which allows applications to open network sockets. In AndroidManifest.xml, specify the Activity to launch as RSSFeed. Specifying the layout of Android UI components Add a TextView element, with id " rss" to display the RSS feed. Create a LinearLayout and set android:orientation as " vertical." Our goal is to display the RSS feed as a text message, so add a TextView element for the title of the RSS feed and specify android:text as a Google RSS Feed. In res/layout/main.xml, specify the layout of the Android UI components. An AndroidManifest.xml file, which contains application configuration such as the package name, the main activity to launch when the Android application is started, application components, processes, permissions, and the minimum API level.A res/layout/main.xml file, which specifies the layout of the Android UI components.An activity class ( RSSFeed), which extends Activity.The resulting Android project will consist of the following files: The class extending the Activity class creates a window for a UI. Note that an activity (Step 6) represents a user interaction. Specify the minimum SDK version as 10 and click Next or, if you've selected the Platform 3.0 API 11, then specify the minimum SDK Version as 11.Select the checkbox: Create Activity, and specify the Activity class ( RssFeed). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |