-
Notifications
You must be signed in to change notification settings - Fork 56
Hello World Android
The code of this app can be found on: Hello World App Code Source
- File -> new -> Android App Project
- Using the wizard you'll have a project with the following aspect:
- Now you must add the G3M libraries to your project:
- Right button over your project-> build path -> configure build path
- Click on Android and add the G3MAndroidSDK
##Starting with the app
Documentation about this file could be find here: Android Manifest File
For correct work of the g3m apps you must to put on manifest the following labels:
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
And on the app label:
android:largeHeap="true"
You can put the map wherever on the Android app, for example you can use a LinearLayout to put the map in:
With this code we will have a map in a complete screen, all this stuff is Android common code.
Layout Code
In the main activity of your android class:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
final G3MBuilder_Android builder = new G3MBuilder_Android(this);
G3MWidget_Android g3mWidget = builder.createWidget();
final LinearLayout layout = (LinearLayout) findViewById(R.id.glob3);
layout.addView(g3mWidget);
}
You have to declare a Builder. G3M follow the design pattern Builder
Builder Pattern
After declare the builder , you can build the widget as you want (This is the minimal code) simply setting parameters.
Finally you create the Widget with --> builder.createWidget();
Finally you add the G3MWidget_Android (This object is an Android View) to your defined layout
Execute your app and you will have:



