In eine anderen App hat es problemlos funktioniert. Da wird Strings aus der Datenbank geladen und in die App geladen. In diser App habe ich es "genauso" gemacht. Leider stürtzt die App sofort ab, außer wenn der String nicht gesetzt wird. Ich weiß nicht mehr weiter. Ich möchte viel öffters über Firestore machen, da es sicherer ist als SharendPreference.
Hier der Code der eine Seite:
Wenn ich diese Stelle entferne, dann stürzt die ab nicht mehr ab: easteregg_lösung = value.getString("2021");
In einer andere App geht der Code perfekt und ich kann Strings und Integer problemlos rausladen...
Wiso Stürtzt die App ab und was kann ich machen?
Möchte viel mehr mit Firestore arbeiten.
Jede Hilfe bin ich sehr dankbar!!!!
Hier der Code der eine Seite:
Java:
package com.................;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import net.margaritov.preference.colorpicker.ColorPickerDialog;
public class home extends AppCompatActivity {
ImageButton ibtn;
Button btn;
ImageView view;
TextView texthex;
TextView textandroidcode;
FirebaseFirestore fStore;
int color = Color.parseColor("#FFFFFF");
/*
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
*/
int farbcode;
int rgb;
String easteregg_lösung;
String code = "";
String farbstring;
ColorPickerDialog colorPickerDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
color = prefs.getInt("auswahlfarbe" , color);
fStore = FirebaseFirestore.getInstance();
DocumentReference documentReference = fStore.collection("Lösung").document("2021");
documentReference.addSnapshotListener(this, new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@Nullable DocumentSnapshot value, @Nullable FirebaseFirestoreException error) {
easteregg_lösung = value.getString("2021");
}
});
view = findViewById(R.id.view);
view.setBackgroundColor(color);
ibtn = findViewById(R.id.imageButton);
ibtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(home.this, fullscreen.class));
}
});
btn = findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View v) {
colorPickerDialog = new ColorPickerDialog(home.this, color);
colorPickerDialog.setAlphaSliderVisible(true);
colorPickerDialog.setHexValueEnabled(true);
colorPickerDialog.getHexValueEnabled();
colorPickerDialog.setTitle("Farbe auswählen");
colorPickerDialog.setOnColorChangedListener(new ColorPickerDialog.OnColorChangedListener() {
@Override
public void onColorChanged(int i) {
farbcode = i;
color = i;
texthex.setText("#"+ Integer.toHexString(color));
farbstring = "#" + Integer.toHexString(color);
Eastercode_generator();
view.setBackgroundColor(color);
textandroidcode.setText(Integer.toBinaryString(farbcode));
SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt("auswahlfarbe" , color);
editor.apply();
}
});
colorPickerDialog.show();
}
});
texthex = findViewById(R.id.textView4);
textandroidcode = findViewById(R.id.textView9);
texthex.setText("#"+ Integer.toHexString(color));
textandroidcode.setText(Integer.toBinaryString(color));
/* textrgb.setText(r + ", " + g + ", " + b); */
BottomNavigationView bottomNavigationView = (BottomNavigationView)findViewById(R.id.bottom_navigation);
bottomNavigationView.setSelectedItemId(R.id.farbtafel);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.farbtafel:
return true;
case R.id.bild:
startActivity(new Intent(getApplicationContext(), image.class));
overridePendingTransition( 0,0);
return true;
case R.id.ral_code:
startActivity(new Intent(getApplicationContext(), ral.class));
overridePendingTransition( 0,0);
return true;
}
return false;
}
});
}
private void Eastercode_generator() {
String f1 = "#ffffffff"; String f2 = "#fffefefe"; String f3 = "#fffefdefd"; String f4 = "#fffdfcfc"; String f5 = "#fffcfcfc"; String f6 = "#fffdfdfd"; String f7 = "#fffafafa"; String f8 = "#fff9f9f9"; String f9 = "#fff8f8f8"; String f10 = "#fff7f7f7"; String f11 = "#fff6f6f6"; String f12 = "#fff5f5f5"; String f13 = "#fff4f4f4"; String f14 = "#fff3f3f3"; String f15 = "#fff2f2f2"; String f16 = "#fff1f1f1"; String f17 = "#ffeeeeee"; String f18 = "#ffefefef"; String f19 = "#ffededed"; String f20 = "#ffebebeb"; String f21 = "#ffeaeaea"; String f22 = "#ffe9e9e9"; String f23 = "#ffe8e8e8"; String f24 = "#ffe7e7e7"; String f25 = "#ffe6e6e6"; String f26 = "#ffe5e5e5"; String f27 = "#ffe4e4e4"; String f28 = "#ffe3e3e3"; String f29 = "#ffe2e2e2"; String f30 = "#ffe1e1e1"; String f31 = "#ffe0e0e0";
String f32 ="#ffebdbdb"; String f33 = "#ffe0caca"; String f34 = "#ffb7a2a2"; String f35 = "#ff957575"; String f36 = "#ff6e4d4d"; String f37 = "#ff553232"; String f38 = "#fff29d9d"; String f39 = "#ffd98989"; String f40 = "#ffb16c6c";
String f41 = "#fff56d6d"; String f42 = "#ffc94f4f"; String f43 = "#ff983a3a"; String f44 = "#ff652121"; String f45 = "#ffca3737"; String f46 = "#ff9f2a2a"; String f47 = "#ffda2d2d"; String f48 = "#ffbd2626"; String f49 = "#ff9c2222"; String f50 = "#ffbc0f0f";
String f51 = "#ffebba7e"; String f52 = "#ffb68c5a"; String f53 = "#ffe5a557"; String f54 = "#fffbab4b"; String f55 = "#ffb07a38"; String f56 = "#ff6b4920"; String f57 = "#ffe69739"; String f58 = "#ffff971a"; String f59 = "#ffbe7115"; String f60 = "#ff74440a";
String f61 = "#fff8eeb0"; String f62 = "#fff3df6c"; String f63 = "#fff4dc4e"; String f64 = "#fff5d629"; String f65 = "#ffffd800"; String f66 = "#ffe5c200"; String f67 = "#ffe4c728"; String f68 = "#ffdfcc62"; String f69 = "#ffc9be80"; String f70 = "#ffb9b07b";
String f71 = "#ffa18a0d"; String f72 = "#ff99892f"; String f73 = "#ff928853"; String f74 = "#ff66590b"; String f75 = "#ff5a511f"; String f76 = "#ff514c31"; String f77 = "#ffefef97"; String f78 = "#fff4f36d"; String f79 = "#fffefe3d"; String f80 = "#ffffff00";
String f81 = "#ffeeee00"; String f82 = "#ffefee1b"; String f83 = "#fff5f537"; String f84 = "#ffefef42"; String f85 = "#ffefef54"; String f86 = "#ffe7e767"; String f87 = "#ffdfdf7d"; String f88 = "#ffd5d591"; String f89 = "#ffd4d47b"; String f90 = "#ffd2d266";
String f91 = "#ffcfcf4e"; String f92 = "#ffcfcf3e"; String f93 = "#ffcdcd24"; String f94 = "#ffc8c70e"; String f95 = "#ffb9b90a"; String f96 = "#ffc0bf1a"; String f97 = "#ffbbbb2b"; String f98 = "#ffbfbf35"; String f99 = "#ffbbbb4a"; String f100 = "#ffadad5a";
String f101 = "#ffa7a73a"; String f102 = "#ffa2a21a"; String f103 = "#ff91910d"; String f104 = "#ff76750e"; String f105 = "#ff6f6f1b"; String f106 = "#ff636328"; String f107 = "#ff56562d"; String f108= "#ff4b4b24"; String f109 = "#ff46461a"; String f110 = "#ff51510f";
String f111 = "#ffe9efb2"; String f112 = "#ffeaf29d"; String f113 = "#ffe9f38e"; String f114 = "#fff3ff83"; String f115 = "#ffeaf774"; String f116 = "#fff0fe6e"; String f117 = "#ffe4f35d"; String f118 = "#ffeafa53"; String f119 = "#ffedff48"; String f120 = "#ffe7fa3c";
String f121 = "#ffdbee2e"; String f122 = "#ffeaff2b"; String f123 = "#ffdff325"; String f124 = "#ffeaff26"; String f125 = "#ffe3f820"; String f126 = "#ffddf311"; String f127 = "#ffe6ff00"; String f128 = "#ffdaf204"; String f129 = "#ffd9ef0e"; String f130 = "#ffd6ec0e";
String f131 = "#ffcfe315"; String f132 = "#ffcee217"; String f133 = "#ffd0e320"; String f134 = "#ffd2e620"; String f135 = "#ffd2e426"; String f136 = "#ffcdde2c"; String f137 = "#ffc9da32"; String f138 = "#ffcada3c"; String f139 = "#ffcedc4a"; String f140 = "#ffc8d45e";
String f141 = "#ffbcc663"; String f142 = "#ffb0b964"; String f143 = "#ffabb54f"; String f144 = "#ffacb845"; String f145 = "#ffa3b12c"; String f146 = "#ff9fae18"; String f147 = "#ff85930a"; String f148 = "#ff84901b"; String f149 = "#ff7f8732"; String f150 = "#ff6b7136";
String f151 = "#ffdcf4b8"; String f152 = "#ffdaf7b0"; String f153 = "#ffd3f99c"; String f154 = "#ffcef88e"; String f155 = "#ffcafb80"; String f156 = "#ffc3f875"; String f157 = "#ffbffa68"; String f158 = "#ffb6f854"; String f159 = "#ffabf242"; String f160 = "#ffabf73a";
String f161 = "#ffa4f331"; String f162 = "#ffa5f72c"; String f163 = "#ffa3f728"; String f164 = "#ffa5ff1"; String f165 = "#ff9ff81b"; String f166 = "#ff97f112"; String f167 = "#ff9afb0c"; String f168 = "#ff95f507"; String f169 = "#ff93f700"; String f170 = "#ff98ff00";
String f171 = "#ff85e000"; String f172 = "#ff88de08"; String f173 = "#ff8cdd14"; String f174 = "#ff8fdf1a"; String f175 = "#ff91dc22"; String f176 = "#ff94dc2a"; String f177 = "#ff93da2c"; String f178 = "#ff92d430"; String f179 = "#ff92d234"; String f180 = "#ff93d038";
String f181 = "#ff99d246"; String f182 = "#ff9dd24f"; String f183 = "#ffa7d75f"; String f184 = "#ffabd66c"; String f185 = "#ffabd07"; String f186 = "#ffafce81"; String f187 = "#ffb7d092"; String f188 = "#ffb8cb9d"; String f189 = "#ffa7b78f"; String f190 = "#ffa4bd7f";
String f191 = "#ff9cb9710"; String f192 = "#ff97be5f"; String f193 = "#ff8cbc45"; String f194 = "#ff85ba36"; String f195 = "#ff7ab71f"; String f196 = "#ff76b913"; String f197 = "#ff6fb507"; String f198 = "#ff68ad03"; String f199 = "#ff66ab00"; String f200 = "#ff62901e";
String f201 = "#ffb6f1a8"; String f202 = "#ffa8ff94"; String f203 = "#ffa1f98d"; String f204 = "#ff94f27e"; String f205 = "#ff8dfd72"; String f206 = "#ff89f86f"; String f207 = "#ff84ff67"; String f208 = "#ff78f75a"; String f209 = "#ff71ff50"; String f210 = "#ff68f747";
String f211 = "#ff5bf436"; String f212 = "#ff54ff2b"; String f213 = "#ff4fee29"; String f214 = "#ff4dfe23"; String f215 = "#ff43f419"; String f216 = "#ff3fff12"; String f217 = "#ff3ff414"; String f218 = "#ff3ffb12"; String f219 = "#ff38fa0a"; String f220 = "#ff31ff00";
String f221 = "#ff33ed07"; String f222 = "#ff3ae910"; String f223 = "#ff49e525"; String f224 = "#ff5edb40"; String f225 = "#ff6ad950"; String f226 = "#ff78c566"; String f227 = "#ff68a759"; String f228 = "#ff5ba749"; String f229 = "#ff47a431"; String f230 = "#ff33931c";
String f231 = "#ff8ae7bc"; String f232 = "#ff78f2ba"; String f233 = "#ff5fffb6"; String f234 = "#ff55f2aa"; String f235 = "#ff48ffab"; String f236 = "#ff3eed9d"; String f237 = "#ff41ffa8"; String f238 = "#ff2df097"; String f239 = "#ff17ff95"; String f240 = "#ff00ff8a";
String f241 = "#ff87e2da"; String f242 = "#ff83f2e9"; String f243 = "#ff65e6db"; String f244 = "#ff57f8eb"; String f245 = "#ff36e1d3"; String f246 = "#ff21f7e5"; String f247 = "ff12f1de"; String f248 = "#ff0efbe7"; String f249 = "#ff06f7e3"; String f250 = "#ff00ffea";
String f251 = "#ff08e3d1"; String f252 = "#ff19e0d0"; String f253 = "#ff2dd9ca"; String f254 = "#ff49d1c6"; String f255 = "#ff65c3bb"; String f256 = "#ff56aaa3"; String f257 = "#ff3da69d"; String f258 = "#ff20a89c"; String f259 = "#ff17837a"; String f260 = "#ff246863";
String f261 = "#ff9cd9ef"; String f262 = "#ff9ae4ff"; String f263 = "#ff80cfeb"; String f264 = "#ff6fd2f6"; String f265 = "#ff5bc5eb"; String f266 = "#ff42b3dd"; String f267 = "#ff34b9ea"; String f268 = "#ff31bdef"; String f269 = "#ff17b5ed"; String f270 = "#ff00bbff";
String f271 = "#ff0c9ed3"; String f272 = "#ff29a2cd"; String f273 = "#ff44a8cc"; String f274 = "#ff5daac6"; String f275 = "#ff5e97ab"; String f276 = "#ff4894b0"; String f277 = "#ff318dae"; String f278 = "#ff1c81a6"; String f279 = "#ff0d7399"; String f280 = "#ff0446488";
String f281 = "#ff6d7ee2"; String f282 = "#ff5d72f2"; String f283 = "#ff435bf1"; String f284 = "#ff314ae2"; String f285 = "#ff2341f7"; String f286 = "#ff1d39e8"; String f287 = "#ff0c2eff"; String f288 = "#ff1330e8"; String f289 = "#ff0625e7"; String f290 = "ff0024ff";
String f291 = "#ffb383e1"; String f292 = "#ffbc81f5"; String f293 = "#ffaa6ae7"; String f294 = "#ffad62f4"; String f295 = "#ff9e50e8"; String f296 = "#ff972ffb"; String f297 = "#ff8621e7"; String f298 = "#ff8115e8"; String f299 = "#ff7800eb"; String f300 = "#ff8200ff";
String f301 = "#ff7a08e8"; String f302 = "#ff7b12e1"; String f303 = "#ff7227ba"; String f304 = "#ff7e44b6"; String f305 = "#ff855aaf"; String f306 = "#ff70439c"; String f307 = "#ff553377"; String f308 = "#ff3c1760"; String f309 = "#ff370d5f"; String f310 = "#ff371f4e";
/* Toast.makeText(getApplicationContext(), "Geht nicht!", Toast.LENGTH_SHORT).show();*/
if (farbstring.equals(f1) | farbstring.equals(f2) | farbstring.equals(f3) | farbstring.equals(f4) | farbstring.equals(f5) | farbstring.equals(f6) | farbstring.equals(f7) | farbstring.equals(f8) | farbstring.equals(f9) | farbstring.equals(f10) | farbstring.equals(f11) | farbstring.equals(f12) | farbstring.equals(f13) | farbstring.equals(f14) | farbstring.equals(f15) | farbstring.equals(f16) | farbstring.equals(f17) | farbstring.equals(f18) | farbstring.equals(f19) | farbstring.equals(f20) | farbstring.equals(f21) | farbstring.equals(f22) | farbstring.equals(f23) | farbstring.equals(f24) | farbstring.equals(f25) | farbstring.equals(f26) | farbstring.equals(f27) | farbstring.equals(f28) | farbstring.equals(f29) | farbstring.equals(f30) | farbstring.equals(f31)){
code += "a";
StartEasterEgg();
Toast.makeText(getApplicationContext(), code, Toast.LENGTH_SHORT).show();
} else if (farbstring.equals(f32) | farbstring.equals(f33) | farbstring.equals(f34) | farbstring.equals(f35) | farbstring.equals(f36) | farbstring.equals(f37) | farbstring.equals(f38) | farbstring.equals(f39) | farbstring.equals(f40)){
code += "b";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f41) | farbstring.equals(f42) | farbstring.equals(f43) | farbstring.equals(f44) | farbstring.equals(f45) | farbstring.equals(f46) | farbstring.equals(f47) | farbstring.equals(f48) | farbstring.equals(f49) | farbstring.equals(f50)){
code += "c";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
} else if (farbstring.equals(f51) | farbstring.equals(f52) | farbstring.equals(f53) | farbstring.equals(f54) | farbstring.equals(f55) | farbstring.equals(f56) | farbstring.equals(f57) | farbstring.equals(f58) | farbstring.equals(f59) | farbstring.equals(f60)){
code += "d";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f61) | farbstring.equals(f62) | farbstring.equals(f63) | farbstring.equals(f64) | farbstring.equals(f65) | farbstring.equals(f66) | farbstring.equals(f67) | farbstring.equals(f68) | farbstring.equals(f69) | farbstring.equals(f70)){
code += "e";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f71) | farbstring.equals(f72) | farbstring.equals(f73) | farbstring.equals(f74) | farbstring.equals(f75) | farbstring.equals(f76) | farbstring.equals(f77) | farbstring.equals(f78) | farbstring.equals(f79) | farbstring.equals(f80)){
code += "f";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f81) | farbstring.equals(f82) | farbstring.equals(f83) | farbstring.equals(f84) | farbstring.equals(f85) | farbstring.equals(f86) | farbstring.equals(f87) | farbstring.equals(f88) | farbstring.equals(f89) | farbstring.equals(f90)){
code += "g";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f91) | farbstring.equals(f92) | farbstring.equals(f93) | farbstring.equals(f94) | farbstring.equals(f95) | farbstring.equals(f96) | farbstring.equals(f97) | farbstring.equals(f98) | farbstring.equals(f99) | farbstring.equals(f100)){
code += "h";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
} else if (farbstring.equals(f101) | farbstring.equals(f102) | farbstring.equals(f103) | farbstring.equals(f104) | farbstring.equals(f105) | farbstring.equals(f106) | farbstring.equals(f107) | farbstring.equals(f108) | farbstring.equals(f109) | farbstring.equals(f110)){
code += "i";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f111) | farbstring.equals(f112) | farbstring.equals(f113) | farbstring.equals(f114) | farbstring.equals(f115) | farbstring.equals(f116) | farbstring.equals(f117) | farbstring.equals(f118) | farbstring.equals(f119) | farbstring.equals(f120)){
code += "j";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f121) | farbstring.equals(f122) | farbstring.equals(f123) | farbstring.equals(f124) | farbstring.equals(f125) | farbstring.equals(f126) | farbstring.equals(f127) | farbstring.equals(f128) | farbstring.equals(f129) | farbstring.equals(f130)){
code += "k";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f131) | farbstring.equals(f132) | farbstring.equals(f133) | farbstring.equals(f134) | farbstring.equals(f135) | farbstring.equals(f136) | farbstring.equals(f137) | farbstring.equals(f138) | farbstring.equals(f139) | farbstring.equals(f140)){
code += "l";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f141) | farbstring.equals(f142) | farbstring.equals(f143) | farbstring.equals(f144) | farbstring.equals(f145) | farbstring.equals(f146) | farbstring.equals(f147) | farbstring.equals(f148) | farbstring.equals(f149) | farbstring.equals(f150)){
code += "m";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f151) | farbstring.equals(f152) | farbstring.equals(f153) | farbstring.equals(f154) | farbstring.equals(f155) | farbstring.equals(f156) | farbstring.equals(f157) | farbstring.equals(f158) | farbstring.equals(f159) | farbstring.equals(f160)){
code += "n";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f161) | farbstring.equals(f162) | farbstring.equals(f163) | farbstring.equals(f164) | farbstring.equals(f165) | farbstring.equals(f166) | farbstring.equals(f167) | farbstring.equals(f168) | farbstring.equals(f169) | farbstring.equals(f170)){
code += "o";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f171) | farbstring.equals(f172) | farbstring.equals(f173) | farbstring.equals(f174) | farbstring.equals(f175) | farbstring.equals(f176) | farbstring.equals(f177) | farbstring.equals(f178) | farbstring.equals(f179) | farbstring.equals(f180)){
code += "p";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f181) | farbstring.equals(f182) | farbstring.equals(f183) | farbstring.equals(f184) | farbstring.equals(f185) | farbstring.equals(f186) | farbstring.equals(f187) | farbstring.equals(f188) | farbstring.equals(f189) | farbstring.equals(f190)){
code += "q";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f191) | farbstring.equals(f192) | farbstring.equals(f193) | farbstring.equals(f194) | farbstring.equals(f195) | farbstring.equals(f196) | farbstring.equals(f197) | farbstring.equals(f198) | farbstring.equals(f199) | farbstring.equals(f200)){
code += "r";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f201) | farbstring.equals(f202) | farbstring.equals(f203) | farbstring.equals(f204) | farbstring.equals(f205) | farbstring.equals(f206) | farbstring.equals(f207) | farbstring.equals(f208) | farbstring.equals(f209) | farbstring.equals(f210)){
code += "s";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f211) | farbstring.equals(f212) | farbstring.equals(f213) | farbstring.equals(f214) | farbstring.equals(f215) | farbstring.equals(f216) | farbstring.equals(f217) | farbstring.equals(f218) | farbstring.equals(f219) | farbstring.equals(f220)){
code += "t";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f221) | farbstring.equals(f222) | farbstring.equals(f223) | farbstring.equals(f224) | farbstring.equals(f225) | farbstring.equals(f226) | farbstring.equals(f227) | farbstring.equals(f228) | farbstring.equals(f229) | farbstring.equals(f230)){
code += "u";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f231) | farbstring.equals(f232) | farbstring.equals(f233) | farbstring.equals(f234) | farbstring.equals(f235) | farbstring.equals(f236) | farbstring.equals(f237) | farbstring.equals(f238) | farbstring.equals(f239) | farbstring.equals(f240)){
code += "v";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f241) | farbstring.equals(f242) | farbstring.equals(f243) | farbstring.equals(f244) | farbstring.equals(f245) | farbstring.equals(f246) | farbstring.equals(f247) | farbstring.equals(f248) | farbstring.equals(f249) | farbstring.equals(f250)){
code += "w";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f251) | farbstring.equals(f252) | farbstring.equals(f253) | farbstring.equals(f254) | farbstring.equals(f255) | farbstring.equals(f256) | farbstring.equals(f257) | farbstring.equals(f258) | farbstring.equals(f259) | farbstring.equals(f260)){
code += "x";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f261) | farbstring.equals(f262) | farbstring.equals(f263) | farbstring.equals(f264) | farbstring.equals(f265) | farbstring.equals(f266) | farbstring.equals(f267) | farbstring.equals(f268) | farbstring.equals(f269) | farbstring.equals(f270)){
code += "y";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f271) | farbstring.equals(f272) | farbstring.equals(f273) | farbstring.equals(f274) | farbstring.equals(f275) | farbstring.equals(f276) | farbstring.equals(f277) | farbstring.equals(f278) | farbstring.equals(f279) | farbstring.equals(f280)){
code += "z";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f281) | farbstring.equals(f282) | farbstring.equals(f283) | farbstring.equals(f284) | farbstring.equals(f285) | farbstring.equals(f286) | farbstring.equals(f287) | farbstring.equals(f288) | farbstring.equals(f289) | farbstring.equals(f290)){
code += ",";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f291) | farbstring.equals(f292) | farbstring.equals(f293) | farbstring.equals(f294) | farbstring.equals(f295) | farbstring.equals(f296) | farbstring.equals(f297) | farbstring.equals(f298) | farbstring.equals(f299) | farbstring.equals(f300)){
code += ".";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else if (farbstring.equals(f301) | farbstring.equals(f302) | farbstring.equals(f303) | farbstring.equals(f304) | farbstring.equals(f305) | farbstring.equals(f306) | farbstring.equals(f307) | farbstring.equals(f308) | farbstring.equals(f309) | farbstring.equals(f310)){
code += " ";
StartEasterEgg();
Toast.makeText(this, code, Toast.LENGTH_SHORT).show();
}else {
code = "";
StartEasterEgg();
}
}
private void StartEasterEgg() {
if (code == easteregg_lösung){
startActivity(new Intent(this, Easter_egg.class));
}
}
@Override
public void onBackPressed() {
Log.e("######","Du kommst hier net raus");
}
}
Wenn ich diese Stelle entferne, dann stürzt die ab nicht mehr ab: easteregg_lösung = value.getString("2021");
In einer andere App geht der Code perfekt und ich kann Strings und Integer problemlos rausladen...
Wiso Stürtzt die App ab und was kann ich machen?
Möchte viel mehr mit Firestore arbeiten.
Jede Hilfe bin ich sehr dankbar!!!!