Android - 如何将本地图像嵌入到活动中并在4.2+上使用Photo Sphere进行显示?

时间:2013-07-06 23:32:31

标签: android imageview photosphere

我正在尝试将照片球体图像加载到活动中,并像在图库中一样查看它。我似乎无法在网络上的任何地方找到任何此功能的示例或示例。

Documentation PanoramaClient

关于如何实现这一目标的想法,示例,代码集或建议?

1 个答案:

答案 0 :(得分:0)

announcement posts for the Photo Sphere API详细说明了如何从URI加载PhotoSphere:

// This listener will be called with information about the given panorama.
OnPanoramaInfoLoadedListener infoLoadedListener =
  new OnPanoramaInfoLoadedListener() {
    @Override
    public void onPanoramaInfoLoaded(ConnectionResult result,
                                 Intent viewerIntent) {
        if (result.isSuccess()) {
            // If the intent is not null, the image can be shown as a
            // panorama.
            if (viewerIntent != null) {
                // Use the given intent to start the panorama viewer.
                startActivity(viewerIntent);
            }
        }

        // If viewerIntent is null, the image is not a viewable panorama.
    }
};

// Create client instance and connect to it.
PanoramaClient client = ...
...

// Once connected to the client, initiate the asynchronous check on whether
// the image is a viewable panorama.
client.loadPanoramaInfo(infoLoadedListener, panoramaUri);

请注意,这会在他们的查看器中打开Photo Sphere - 您的Activity中没有内置的Photo Sphere查看器。