在android中创建bitmap避免内存不足的方法

本文介绍如何通过在AndroidManifest.xml文件中设置属性android:largeHeap=true来增大应用程序的堆内存分配,从而提高应用运行时能使用的最大内存。此配置特别适用于需要大量内存的应用场景,例如图像处理或游戏等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.miz.heapsize"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="11" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true" >
        <activity
            android:label="@string/app_name"
            android:name=".MainActivity" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
只需要加上<pre name="code" class="html">android:largeHeap="true"
 
 
可以生成48M的  哦耶
http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F8675037%2Fdoes-androids-large-heap-option-work-for-older-phones-upgraded-to-ics&sa=D&sntz=1&usg=AFQjCNE43aD9kOt0M5OUzNWaNGXP5pSM8w
 
 
 

转载于:https://www.cnblogs.com/tqj-zyy/p/4559751.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值