Еще только начал работать на Андроид студии. Так что не ругайтесь. Задумка в игре была такова: Дается 3 картинки и на их основе нужно составить предложение из 3 слов. Каждое слово записывается в свой Edit. После нажатия кнопки Проверка картинка пустой лампочки заменяется красной или зеленой, в зависимости от верности написанного. Явно ошибок в коде не вижу, да и сама студия не ругается. Но на телефоне приложение при запуске сразу же закрывается. Помогите пожалуйста. xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.slova.MainActivity">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/ya"
/>
<ImageView
android:id="@+id/imageView13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/tb"
/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/swimming"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/wl"
/>
<ImageView
android:id="@+id/imageView5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/wl"
/>
<ImageView
android:id="@+id/imageView6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:srcCompat="@drawable/wl"
/>
</LinearLayout>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Проверка"
android:onClick="ProverkaClick"
/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
java
package com.example.slova;
import android.media.Image;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
private EditText editText1;
private EditText editText2;
private EditText editText3;
private ImageView WL1;
private ImageView WL2;
private ImageView WL3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText1 = (EditText) findViewById(R.id.editText1);
editText2 = (EditText) findViewById(R.id.editText2);
editText3 = (EditText) findViewById(R.id.editText3);
WL1 = (ImageView) findViewById(R.id.imageView4);
WL2 = (ImageView) findViewById(R.id.imageView5);
WL3 = (ImageView) findViewById(R.id.imageView6);
}
public void ProverkaClick(View view){
String S1 = editText1.getText().toString();
String S2 = editText2.getText().toString();
String S3 = editText3.getText().toString();
String SS1 = "I";
String SS2 = "am";
String SS3 = "swimming";
if (S1.equals(SS1)) {
WL1.setImageResource(R.drawable.gl);
}
else{
WL1.setImageResource(R.drawable.rl);
}
if (S2.equals(SS2)){
WL2.setImageResource(R.drawable.gl);
}
else {
WL2.setImageResource(R.drawable.rl);
}
if (S3.equals(SS3)){
WL3.setImageResource(R.drawable.gl);
}
else{
WL3.setImageResource(R.drawable.rl);
}
}
}
Современные инструменты для криптотрейдинга: как технологии помогают принимать решения
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости