开发者

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

开发者 https://www.devze.com 2023-01-05 00:44 出处:网络
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开

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

精彩评论

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

关注公众号