【问题标题】:(Android Studio) E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae6b28f0(Android Studio) E/Surface:getSlotFromBufferLocked:未知缓冲区:0xae6b28f0
【发布时间】:2016-11-23 16:35:18
【问题描述】:

您好,我在尝试使用 android studio 在模拟器 (Nexus 5 API 23) 中模拟我的应用程序时收到此消息。

这是我的代码

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.shalahuddinn.menurestoran">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
        </activity>
        <activity android:name=".splashscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

splashscreen.java

package com.example.shalahuddinn.menurestoran;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class splashscreen extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splashscreen);
    Thread thread = new Thread() {
        public void run() {
            try {
                sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                startActivity(new Intent(splashscreen.this, MainActivity.class));
                finish();
            }
        }
    };
    thread.start();
}
}

MainActivity.java

package com.example.shalahuddinn.menurestoran;

import android.icu.text.NumberFormat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import java.util.Locale;

public class MainActivity extends AppCompatActivity {

Integer qB2 = 0;
Integer pB2;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}
public void decrementB2 (View view) {
    if (qB2>0) {
        qB2 = (qB2 - 1);
        displayB2(qB2);
        pB2 = qB2*50000;
        displaypriceB2(pB2);
    }
}

public void incrementB2 (View view) {
        qB2 = (qB2 + 1);
        displayB2(qB2);
        pB2 = qB2*50000;
        displaypriceB2(pB2);

}

private void displayB2(Integer number) {
    TextView quantityB2TextView = (TextView) findViewById(
            R.id.quantityB2);
    quantityB2TextView.setText("" + number);
}

private void displaypriceB2(Integer number) {
    TextView priceB2TextView = (TextView) findViewById(
            R.id.totalpriceB2);
    priceB2TextView.setText("Rp "+NumberFormat.getNumberInstance(Locale.GERMANY).format(number));
}



}

问题是来自启动画面吗?

【问题讨论】:

    标签: java android screen splash-screen


    【解决方案1】:

    这是Android OS运行marshmallow的错误,与你的代码无关,见这个问题https://code.google.com/p/android/issues/detail?id=192357

    尝试使用 API 24 或 25 创建新的模拟器

    【讨论】:

      猜你喜欢
      • 2023-03-08
      • 2016-10-30
      • 1970-01-01
      • 2015-12-10
      • 2016-02-16
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多