Chapter 19 (Lecture 1) Example 19 -- panorama HelloWorld, 19 -- helloworld

Source: Internet
Author: User

Chapter 19 (Lecture 1) Example 19 -- panorama HelloWorld, 19 -- helloworld

Category: C #, Android, Baidu map application; date:

Baidu panorama is a real-world map service. Provides users with 360-degree panoramic images of cities, streets, and other environments. You can use this service to get a map browsing experience like this.

This example shows how to use Baidu Android panoramic SDK v2.2 to retrieve, display, and interact panorama, so as to clearly and conveniently display the surrounding environment of the target location.

Before presenting a complete panorama example in the next section, let's take a look at the implementation of the panorama with the simplest getting started code. I. Run

This example runs as follows:

Ii. Design Steps

1. Add the demo19_panodemo_Simple.xml file.

Add the file in the layout folder and change the code to the following content:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical">  <com.baidu.lbsapi.panoramaview.PanoramaView      android:id="@+id/panorama"      android:layout_width="match_parent"      android:layout_height="wrap_content"      android:clickable="true" /></LinearLayout>

2. Add the Demo19PanoHelloWorld. cs file.

Add the file in the SrcSdkDemos folder and change its content to the following code:

Using Android. app; using Android. content. PM; using Android. OS; using Android. widget; using Com. baidu. lbsapi. panoramaview; using Com. baidu. lbsapi; namespace BdMapV371Demos. srcSdkDemos {[Activity (Label = "@ string/demo_name_panorama_hello", ConfigurationChanges = ConfigChanges. orientation | ConfigChanges. keyboardHidden, ScreenOrientation = ScreenOrientation. sensor)] public class Demo19PanoHelloWorld: Activity, IMKGeneralListener {private PanoramaView mPanoView; private BMapManager mBMapManager; protected override void OnCreate (Bundle savedInstanceState) {base. onCreate (savedInstanceState); mBMapManager = new BMapManager (ApplicationContext); mBMapManager. init (this); SetContentView (Resource. layout. demo19_panodemo_Simple); mPanoView = FindViewById <PanoramaView> (Resource. id. panorama); var a = MainActivity. heNanUniversity; mPanoView. setPanorama (. longpolling,. latitude);} public void OnGetPermissionState (int p0) {// because the MainActivity has verified the key, no code needs to be added here} protected override void OnPause () {base. onPause (); mPanoView. onPause ();} protected override void OnResume () {base. onResume (); mPanoView. onResume ();} protected override void OnDestroy () {base. onDestroy (); mPanoView. destroy (); mBMapManager. dispose ();}}}

3. Modify the MainActivity. cs File

In the demos field definition of the MainActivity. cs file, remove the comment below [Example 19.

Run and drag and drop the mouse in the simulator to observe the 360-degree rotation effect.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.