为了账号安全,请及时绑定邮箱和手机立即绑定

地图活动的意图问题 - 如何解决?

地图活动的意图问题 - 如何解决?

开心每一天1111 2022-06-04 14:51:15
我需要创建一个必须在下周通过的活动。活动是用 2 个按钮(相机和地图)制作一个主页,这意味着我必须使用意图功能来工作这个应用程序。但是我有一个问题,相机按钮可以正常工作,但我的地图无法正常工作,这就是我在这里寻求帮助的原因。我试过地图=(Button) findViewById(R.id.map);        map.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View v)            { openMapsActivity();            }        });然后public void openMapsActivity() {        Intent intent = new Intent(this, MapsActivity.class);        startActivity(intent);    }
查看完整描述

1 回答

?
呼唤远方

TA贡献1856条经验 获得超11个赞

像这样更新您的清单应用程序:


<application

    android:allowBackup="true"

    android:icon="@mipmap/ic_launcher"

    android:label="@string/app_name"

    android:roundIcon="@mipmap/ic_launcher_round"

    android:supportsRtl="true"

    android:theme="@style/AppTheme">


    <!--

         The API key for Google Maps-based APIs is defined as a string resource.

         (See the file "res/values/google_maps_api.xml").

         Note that the API key is linked to the encryption key used to sign the APK.

         You need a different API key for each encryption key, including the release key that is used to

         sign the APK for publishing.

         You can define the keys for the debug and release targets in src/debug/ and src/release/.

    -->

    <meta-data

        android:name="com.google.android.geo.API_KEY"

        android:value="@string/google_maps_key" />


    <activity

        android:name=".MainActivity"

        android:label="@string/title_activity_maps">

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />


            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

    </activity>

   <activity

        android:name=".MapsActivity"

        android:screenOrientation="portrait" />

</application>


查看完整回答
反对 回复 2022-06-04
  • 1 回答
  • 0 关注
  • 122 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号