The very
first step is setting up the development environment with SDK, Tools and
configuring them correctly. I think, Building
Your First App is the first place you need to go to understand what SDK,
Tools are required and how to configure them.
Once you have
completed your "Hello World" app and some of the tutorial android
apps, you are almost ready to see how you can create a simple mapping
application to view Map served from Autodesk Infrastructure Map Server.
In this
example I used WebView
class from Android APIs. Here is the code snippet :
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class AIMSWebViewActivity extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// This initializes the member WebView
// with the one from the Activity layout;
// requests a WebSettings object with getSettings();
// and enables JavaScript for the WebView with
// setJavaScriptEnabled(boolean).
// Finally, an initial web page is loaded with loadUrl(String).
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.loadUrl("http://www.MyAIMSSite.com/MapView/");
// setContentView(mWebView); // this works too
mWebView.setWebViewClient(new HelloWebViewClient());
}
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}
Screenshot of
Android AIMS Map View application :
And here is a
short video of the same running in Emulator.
I hope this
is useful to you!


Leave a Reply