分享谷歌地图或采取截屏Android手机 [英] Sharing Google maps or taking screen shot of android phone

查看:687
本文介绍了分享谷歌地图或采取截屏Android手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Android的谷歌地图API第2版开发Android应用程序。 我目前取得的成绩如下

- 打开谷歌地图,显示用户的位置

-as他走,他可以添加标记到地图(标记的地方,他路过)

- 他可以删除标记,或将它们拖到

我想现在要做的就是

当用户完成对社交网络的散步,他/她可以(在它自己的标记!)分享他们的地图>>实为主。

这可能吗?以及如何人民共享的地图?

如果没有,有没有方法可以让我在东边采取了截屏图,在本地SD保存为IMG和分享的facebook?

请问AP preciate您的建议! 更新 试图用这种方法onSnapshotReady(位图快照),但我的应用程序崩溃,当我点击IMGE按钮3是应该调用button_listener()。请帮助!

 私人无效button_listener(){
            Button按钮=(按钮)findViewById(R.id.imageButton3);
            button.setOnClickListener(新View.OnClickListener(){
                @覆盖
                公共无效的onClick(视图v){
                SnapshotReadyCallback回调=新SnapshotReadyCallback(){
                        点阵位图;

                        公共无效onSnapshotReady(位图快照){
                            // TODO自动生成方法存根
                            位=快照;
                            尝试 {
                                   FileOutputStream中出=新的FileOutputStream(到/ mnt / SD卡/下载/ TeleSensors.png);
                                   bitmap.com preSS(Bitmap.Com pressFormat.PNG,90,出);
                            }赶上(例外五){
                                   e.printStackTrace();
                            }
                        }
                    };

                    mMap.snapshot(回调);}
 

解决方案

喜的谷歌地图API V2为Android有一个方法拍摄快照,请检查上述文件<一个href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.SnapshotReadyCallback" rel="nofollow">https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.SnapshotReadyCallback

I'm developing android app using android google map api v2. I have achieved following so far

-opens google map showing user's location

-as he walks he can add markers to the map (marking the places he pass by)

-he can remove markers or drag them

What I want to do now is

when the user finishes the walk he/she can share their map (with their marker on it!)on social networks>>mainly Facebook.

Is that possible? and how do people share maps?

If not, is there a way I can at east take a screen shot of the map,save it locally on SD as an img and share it of facebook?

Would appreciate your suggestions! Update Tried to use this method onSnapshotReady(Bitmap snapshot) but my app crashes when I click the imge button3 that is supposed to call button_listener().help please!

private void button_listener() {
            Button button = (Button) findViewById(R.id.imageButton3);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                SnapshotReadyCallback callback = new SnapshotReadyCallback() {
                        Bitmap bitmap;

                        public void onSnapshotReady(Bitmap snapshot) {
                            // TODO Auto-generated method stub
                            bitmap = snapshot;
                            try {
                                   FileOutputStream out = new FileOutputStream("/mnt/sdcard/Download/TeleSensors.png");
                                   bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
                            } catch (Exception e) {
                                   e.printStackTrace();
                            }
                        }
                    };

                    mMap.snapshot(callback);}

解决方案

Hi the Google maps api v2 for android have a method for take a snapshot please check this documentation https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.SnapshotReadyCallback

这篇关于分享谷歌地图或采取截屏Android手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆