Note that there are some explanatory texts on larger screens.

plurals
  1. POError when i try my Logo Quiz like app
    text
    copied!<p>Everyone heard about Logo Quiz! I try to develop a game like logo quiz and this is the activity in which you have to put the name of the logo! The image and the name is received by intent . The image tag contains the name .</p> <pre><code>public class Vie extends Activity implements OnClickListener { ImageView img; EditText et; Button btn; TextView txt; MediaPlayer win_sound, wrong_sound; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.vie); img = (ImageView) findViewById(R.id.img); et = (EditText) findViewById(R.id.et); btn = (Button) findViewById(R.id.btnCheck); txt = (TextView) findViewById(R.id.txt); win_sound = MediaPlayer.create(Vie.this, R.raw.win); wrong_sound= MediaPlayer.create(Vie.this, R.raw.wrong); setImageAndTagByIntent(img); btn.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub boolean mb = check(et, btn, img); if (mb = true) { // Sunet toast thread txt.setText(title(img)); win_sound.start(); Thread t = new Thread() { @Override public void run() { // TODO Auto-generated method stub super.run(); try { sleep(win_sound.getDuration()); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { finish(); } } }; t.start(); } if (mb = false) { // sunet toast thread wrong_sound.start(); Toast t = new Toast(Vie.this); t.setText("Wrong answer! Please check if you have spelled corectly the name of the team!"); t.show(); } } private CharSequence title(ImageView img2) { // TODO Auto-generated method stub String s = (String) img2.getTag(); return s; } private void setImageAndTagByIntent(ImageView img2) { // TODO Auto-generated method stub // Trece si tagul! Intent i = getIntent(); Bitmap back = i.getParcelableExtra("back"); Drawable b = new BitmapDrawable(getResources(), back); img2.setImageDrawable(b); String tag = i.getStringExtra("tag"); Object tag2 = (Object) tag; img2.setTag(tag2); } private boolean check(EditText et2, Button btn2, ImageView img2) { // TODO Auto-generated method stub String s = et2.getText().toString(); s = WordUtils.capitalize(s); String s1 = (String) img2.getTag(); boolean b = false; if (hasBlank(s1) == true &amp;&amp; s.contentEquals(firstWord(s1))) { b = true; } if (hasBlank(s1) == true &amp;&amp; s.contentEquals(lastWord(s1))) { b = true; } if (s.contentEquals(s1) &amp;&amp; hasBlank(s1) == false) { b = true; } return b; } private String lastWord(String s1) { // TODO Auto-generated method stub String arr[] = s1.split("//s"); return arr[1]; } private String firstWord(String s1) { // TODO Auto-generated method stub String arr[] = s1.split("//s"); return arr[0]; } private boolean hasBlank(String string) { // TODO Auto-generated method stub if (string.contains(" ")) { return true; } return false; } } </code></pre> <p>But when I write anything in the edit text it appers as correct! Please Help Me! I think it is a problem with the boolean methode!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload