Game Development Reference
In-Depth Information
<uses-sdk
android:minSdkVersion= "20"
android:targetSdkVersion= "21" />
<application
android:allowBackup= "true"
android:icon= "@drawable/ic_launcher"
android:label= "@string/app_name"
android:theme= "@style/AppTheme" >
<activity
android:name= ".MainActivity"
android:label= "@string/app_name" >
<intent-filter>
<action android:name= "android.intent.action.MAIN" />
<category android:name= "android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The AndroidManifest.xml file contains information about the SDK version used and all the
rest of the specifications regarding the project, such as label, theme, and icon.
Next, let's have a look at the MainActivity component of our wearable project.
The file ch11.project.MainActivity.java is created by the wizard, and it is the entry point to
the phone application. Listing 11-2 shows the code for this file. There are some remarkable
things to note about this file.
As you probably know, when the application starts, the method onCreate(Bundle
savedInstanceState) will be invoked by Android, which will load the native library using
System.loadLibrary(name) .
Listing 11-2. Main Activity for This Chapter's Example
package ch11.project;
import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.widget.TextView;
public class MainAvtivity extends Activity {
private TextView mTextView;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
 
Search WWH ::




Custom Search