package com.example.kemeq23;
import java.util.ArrayList;
import org.apache.http.message.BasicNameValuePair;
import android.os.Bundle;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.content.ClipData.Item;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
// private String array_spinner[];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//start hide-show-widget
//start to hide when app start
// Typeface face = Typeface.createFromAsset(getAssets(),"font/");
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
sp5.setVisibility(View.INVISIBLE);
TextView ed2 = (TextView) findViewById(R.id.textView2);
ed2.setVisibility(View.INVISIBLE);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
sp6.setVisibility(View.INVISIBLE);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
sp7.setVisibility(View.INVISIBLE);
TextView ed5 = (TextView) findViewById(R.id.textView5);
ed5.setVisibility(View.INVISIBLE);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
sp8.setVisibility(View.INVISIBLE);
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
sp1.setVisibility(View.INVISIBLE);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
sp2.setVisibility(View.INVISIBLE);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
sp3.setVisibility(View.INVISIBLE);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
sp4.setVisibility(View.INVISIBLE);
ImageView im1 = (ImageView) findViewById(R.id.imageview1);
im1.setVisibility(View.INVISIBLE);
Button g = (Button) findViewById(R.id.button7);
g.setEnabled(false);
g.setText("ابتدا از منو ،نوع واکنش را انتخاب کنید");
g.setTextColor(Color.parseColor("blue"));
//end to hide when app start
TextView ed0 = (TextView) findViewById(R.id.textView8);
ed0.setTextColor(Color.parseColor("blue"));
//chenge size
// android.widget.TableRow.LayoutParams params = new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f);
// sp1.setLayoutParams(params);
// sp2.setLayoutParams(params);
// sp3.setLayoutParams(params);
//sp4.setLayoutParams(params);
//sp5.setLayoutParams(params);
//sp6.setLayoutParams(params);
//sp7.setLayoutParams(params);
//sp8.setLayoutParams(params);
//end change size
// ImageView im3 = (ImageView) findViewById(R.id.imageview3);
//baresii
g.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
TextView ed0 = (TextView) findViewById(R.id.textView8);
ImageView im2 = (ImageView) findViewById(R.id.imageview2);
//getSelectedItem().equals
//().getSelectedItem().toString().equals(hole);
//janeshini Doganeh
if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("NaOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("KOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("BaF2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
// User has selected an item; it may be the same item
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("NaOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CaCl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("0") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("0") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("0") && sp3.getSelectedItem().equals("-------------") && sp8.getSelectedItem().equals("0") && sp4.getSelectedItem().equals("-------------")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Na2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("KOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("BaF2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlF3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("KOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaF2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("KBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("KNO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("NaF")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("K2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu(OH)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(CO3)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu(OH)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CuBr2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2CO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu(NO2)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuSO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Li2CO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AgOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ba(NO3)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("3") && sp3.getSelectedItem().equals("AgOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Al(NO3)3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AgBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ca(NO3)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AgNO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("NaNO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ag2SO3") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("LiNO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//H2SO4
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaSO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaSO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2SO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Li2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//H3PO4
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ba3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlPO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na3PO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//ezafeh-shod
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ba3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlPO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na3NO2") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Li3PO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("HBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CaCl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Janeshini Doganeh
//Start Janeshini sadeh
//Zn
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ba")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("3") && sp3.getSelectedItem().equals("Zn(OH)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Al")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnBr2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ca")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(NO2)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnSO3") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Li")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Zn
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("F2") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("I2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("6") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al(NO3)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlI3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("F2") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("4") && sp3.getSelectedItem().equals("HF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//ezafeh-shod
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaNO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("4") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe3O4") && sp8.getSelectedItem().equals("4") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Janeshini sadeh
//Start tajzieh
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaCO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HgO") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Hg") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2SO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//tajzieh ezafeh-shod else
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("KCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("K") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("KOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("K2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Na2CO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("KClO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("KCl") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//end-ezafeh-shod
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NH4NO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("N2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NH4NO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("N2O") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Tajzieh
//Start Tarkib
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na2O2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CuO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("4") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Cu2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("4") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("HCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaHSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaHSO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuS") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Cu2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("6") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("P4O10") && sp7.getSelectedItem().equals("4") && sp3.getSelectedItem().equals("Na3PO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("6") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("P4O10") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CaO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("SO2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("SO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CuCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2O2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Tarkb
// janeshini doganeh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("AB") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CD") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AD") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CB")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// tajzieh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("AB") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("A") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// janeshini sadeh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("BC") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AC") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// tarkib entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("B") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AB")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
} else {
// na eshtebah
Toast.makeText(MainActivity.this, "اشتباه دوباره سعی کن", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.red);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
// return true;
return super.onContextItemSelected(item);
}
//az inja
public boolean onOptionsItemSelected(MenuItem item) {
TextView ed0 = (TextView) findViewById(R.id.textView8);
TextView ed2 = (TextView) findViewById(R.id.textView2);
TextView ed5 = (TextView) findViewById(R.id.textView5);
ImageView im2 = (ImageView) findViewById(R.id.imageview2);
ImageView im1 = (ImageView) findViewById(R.id.imageview1);
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
ArrayList list = new ArrayList();
ArrayList list2 = new ArrayList();
ArrayList list3 = new ArrayList();
ArrayList list4 = new ArrayList();
ArrayList list5 = new ArrayList();
ArrayList list6 = new ArrayList();
ArrayList list7 = new ArrayList();
ArrayList list8 = new ArrayList();
ArrayAdapter adapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list);
ArrayAdapter adapter2 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list2);
ArrayAdapter adapter3 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list3);
ArrayAdapter adapter4 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list4);
ArrayAdapter adapter5 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list5);
ArrayAdapter adapter6 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list6);
ArrayAdapter adapter7 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list7);
ArrayAdapter adapter8 = new ArrayAdapter(MainActivity.this, android.R.layout.simple_spinner_item, list8);
Button g = (Button) findViewById(R.id.button7);
//menu select
switch (item.getItemId()) {
case R.id.option1:
Toast.makeText(MainActivity.this, "واکنش تجزیه", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش تجزیه");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.INVISIBLE);
ed2.setVisibility(View.INVISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.INVISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
//tajzieh
//spinner5 list
// sp5 = hazf shodeh
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//tajzieh
//spinner1 list
// sp1 hazf shod
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("A");
list.add("A");
list.add("A");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("AB");
list2.add("Al(OH)3");
list2.add("CaCO3");
list2.add("H2O2");
list2.add("HCl");
list2.add("H2O");
list2.add("H2SO4");
list2.add("HgO");
list2.add("KCl");
list2.add("KOH");
list2.add("KClO4");
list2.add("NaCl");
list2.add("Na2CO3");
list2.add("NH4NO2");
list2.add("NH4NO3");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("A");
list3.add("Al2O3");
list3.add("CaO");
list3.add("H2");
list3.add("H2O");
list3.add("Hg");
list3.add("K");
list3.add("K2O");
list3.add("KCl");
list3.add("Na2O");
list3.add("Na");
list3.add("N2");
list3.add("N2O");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("Cl2");
list4.add("H2O");
list4.add("O2");
list4.add("CO2");
list4.add("SO3");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option2:
Toast.makeText(MainActivity.this, "واکنش ترکیب", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش ترکیب");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.INVISIBLE);
sp8.setVisibility(View.INVISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.INVISIBLE);
im1.setVisibility(View.VISIBLE);
//tarkib
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//tarkib
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
// sp8 = hazf shod
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("CaO");
list.add("Cu");
list.add("H2");
list.add("Na");
list.add("Na2O");
list.add("SO3");
list.add("SO2");
//tarkib
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("B");
list2.add("Cl2");
list2.add("H2O");
list2.add("NaOH");
list2.add("O2");
list2.add("P4O10");
list2.add("S");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AB");
list3.add("Ca(OH)2");
list3.add("Ca3(PO4)2");
list3.add("CaO2");
list3.add("Cu2O");
list3.add("CuO");
list3.add("Cu2S");
list3.add("CuS");
list3.add("CuCl");
list3.add("CuCl2");
list3.add("HCl");
list3.add("H2O");
list3.add("H2S");
list3.add("H2SO4");
list3.add("NaCl");
list3.add("Na3PO4");
list3.add("Na2O");
list3.add("Na2S");
list3.add("NaOH");
list3.add("Na2O2");
list3.add("NaHSO4");
list3.add("NaHSO3");
list3.add("SO3");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//spinner4 list
// sp4 = hazf shod
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("B");
list4.add("B");
list4.add("B");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option3:
Toast.makeText(MainActivity.this, "واکنش جانشینی ساده", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش جانشینی ساده");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
// janeshini sadeh
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//janeshini sadeh
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//janeshini sadeh
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("Zn");
list.add("Al");
list.add("Na");
list.add("Ca");
list.add("Fe");
list.add("F2");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("BC");
list2.add("CuSO4");
list2.add("AgNO3");
list2.add("H2O");
list2.add("HCl");
list2.add("NaI");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AC");
list3.add("Al(NO3)3");
list3.add("Al2(SO4)3");
list3.add("Al2O3");
list3.add("AlCl3");
list3.add("AlI3");
list3.add("Ca(OH)2");
list3.add("CaSO4");
list3.add("CaCl2");
list3.add("CaI2");
list3.add("Ca(NO3)2");
list3.add("FeCl2");
list3.add("FeI2");
list3.add("Fe(NO3)2");
list3.add("FeSO4");
list3.add("FeO");
list3.add("Fe2O3");
list3.add("Fe3O4");
list3.add("HF");
list3.add("NaOH");
list3.add("NaNO3");
list3.add("Na2SO4");
list3.add("NaF");
list3.add("NaCl");
list3.add("ZnO");
list3.add("ZnSO4");
list3.add("ZnCl2");
list3.add("ZnI2");
list3.add("Zn(NO3)2");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//janeshini sadeh
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("Cu");
list4.add("Ag");
list4.add("H2");
list4.add("O2");
list4.add("I2");
list4.add("Na");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option4:
// Single menu item is selected do something
// Ex: launching new activity/screen or show alert message
// TODO Auto-generated method stub
//TextView ed0 =(TextView) findViewById(R.id.textView8);
ed0.setText("واکنش جانشینی دوگانه");
Toast.makeText(MainActivity.this, "واکنش جانشینی دوگانه", Toast.LENGTH_SHORT).show();
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
//janeshini- doganeh
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//janeshini- doganeh
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//janeshini- doganeh
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("AB");
list.add("AgNO3");
list.add("CuCO3");
list.add("HCl");
list.add("H2SO4");
list.add("H3PO4");
list.add("KF");
list.add("NaCl");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("CD");
list2.add("Al(OH)3");
list2.add("Ba(OH)2");
list2.add("CaBr2");
list2.add("Li2SO3");
list2.add("NaNO2");
//janeshini- doganeh
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//janeshini- doganeh
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AD");
list3.add("Al2(CO3)3");
list3.add("Al2(SO4)3");
list3.add("AlF3");
list3.add("AlCl3");
list3.add("AlPO4");
list3.add("Ag2SO3");
list3.add("AgOH");
list3.add("AgNO2");
list3.add("AgBr");
list3.add("BaCO3");
list3.add("BaSO4");
list3.add("Ba3(PO4)2");
list3.add("BaCl2");
list3.add("CuSO3");
list3.add("CaSO4");
list3.add("CaF2");
list3.add("CaCO3");
list3.add("Ca3(PO4)2");
list3.add("HBr");
list3.add("KNO2");
list3.add("KOH");
list3.add("LiCl");
list3.add("Li2SO4");
list3.add("Li3PO4");
list3.add("LiF");
list3.add("NaCl");
list3.add("NaBr");
list3.add("Na2SO4");
list3.add("NaNO2");
list3.add("Na3PO4");
list3.add("Zn(OH)2");
list3.add("ZnBr2");
list3.add("Zn(NO2)2");
list3.add("ZnSO3");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//janeshini- doganeh
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("CB");
list4.add("Al(NO3)3");
list4.add("BaF2");
list4.add("Ba(NO3)2");
list4.add("CaCl2");
list4.add("CaF2");
list4.add("Ca(NO3)2");
list4.add("Cu(NO2)2");
list4.add("Cu(OH)2");
list4.add("CuBr2");
list4.add("H2SO3");
list4.add("H2SO4");
list4.add("HNO2");
list4.add("H2O");
list4.add("HBr");
list4.add("KBr");
list4.add("K2SO3");
list4.add("KOH");
list4.add("LiNO3");
list4.add("Li2CO3");
list4.add("NaNO3");
list4.add("Na2SO3");
list4.add("NaBr");
list4.add("NaOH");
list4.add("NaF");
list4.add("Na2CO3");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.learn_menu:
Toast.makeText(MainActivity.this, "آموزش معادله واکنش", Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this, Learn.class));
return true;
case R.id.help_menu:
Toast.makeText(MainActivity.this, "درباره", Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this, About1.class));
return true;
case R.id.option5:
Toast.makeText(MainActivity.this, "ابزار آزمایشگاهی", Toast.LENGTH_SHORT).show();
TableLayout al = (TableLayout) findViewById(R.id.table);
al.setBackgroundResource(R.drawable.back1);
g.setTextColor(Color.parseColor("blue"));
return true;
case R.id.option6:
Toast.makeText(MainActivity.this, "جدول تناوبی", Toast.LENGTH_SHORT).show();
TableLayout al2 = (TableLayout) findViewById(R.id.table);
al2.setBackgroundResource(R.drawable.back2);
g.setTextColor(Color.parseColor("white"));
return true;
case R.id.option7:
Toast.makeText(MainActivity.this, "کاغذ کاهی", Toast.LENGTH_SHORT).show();
TableLayout al3 = (TableLayout) findViewById(R.id.table);
al3.setBackgroundResource(R.drawable.about);
g.setTextColor(Color.parseColor("blue"));
return true;
case R.id.option8:
Toast.makeText(MainActivity.this, "برفی", Toast.LENGTH_SHORT).show();
TableLayout al4 = (TableLayout) findViewById(R.id.table);
al4.setBackgroundResource(R.drawable.learn);
g.setTextColor(Color.parseColor("blue"));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
//ta inja
}
import java.util.ArrayList;
import org.apache.http.message.BasicNameValuePair;
import android.os.Bundle;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.content.ClipData.Item;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
// private String array_spinner[];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//start hide-show-widget
//start to hide when app start
// Typeface face = Typeface.createFromAsset(getAssets(),"font/");
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
sp5.setVisibility(View.INVISIBLE);
TextView ed2 = (TextView) findViewById(R.id.textView2);
ed2.setVisibility(View.INVISIBLE);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
sp6.setVisibility(View.INVISIBLE);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
sp7.setVisibility(View.INVISIBLE);
TextView ed5 = (TextView) findViewById(R.id.textView5);
ed5.setVisibility(View.INVISIBLE);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
sp8.setVisibility(View.INVISIBLE);
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
sp1.setVisibility(View.INVISIBLE);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
sp2.setVisibility(View.INVISIBLE);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
sp3.setVisibility(View.INVISIBLE);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
sp4.setVisibility(View.INVISIBLE);
ImageView im1 = (ImageView) findViewById(R.id.imageview1);
im1.setVisibility(View.INVISIBLE);
Button g = (Button) findViewById(R.id.button7);
g.setEnabled(false);
g.setText("ابتدا از منو ،نوع واکنش را انتخاب کنید");
g.setTextColor(Color.parseColor("blue"));
//end to hide when app start
TextView ed0 = (TextView) findViewById(R.id.textView8);
ed0.setTextColor(Color.parseColor("blue"));
//chenge size
// android.widget.TableRow.LayoutParams params = new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f);
// sp1.setLayoutParams(params);
// sp2.setLayoutParams(params);
// sp3.setLayoutParams(params);
//sp4.setLayoutParams(params);
//sp5.setLayoutParams(params);
//sp6.setLayoutParams(params);
//sp7.setLayoutParams(params);
//sp8.setLayoutParams(params);
//end change size
// ImageView im3 = (ImageView) findViewById(R.id.imageview3);
//baresii
g.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
TextView ed0 = (TextView) findViewById(R.id.textView8);
ImageView im2 = (ImageView) findViewById(R.id.imageview2);
//getSelectedItem().equals
//().getSelectedItem().toString().equals(hole);
//janeshini Doganeh
if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("NaOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("KOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("BaF2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
// User has selected an item; it may be the same item
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("NaOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CaCl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("0") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("0") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("0") && sp3.getSelectedItem().equals("-------------") && sp8.getSelectedItem().equals("0") && sp4.getSelectedItem().equals("-------------")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("NaCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Na2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("KOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("BaF2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlF3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("KOH")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaF2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("KBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("KNO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("NaF")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("KF") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("K2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu(OH)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(CO3)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu(OH)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CuBr2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2CO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu(NO2)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CuCO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuSO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Li2CO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AgOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ba(NO3)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("3") && sp3.getSelectedItem().equals("AgOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Al(NO3)3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AgBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ca(NO3)2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AgNO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("NaNO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("AgNO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ag2SO3") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("LiNO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCl2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//H2SO4
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("BaSO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaSO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2SO4") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H2SO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Li2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//H3PO4
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ba3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlPO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na3PO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//ezafeh-shod
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ba3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlPO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na3NO2") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("HNO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Li3PO4") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H3PO4") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("6") && sp4.getSelectedItem().equals("HBr")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("LiCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("HCl") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("HBr") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CaCl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Janeshini Doganeh
//Start Janeshini sadeh
//Zn
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Ba(OH)2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ba")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("3") && sp3.getSelectedItem().equals("Zn(OH)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Al")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaBr2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnBr2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ca")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaNO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(NO2)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Li2SO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnSO3") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Li")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Zn
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2(SO4)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("F2") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("I2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("6") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("AlCl3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al(NO3)3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Al") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AlI3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("ZnCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("F2") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("4") && sp3.getSelectedItem().equals("HF") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Zn") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Zn(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Ca") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//ezafeh-shod
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaNO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CuSO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cu")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("AgNO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe(NO3)2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Ag")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaI") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeI2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("Na")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("FeO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("3") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("3") && sp1.getSelectedItem().equals("Fe") && sp6.getSelectedItem().equals("4") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Fe3O4") && sp8.getSelectedItem().equals("4") && sp4.getSelectedItem().equals("H2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Janeshini sadeh
//Start tajzieh
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CaCO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CaO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HgO") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Hg") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("NaCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2SO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("SO3")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("Al(OH)3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Al2O3") && sp8.getSelectedItem().equals("3") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//tajzieh ezafeh-shod else
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("KCl") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("K") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("KOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("K2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Na2CO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CO2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("H2O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("2") && sp2.getSelectedItem().equals("HCl") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("Cl2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("KClO4") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("KCl") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("O2")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//end-ezafeh-shod
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NH4NO2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("N2") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NH4NO3") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("N2O") && sp8.getSelectedItem().equals("2") && sp4.getSelectedItem().equals("H2O")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Tajzieh
//Start Tarkib
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("H2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaOH") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Ca(OH)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("H2O") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2SO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na2O2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CuO") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("4") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Cu2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("4") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Na2O") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("NaCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("HCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO3") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaHSO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("SO2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("NaOH") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("NaHSO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("H2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("H2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuS") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Cu2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("S") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2S") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("6") && sp1.getSelectedItem().equals("Na2O") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("P4O10") && sp7.getSelectedItem().equals("4") && sp3.getSelectedItem().equals("Na3PO4") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("6") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("P4O10") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("Ca3(PO4)2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("CaO") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CaO2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("SO2") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("SO3") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("2") && sp3.getSelectedItem().equals("CuCl") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("Cu") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("Cl2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("CuCl2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
} else if (sp5.getSelectedItem().equals("2") && sp1.getSelectedItem().equals("Na") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("O2") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("Na2O2") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
Toast.makeText(MainActivity.this, "آفرین", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.green);
//End Tarkb
// janeshini doganeh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("AB") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("CD") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AD") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("CB")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// tajzieh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("AB") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("A") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// janeshini sadeh entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("BC") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AC") && sp8.getSelectedItem().equals("1") && sp4.getSelectedItem().equals("B")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
// tarkib entekhab kon
} else if (sp5.getSelectedItem().equals("1") && sp1.getSelectedItem().equals("A") && sp6.getSelectedItem().equals("1") && sp2.getSelectedItem().equals("B") && sp7.getSelectedItem().equals("1") && sp3.getSelectedItem().equals("AB")) {
// entekhab kon
Toast.makeText(MainActivity.this, "مواد شیمیایی و ضرایب آن ها را انتخاب کن", Toast.LENGTH_SHORT).show();
} else {
// na eshtebah
Toast.makeText(MainActivity.this, "اشتباه دوباره سعی کن", Toast.LENGTH_SHORT).show();
im2.setImageResource(R.drawable.red);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
// return true;
return super.onContextItemSelected(item);
}
//az inja
public boolean onOptionsItemSelected(MenuItem item) {
TextView ed0 = (TextView) findViewById(R.id.textView8);
TextView ed2 = (TextView) findViewById(R.id.textView2);
TextView ed5 = (TextView) findViewById(R.id.textView5);
ImageView im2 = (ImageView) findViewById(R.id.imageview2);
ImageView im1 = (ImageView) findViewById(R.id.imageview1);
Spinner sp1 = (Spinner) findViewById(R.id.spinner1);
Spinner sp2 = (Spinner) findViewById(R.id.spinner2);
Spinner sp3 = (Spinner) findViewById(R.id.spinner3);
Spinner sp4 = (Spinner) findViewById(R.id.spinner4);
Spinner sp5 = (Spinner) findViewById(R.id.spinner5);
Spinner sp6 = (Spinner) findViewById(R.id.spinner6);
Spinner sp7 = (Spinner) findViewById(R.id.spinner7);
Spinner sp8 = (Spinner) findViewById(R.id.spinner8);
ArrayList
ArrayList
ArrayList
ArrayList
ArrayList
ArrayList
ArrayList
ArrayList
ArrayAdapter
ArrayAdapter
ArrayAdapter
ArrayAdapter
ArrayAdapter
ArrayAdapter
ArrayAdapter
ArrayAdapter
Button g = (Button) findViewById(R.id.button7);
//menu select
switch (item.getItemId()) {
case R.id.option1:
Toast.makeText(MainActivity.this, "واکنش تجزیه", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش تجزیه");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.INVISIBLE);
ed2.setVisibility(View.INVISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.INVISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
//tajzieh
//spinner5 list
// sp5 = hazf shodeh
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//tajzieh
//spinner1 list
// sp1 hazf shod
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("A");
list.add("A");
list.add("A");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("AB");
list2.add("Al(OH)3");
list2.add("CaCO3");
list2.add("H2O2");
list2.add("HCl");
list2.add("H2O");
list2.add("H2SO4");
list2.add("HgO");
list2.add("KCl");
list2.add("KOH");
list2.add("KClO4");
list2.add("NaCl");
list2.add("Na2CO3");
list2.add("NH4NO2");
list2.add("NH4NO3");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("A");
list3.add("Al2O3");
list3.add("CaO");
list3.add("H2");
list3.add("H2O");
list3.add("Hg");
list3.add("K");
list3.add("K2O");
list3.add("KCl");
list3.add("Na2O");
list3.add("Na");
list3.add("N2");
list3.add("N2O");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("Cl2");
list4.add("H2O");
list4.add("O2");
list4.add("CO2");
list4.add("SO3");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option2:
Toast.makeText(MainActivity.this, "واکنش ترکیب", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش ترکیب");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.INVISIBLE);
sp8.setVisibility(View.INVISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.INVISIBLE);
im1.setVisibility(View.VISIBLE);
//tarkib
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//tarkib
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
list8.add("1");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
// sp8 = hazf shod
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("CaO");
list.add("Cu");
list.add("H2");
list.add("Na");
list.add("Na2O");
list.add("SO3");
list.add("SO2");
//tarkib
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("B");
list2.add("Cl2");
list2.add("H2O");
list2.add("NaOH");
list2.add("O2");
list2.add("P4O10");
list2.add("S");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AB");
list3.add("Ca(OH)2");
list3.add("Ca3(PO4)2");
list3.add("CaO2");
list3.add("Cu2O");
list3.add("CuO");
list3.add("Cu2S");
list3.add("CuS");
list3.add("CuCl");
list3.add("CuCl2");
list3.add("HCl");
list3.add("H2O");
list3.add("H2S");
list3.add("H2SO4");
list3.add("NaCl");
list3.add("Na3PO4");
list3.add("Na2O");
list3.add("Na2S");
list3.add("NaOH");
list3.add("Na2O2");
list3.add("NaHSO4");
list3.add("NaHSO3");
list3.add("SO3");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//spinner4 list
// sp4 = hazf shod
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("B");
list4.add("B");
list4.add("B");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option3:
Toast.makeText(MainActivity.this, "واکنش جانشینی ساده", Toast.LENGTH_SHORT).show();
ed0.setText("واکنش جانشینی ساده");
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
// janeshini sadeh
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//janeshini sadeh
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//janeshini sadeh
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("A");
list.add("Zn");
list.add("Al");
list.add("Na");
list.add("Ca");
list.add("Fe");
list.add("F2");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("BC");
list2.add("CuSO4");
list2.add("AgNO3");
list2.add("H2O");
list2.add("HCl");
list2.add("NaI");
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AC");
list3.add("Al(NO3)3");
list3.add("Al2(SO4)3");
list3.add("Al2O3");
list3.add("AlCl3");
list3.add("AlI3");
list3.add("Ca(OH)2");
list3.add("CaSO4");
list3.add("CaCl2");
list3.add("CaI2");
list3.add("Ca(NO3)2");
list3.add("FeCl2");
list3.add("FeI2");
list3.add("Fe(NO3)2");
list3.add("FeSO4");
list3.add("FeO");
list3.add("Fe2O3");
list3.add("Fe3O4");
list3.add("HF");
list3.add("NaOH");
list3.add("NaNO3");
list3.add("Na2SO4");
list3.add("NaF");
list3.add("NaCl");
list3.add("ZnO");
list3.add("ZnSO4");
list3.add("ZnCl2");
list3.add("ZnI2");
list3.add("Zn(NO3)2");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//janeshini sadeh
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("B");
list4.add("Cu");
list4.add("Ag");
list4.add("H2");
list4.add("O2");
list4.add("I2");
list4.add("Na");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.option4:
// Single menu item is selected do something
// Ex: launching new activity/screen or show alert message
// TODO Auto-generated method stub
//TextView ed0 =(TextView) findViewById(R.id.textView8);
ed0.setText("واکنش جانشینی دوگانه");
Toast.makeText(MainActivity.this, "واکنش جانشینی دوگانه", Toast.LENGTH_SHORT).show();
g.setEnabled(true);
g.setText("بررسی درستی، مرا کلیک کن");
im2.setImageResource(R.drawable.blue);
sp5.setVisibility(View.VISIBLE);
ed2.setVisibility(View.VISIBLE);
sp6.setVisibility(View.VISIBLE);
sp7.setVisibility(View.VISIBLE);
ed5.setVisibility(View.VISIBLE);
sp8.setVisibility(View.VISIBLE);
sp1.setVisibility(View.VISIBLE);
sp2.setVisibility(View.VISIBLE);
sp3.setVisibility(View.VISIBLE);
sp4.setVisibility(View.VISIBLE);
im1.setVisibility(View.VISIBLE);
//janeshini- doganeh
//spinner5 list
sp5 = (Spinner) findViewById(R.id.spinner5);
list5.add("1");
list5.add("2");
list5.add("3");
list5.add("4");
list5.add("5");
list5.add("6");
adapter5.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp5.setAdapter(adapter5);
//spinner6 list
sp6 = (Spinner) findViewById(R.id.spinner6);
list6.add("1");
list6.add("2");
list6.add("3");
list6.add("4");
list6.add("5");
list6.add("6");
adapter6.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp6.setAdapter(adapter6);
//janeshini- doganeh
//spinner7 list
sp7 = (Spinner) findViewById(R.id.spinner7);
list7.add("1");
list7.add("2");
list7.add("3");
list7.add("4");
list7.add("5");
list7.add("6");
adapter7.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp7.setAdapter(adapter7);
//spinner8 list
sp8 = (Spinner) findViewById(R.id.spinner8);
list8.add("1");
list8.add("2");
list8.add("3");
list8.add("4");
list8.add("5");
list8.add("6");
adapter8.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp8.setAdapter(adapter8);
//janeshini- doganeh
//spinner1 list
sp1 = (Spinner) findViewById(R.id.spinner1);
list.add("AB");
list.add("AgNO3");
list.add("CuCO3");
list.add("HCl");
list.add("H2SO4");
list.add("H3PO4");
list.add("KF");
list.add("NaCl");
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp1.setAdapter(adapter);
//spinner2 list
sp2 = (Spinner) findViewById(R.id.spinner2);
list2.add("CD");
list2.add("Al(OH)3");
list2.add("Ba(OH)2");
list2.add("CaBr2");
list2.add("Li2SO3");
list2.add("NaNO2");
//janeshini- doganeh
adapter2.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp2.setAdapter(adapter2);
//janeshini- doganeh
//spinner3 list
sp3 = (Spinner) findViewById(R.id.spinner3);
list3.add("AD");
list3.add("Al2(CO3)3");
list3.add("Al2(SO4)3");
list3.add("AlF3");
list3.add("AlCl3");
list3.add("AlPO4");
list3.add("Ag2SO3");
list3.add("AgOH");
list3.add("AgNO2");
list3.add("AgBr");
list3.add("BaCO3");
list3.add("BaSO4");
list3.add("Ba3(PO4)2");
list3.add("BaCl2");
list3.add("CuSO3");
list3.add("CaSO4");
list3.add("CaF2");
list3.add("CaCO3");
list3.add("Ca3(PO4)2");
list3.add("HBr");
list3.add("KNO2");
list3.add("KOH");
list3.add("LiCl");
list3.add("Li2SO4");
list3.add("Li3PO4");
list3.add("LiF");
list3.add("NaCl");
list3.add("NaBr");
list3.add("Na2SO4");
list3.add("NaNO2");
list3.add("Na3PO4");
list3.add("Zn(OH)2");
list3.add("ZnBr2");
list3.add("Zn(NO2)2");
list3.add("ZnSO3");
adapter3.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp3.setAdapter(adapter3);
//janeshini- doganeh
//spinner4 list
sp4 = (Spinner) findViewById(R.id.spinner4);
list4.add("CB");
list4.add("Al(NO3)3");
list4.add("BaF2");
list4.add("Ba(NO3)2");
list4.add("CaCl2");
list4.add("CaF2");
list4.add("Ca(NO3)2");
list4.add("Cu(NO2)2");
list4.add("Cu(OH)2");
list4.add("CuBr2");
list4.add("H2SO3");
list4.add("H2SO4");
list4.add("HNO2");
list4.add("H2O");
list4.add("HBr");
list4.add("KBr");
list4.add("K2SO3");
list4.add("KOH");
list4.add("LiNO3");
list4.add("Li2CO3");
list4.add("NaNO3");
list4.add("Na2SO3");
list4.add("NaBr");
list4.add("NaOH");
list4.add("NaF");
list4.add("Na2CO3");
adapter4.setDropDownViewResource(android.R.layout.simple_spinner_item);
sp4.setAdapter(adapter4);
return true;
case R.id.learn_menu:
Toast.makeText(MainActivity.this, "آموزش معادله واکنش", Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this, Learn.class));
return true;
case R.id.help_menu:
Toast.makeText(MainActivity.this, "درباره", Toast.LENGTH_SHORT).show();
startActivity(new Intent(MainActivity.this, About1.class));
return true;
case R.id.option5:
Toast.makeText(MainActivity.this, "ابزار آزمایشگاهی", Toast.LENGTH_SHORT).show();
TableLayout al = (TableLayout) findViewById(R.id.table);
al.setBackgroundResource(R.drawable.back1);
g.setTextColor(Color.parseColor("blue"));
return true;
case R.id.option6:
Toast.makeText(MainActivity.this, "جدول تناوبی", Toast.LENGTH_SHORT).show();
TableLayout al2 = (TableLayout) findViewById(R.id.table);
al2.setBackgroundResource(R.drawable.back2);
g.setTextColor(Color.parseColor("white"));
return true;
case R.id.option7:
Toast.makeText(MainActivity.this, "کاغذ کاهی", Toast.LENGTH_SHORT).show();
TableLayout al3 = (TableLayout) findViewById(R.id.table);
al3.setBackgroundResource(R.drawable.about);
g.setTextColor(Color.parseColor("blue"));
return true;
case R.id.option8:
Toast.makeText(MainActivity.this, "برفی", Toast.LENGTH_SHORT).show();
TableLayout al4 = (TableLayout) findViewById(R.id.table);
al4.setBackgroundResource(R.drawable.learn);
g.setTextColor(Color.parseColor("blue"));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
//ta inja
}