我得到这个错误
维护活动2。JAVA
public class MainActivity2 extends AppCompatActivity {
private TextView lengteSteenInput;
private TextView muurdikteInput;
private TextView hoogteSteenInput;
private TextView lagenmaatInput;
private TextView stootvoegInput;
private TextView aantalMInput;
private TextView metselzand;
private TextView voegzand;
private TextView portlandcement;
private TextView metselcement;
private TextView stenen;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Bundle bundle = getIntent().getExtras();
//transporting the variables from MainActivity.java to MainActivity2.java
lengteSteenInput = findViewById(R.id.lengteSteenInput); //this is where it says it gets the error
muurdikteInput = findViewById(R.id.muurdikteInput);
hoogteSteenInput = findViewById(R.id.hoogteSteenInput);
lagenmaatInput = findViewById(R.id.lagenmaatInput);
stootvoegInput = findViewById(R.id.stootvoegInput);
aantalMInput = findViewById(R.id.aantalMInput);
float lengteSteenF = bundle.getFloat("lengtesteen");
float muurdikteF = bundle.getFloat("muurdikte");
float hoogteSteenF = bundle.getFloat("hoogtesteen");
float lagenmaatF = bundle.getFloat("lagenmaat");
float aantalM2F = bundle.getFloat("aantalm2");
String stootvoegB = getIntent().getStringExtra("stootvoeg");
lengteSteenInput.setText(String.valueOf(lengteSteenF));
muurdikteInput.setText(String.valueOf(muurdikteF));
hoogteSteenInput.setText(String.valueOf(hoogteSteenF));
lagenmaatInput.setText(String.valueOf(lagenmaatF));
aantalMInput.setText(String.valueOf(aantalM2F));
stootvoegInput.setText(String.valueOf(stootvoegB));
//string -> float
float lengteSteenInputF = Float.parseFloat(String.valueOf(lengteSteenInput));
float muurdikteInputF = Float.parseFloat(String.valueOf(muurdikteInput));
float hoogteSteenInputF = Float.parseFloat(String.valueOf(hoogteSteenInput));
float lagenmaatInputF = Float.parseFloat(String.valueOf(lagenmaatInput));
float aantalM2InputF = Float.parseFloat(String.valueOf(aantalMInput));
boolean stootvoegInputB = Boolean.parseBoolean(String.valueOf(stootvoegInput));
活动2。xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity2">
<TextView
android:id="@+id/hoeveelMetselzand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="hoeveel metselzand(inc 10% verlies):"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/hoeveelVoegzand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="benodigde hoeveelheid voegzand(20% verlies):"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/hoeveelMetselzand" />
<TextView
android:id="@+id/zakkenMetselCement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="benodigde zakken metselcement:"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/zakkenPortland" />
<TextView
android:id="@+id/aantalStenen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="aantal stenen(inc 3% verlies):"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/zakkenMetselCement" />
<TextView
android:id="@+id/zakkenPortland"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="benodigde zakken portlandcement:"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/hoeveelVoegzand" />
<TextView
android:id="@+id/metselzand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="metselzand"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/voegzand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="voegzand"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/metselzand" />
<TextView
android:id="@+id/portlandcement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="portlandcement"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/voegzand" />
<TextView
android:id="@+id/metselcement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="metselcement"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/portlandcement" />
<TextView
android:id="@+id/stenen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="stenen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/metselcement" />
</androidx.constraintlayout.widget.ConstraintLayout>
有人能帮帮我吗?
异常告诉您一切,您没有ID为“Lengtesteeningput”的Textview。在请求Android将其获取给您之前,用xml创建实际内容。
活动\u main2中没有id为lengteSteenInput的文本视图。xml文件。
错误:任务“:app:ProcessDebugResources”执行失败。 com.android.ide.common.Process.processException:org.gradle.Process.internal.exeception:Process“command”c:\users\mohamed sallam\appdata\local\android\sdk\build-to
对于这个错误我该怎么做呢? 错误:任务“:app:DexDebug”执行失败。 当我尝试运行我的应用程序时,这个问题就会出现。
我在android studio虚拟设备nexus 6中卸载了kotlin制作的应用程序,当我再次尝试构建gradle时,它显示了这个错误。帮我修一下。 e:C:/Users/acer/。gradle/caches/transforms-2/files-2.1/3f5d451ee838e9d174f4df0a62e3601f/jetified-core-ktx-1.7.0-api。罐子/META-
所以我对javafx还很陌生,我正在为一些软件包而挣扎(我想) 这是我创建条形图的示例代码,我收到了错误"JavaFX运行时组件丢失,并且需要运行此应用程序"。然后我添加了一个vmargument到我的配置。由于我使用vscode我输入 “vmArgs”:”--模块路径/C:/Documents/javafx-sdk-11.0.2/lib--添加模块javafx.controls、javafx.f
我试图用Gradle和JDA在Java中编程一个discord机器人,我试图使用: 但是,当启动它给我的错误: 有人能帮帮我吗?