开发者

how to call google map class from another activity class in android?

I have one application. I need to display map view when we click on map button. Actually this map button is in one class and google map is in another class. Now How can we call one map activity clas开发者_开发百科s from another activity class.

Please help me!


For the button, in the xml layout, set android:clickable="true" and android:onClick="showMap", then in your first activity/class, it's like this:

public void showMap(View v) {
    Intent intent = new Intent(this, Map.class);
    startActivity(intent);
}

(Map.class being the class/name of your activity with the map. You need to adjust the name to your case.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜