13

シェア インテント アクティビティを使用してアプリから位置情報を共有する必要があります。いくつかの例を見て、シェア インテントを実装する方法を知っています。しかし、私は setType で立ち往生しています。場所の詳細と地図上のユーザーの場所を共有するアプリケーションが必要です。

ところで、私は非常によく似た質問「無罪」でユーザーコードをコピーしました

どんな援助でも本当に感謝します。

Intent intent1 = new Intent(Intent.ACTION_SEND); 
intent1.setType("text/plain"); 
intent1.putExtra(Intent.EXTRA_TEXT, "The status update text"); 
startActivity(Intent.createChooser(intent1, "Select prefered Service")); 
4

3 に答える 3

15

場所を指定して地図にインテントを送信するコードは次のとおりです。

String uri = "geo:" + latitude + ","
                    +longitude + "?q=" + latitude
                    + "," + longitude;
startActivity(new Intent(android.content.Intent.ACTION_VIEW,
                    Uri.parse(uri)));
于 2012-10-01T07:03:24.923 に答える
10
Double latitude = user_loc.getLatitude();
Double longitude = user_loc.getLongitude();

String uri = "http://maps.google.com/maps?saddr=" +latitude+","+longitude;

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String ShareSub = "Here is my location";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ShareSub);
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, uri);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
于 2014-10-24T11:57:42.997 に答える