您好我在尝试使用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));
}
}
问题来自于闪屏吗?
答案 0 :(得分:3)
这是运行marshmallow的Android操作系统的错误,与您的代码无关,请参阅此问题https://code.google.com/p/android/issues/detail?id=192357
尝试使用API 24或25
创建新的模拟器