Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SetcontentView错误充气异常_Java_Android - Fatal编程技术网

Java SetcontentView错误充气异常

Java SetcontentView错误充气异常,java,android,Java,Android,我编写了一个xml文件,每次编写时: setContentView(R.layout.all_items); 它显示一个错误并退出我的应用程序(InflateException) 我没有发现我的xml文件有任何问题 这是xml文件(所有项目): 其中第23行是: setContentView(R.layout.all_items); 我认为你的问题是: Caused by: java.lang.OutOfMemoryError 可能您存储在drawable中的图像尺寸较大,

我编写了一个xml文件,每次编写时:

    setContentView(R.layout.all_items);
它显示一个错误并退出我的应用程序(InflateException)

我没有发现我的xml文件有任何问题

这是xml文件(所有项目):

其中第23行是:

    setContentView(R.layout.all_items);

我认为你的问题是:

Caused by: java.lang.OutOfMemoryError

可能您存储在drawable中的图像尺寸较大,无法正确充气。尝试移除drawable并开始观察将发生的情况。

我认为您的问题在于:

Caused by: java.lang.OutOfMemoryError

可能您存储在drawable中的图像尺寸较大,无法正确充气。尝试删除drawable并开始观察将发生的情况。

请同时发布您的代码,这毫无意义!请也张贴您的代码,这是没有意义的!您好,我的图像是400X400,大小是83.2kB和JPEG,我有比这个大得多的图片one@AdirRahamim所以这可能是个问题,您在
Resources.loadDrawable()
中遇到了
OutOfMemory
的问题。我提到了如何尝试删除它们,看看会发生什么,让我知道。嗨,我的图像是400X400,大小是83.2kB和JPEG,我有比这个大得多的图片one@AdirRahamim所以这可能是个问题,您在
Resources.loadDrawable()
中遇到了
OutOfMemory
的问题。我提到如何尝试移除它们,并观察将发生什么,让我知道。
public class AllItemsActivity extends Activity {

    private Button allItemsButton;
    private Button 1Btn,2Btn,auctionBtn,3Btn,4Btn;


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.all_items);

        allItemsButton =(Button) findViewById(R.id.itemsAllItemsBtn);
        saleBtn =(Button) findViewById(R.id.items1Btn);
        2Btn =(Button) findViewById(R.id.items2Btn);
        3Btn =(Button) findViewById(R.id.items3Btn);
        4Btn =(Button) findViewById(R.id.items4Btn);
        auctionBtn =(Button) findViewById(R.id.itemsAuctionBtn);
        }
}
    setContentView(R.layout.all_items);
Caused by: java.lang.OutOfMemoryError