Android Development Training – Building Your First App

Understand basic XML compontents of Android user interface

– AndroidManifest.xml – I think this is the first xml to run before the main_layout.xml files
– fragment_main.xml – main view layout, viewgroup that holds views
– strings.xml – xml document that holds layout string object
– R.id.something something – resource file that holds references to your apps resource object.

Is the viewgroup container that holds the elements you see on screen ie; buttons, text fields?

Yes the viewgroup is a container that holds the elements you see on screen like buttons and text fields. It appears that these elements are referred to as views.

initial ultimate goal – create a button that calls a java resourse.

After having no luck opening my app in the AVD (android virtual device) and on my tablet I decided to start from scratch. The app would install but would not open automatically nor display an icon anywhere in the launcher. I decided to go into the android SDK manager and install Android 4.4.2 API 19 Kitkat SDK rather than 4.4W (wear stupid) or L 20 api preview.

This time I created a new project and chose activity and fragment rather than blank activity. The tutorials directed me to choose blank activity however not fragment_main.xml was included when creating the project.

It appears that eclipse and Android need to be properly updated to fix the lack of frangment_main.xml and activity_main.xml

I tried with the windows version and got the same result. I think I will just have to accept the fact that I will be creating my own fragment and main xml layouts

After speaking with a developer at Bitter, I decided it best I downloaded the Android studio. He suggested that the tutorial written online are already geared for the new Android Studio. I did the initial tutorial and I was able to get the app running on my tablet and virtual device.

Saturday August 08 2015.

Activities are the java component of an android app. The XML layout could be considered the swing aspect of the application. Viewgroups can be considered the containers and views can be considered the components. Like swing, the view or component has to call the activity.

Q: Where do we define the activity or in other words; how do we point to the java file that we are going to use?

A: The newActivity.java is declared in the AndroidManifest.xml as an <activity> element within the <application> element

Q: How do we activate the new Activity?

A: android:onClick=”sendMessage”/> call the sendMessage() method in the MainActivity.java file.

Q: How does it know to call the sendMessage() method in the MainActivity.java?

A: I’m guessing because MainActivity is set as the context in the LinearLayout element at the line tools:context=”com.example.firstproject.MainActivity”

 

Leave a comment