title: Android DB(DatabaseHandler) throws EXCEPTION
body: <p>I am using DatabaseHandler. The DatabaseHandler is resposibole for all the images(flags)iam using in the game. everytime my activity is refresh and load another image (my database have 218 images). in some point I got an FATAL EXCEPTION or:</p>
  
  <pre><code>04-19 23:00:41.177: W/dalvikvm(10808): threadid=1: thread exiting with uncaught exception (group=0x41674db8)
  04-19 23:00:41.177: E/AndroidRuntime(10808): FATAL EXCEPTION: main
  </code></pre>
  
  <p>My code:<br>
  <strong>MainActivity</strong> (include the database adding(inserting to db):</p>
  
  <pre><code>public class MainActivity extends Activity implements OnClickListener {
  
  private static final String TAG = "Flagss Game" ;//יצירת טאג למשחק לשימוש בםונקציות כמו exception
  
  Button start;
  Button time;
  Button reguler;
  Button sound;
  Button tens;
  boolean flag=true;
  MediaPlayer mpBack;
  DatabaseHandler db = new DatabaseHandler(this);
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      //List&lt;Flagss&gt; arrAdd= new ArrayList&lt;Flagsss&gt;();
      //**
      tens = (Button)findViewById(R.id.topten);
      tens.setOnClickListener(TopOnClickListener);
      //**
      start = (Button)findViewById(R.id.start_btn);
      time = (Button)findViewById(R.id.time);
      reguler = (Button)findViewById(R.id.reguler);
      sound = (Button)findViewById(R.id.sound);
      sound.setBackgroundColor(Color.TRANSPARENT);
      sound.setOnClickListener(SoundOnClickListener);
      mpBack = MediaPlayer.create(this, R.raw.background_sound);
      mpBack.start();
      start.setOnClickListener(this);
      db = new DatabaseHandler(this);
  
      creat_rows();
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  //**
  public OnClickListener TopOnClickListener = new OnClickListener(
          ) {
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          Intent intent = new Intent(MainActivity.this,TopTen.class);
          startActivity(intent);
      }
  };
  //**
  
  public OnClickListener SoundOnClickListener = new OnClickListener() {
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          mpBack.stop();
          if(flag)
          {
              sound.setBackgroundResource(R.drawable.speaker_off);
              flag = false;
          }
          else
          {
              mpBack.start();
              sound.setBackgroundResource(R.drawable.speaker_on);
          }
      }
  };
  
  @Override
  public void onClick(View v) {
      // TODO Auto-generated method stub
      start.setVisibility(start.INVISIBLE);
      tens.setVisibility(tens.INVISIBLE);
      time.setVisibility(time.VISIBLE);
      reguler.setVisibility(reguler.VISIBLE);
  
      //Intent s = new Intent(this,ClassicMode.class);
      //startActivity(s);
  
      reguler.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              Intent cm = new Intent(MainActivity.this,ClassicMode.class);
              //Intent c = new Intent(MainActivity.class ,ClassicMode.class);
              startActivity(cm); 
              mpBack.stop();
          }
      });
  
      time.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent tm = new Intent(MainActivity.this,TimeAttack.class);
              startActivity(tm);
              mpBack.stop();
              Log.d(TAG, "inside time");
          }
      });
  }
  
  
  public void creat_rows()
  {
      Log.d(TAG, "Inserting...");
      //image     id   name 
      db.addFlag(new Flags("afghanistan",0,"Afghanistan"));
      db.addFlag(new Flags("albania",1,"albania"));
      db.addFlag(new Flags("algeria",2,"Algeria" ));
      db.addFlag(new Flags("american_samoa", 3,"American Samoa" ));
      db.addFlag(new Flags("andorra",  4,"Andorra" ));
      db.addFlag(new Flags("angola",5,"Angola"));
      db.addFlag(new Flags("antigua_and_barbuda", 6,"Antigua and Barbuda" ));
      db.addFlag(new Flags("argentina", 7,"Argentina" ));
      db.addFlag(new Flags("arrmenia", 8,"Arrmenia"));
      db.addFlag(new Flags("australia", 9,"Australia"));
      db.addFlag(new Flags( "austria",10,"Austria"));
      db.addFlag(new Flags("azerbaijan", 11,"Azerbaijan"));
      db.addFlag(new Flags("bahamas",12,"Bahamas" ));
      db.addFlag(new Flags("bahrain",13,"Bahrain"));
      db.addFlag(new Flags("bangladesh", 14,"Bangladesh"));
      db.addFlag(new Flags("barbados",15,"Barbados"));
      db.addFlag(new Flags("belarus", 16,"Belarus"));
      db.addFlag(new Flags("belgium",17,"Belgium"));
      db.addFlag(new Flags("belize",18,"Belize"));
      db.addFlag(new Flags("benin",19,"Benin"));
      db.addFlag(new Flags("bermuda",20,"Bermuda"));
      db.addFlag(new Flags("bhutan", 21,"Bhutan" ));
      db.addFlag(new Flags("bolivia",22,"Bolivia" ));
      db.addFlag(new Flags("bosnia", 23,"Bosnia"));
      db.addFlag(new Flags("botswana",  24,"Botswana" ));
      db.addFlag(new Flags("brazil", 25,"Brazil"));
      db.addFlag(new Flags("brunei",26,"Brunei"));
      db.addFlag(new Flags("bulgaria",27,"Bulgaria" ));
      db.addFlag(new Flags("burkina",28,"Burkina"));
      db.addFlag(new Flags("burundi", 29,"Burundi" ));
      db.addFlag(new Flags("cambodia",30,"Cambodia" ));
      db.addFlag(new Flags("cameroon",31,"Cameroon"));
      db.addFlag(new Flags("canada",32,"Canada" ));
      db.addFlag(new Flags("cape_verde",33,"Cape Verde"));
      db.addFlag(new Flags("cayman_islands",34,"Cayman Islands"));
      db.addFlag(new Flags("central_africa_republic", 35,"Central African Republic" ));
      db.addFlag(new Flags("chad",36,"Chad"));
      db.addFlag(new Flags("chile",37,"Chile"));
      db.addFlag(new Flags("china",38,"China"));
      db.addFlag(new Flags("colombia",39,"Colombia"));
      db.addFlag(new Flags("comoros",40,"Comoros"));
      db.addFlag(new Flags("congo",41,"Congo"));
      db.addFlag(new Flags("cook_islands",42,"Cook Islands" ));
      db.addFlag(new Flags("costa_rica",43,"Costa Rica"));
      db.addFlag(new Flags("croatia",44,"Croatia"));
      db.addFlag(new Flags("cuba",45,"Cuba"));
      db.addFlag(new Flags("cyprus", 46,"Cyprus"));
      db.addFlag(new Flags("czech",47,"Czech"));
      db.addFlag(new Flags("democratic_republic_congo",48,"Democratic Republic-Congo"));
      db.addFlag(new Flags("denmark", 49,"Denmark"));
      db.addFlag(new Flags("djibouti",50,"Djibouti"));
      db.addFlag(new Flags("dominica",51,"Dominica"));
      db.addFlag(new Flags("dominican_republic",52,"Dominican Republic"));
      db.addFlag(new Flags("east Timor",53,"East Timor"));
      db.addFlag(new Flags("ecuador",54,"Ecuador"));
      db.addFlag(new Flags("egypt",55,"Egypt"));
      db.addFlag(new Flags("el_salvador",56,"El Salvador"));
      db.addFlag(new Flags("england",57,"England"));
      db.addFlag(new Flags("equatorial_guinea",58,"Equatorial Guinea"));
      db.addFlag(new Flags("eritrea",59,"Eritrea"));
      db.addFlag(new Flags("estonia",60,"Estonia"));
      db.addFlag(new Flags("ethiopia",61,"Ethiopia" ));
      db.addFlag(new Flags( "falkland_islands",62,"Falkland Islands" ));
      db.addFlag(new Flags("fiji", 63,"Fiji"));
      db.addFlag(new Flags("finland",64,"Finland"));
      db.addFlag(new Flags("france",65,"France" ));
      db.addFlag(new Flags("french_polynesia",66,"French Polynesia"));
      db.addFlag(new Flags("gabon", 67,"Gabon" ));
      db.addFlag(new Flags("gambia",68,"Gambia" ));
      db.addFlag(new Flags("georgia",69,"Georgia"));
      db.addFlag(new Flags("germany",70,"Germany"));
      db.addFlag(new Flags("ghana", 71,"Ghana"));
      db.addFlag(new Flags("greece",72,"Greece"));
      db.addFlag(new Flags("greenland",73,"Greenland"));
      db.addFlag(new Flags("grenada",74,"Grenada" ));
      db.addFlag(new Flags("guam",75,"Guam" ));
      db.addFlag(new Flags("guatemala",76,"Guatemala"));
      db.addFlag(new Flags("guinea_bissau",77,"Guinea Bissau"));
      db.addFlag(new Flags("guinea",78,"Guinea"));
      db.addFlag(new Flags("guyana",79,"Guyana"));
      db.addFlag(new Flags("haiti",80,"Haiti"));
      db.addFlag(new Flags("honduras",81,"Honduras"));
      db.addFlag(new Flags("hungary",82,"Hungary"));
      db.addFlag(new Flags("iceland",83,"Iceland"));
      db.addFlag(new Flags("india",84,"India"));
      db.addFlag(new Flags("indonesia",85,"Indonesia" ));
      db.addFlag(new Flags("iran",86,"Iran" ));
      db.addFlag(new Flags("iraq",87,"Iraq" ));
      db.addFlag(new Flags("ireland",88,"Ireland"));
      db.addFlag(new Flags("israel",89,"Israel"));
      db.addFlag(new Flags("italy",90,"Italy"));
      db.addFlag(new Flags("ivory_coast",91,"Ivory Coast"));
      db.addFlag(new Flags("jamaica",92,"Jamaica"));
      db.addFlag(new Flags("japan",93,"Japan"));
      db.addFlag(new Flags("jordan",94,"Jordan" ));
      db.addFlag(new Flags("kazakhstan",95,"Kazakhstan"));
      db.addFlag(new Flags("kenya",96,"Kenya" ));
      db.addFlag(new Flags("kiribati",97,"Kiribati"));
      db.addFlag(new Flags("Kosovo",98,"kosovo"));
      db.addFlag(new Flags("kuwait",99,"Kuwait"));
      db.addFlag(new Flags("kyrgyzstan",100,"Kyrgyzstan"));
      db.addFlag(new Flags("laos",101,"Laos" ));
      db.addFlag(new Flags("latvia",102,"Latvia"));
      db.addFlag(new Flags("lesotho",104,"Lesotho" ));
      db.addFlag(new Flags("liberia",105,"Liberia"));
      db.addFlag(new Flags("libya",106,"Libya"));
      db.addFlag(new Flags("liechtenstein",107,"Liechtenstein"));
      db.addFlag(new Flags("lithuania",108,"Lithuania" ));
      db.addFlag(new Flags("luxembourg",109,"Luxembourg"));
      db.addFlag(new Flags("macau",110,"Macau"));
      db.addFlag(new Flags("macedonia",111,"Macedonia"));
      db.addFlag(new Flags("madagascar",112,"Madagascar"));
      .
      .//more flags till ID218
      .
      db.addFlag(new Flags("venezuela",211,"Venezuela"));
      db.addFlag(new Flags("vietnam",212,"Vietnam"));
      db.addFlag(new Flags("virgin_islands",213,"Virgin Islands"));
      db.addFlag(new Flags("wales",214,"Wales"));
      db.addFlag(new Flags("westren_sahara",215,"Westren Sahara" ));
      db.addFlag(new Flags("yemen",216,"Yemen"));
      db.addFlag(new Flags("zambia",217,"Zambia"));
      db.addFlag(new Flags("zimbabwe",218,"Zimbabwe"));
  
  
  }
  </code></pre>
  
  <p><strong>DatabaseHandler</strong> (all the func on the DB):</p>
  
  <pre><code>public class DatabaseHandler extends SQLiteOpenHelper{
  
  private static final int DATABASE_VERSION = 1;
  
  // Database Name
  private static final String DATABASE_NAME = "flagsManager";
  
  // Contacts table name
  private static final String TABLE_FLAGS = "flag";
  
  // Contacts Table Columns names
  private static final String KEY_ID = "id";
  private static final String KEY_NAME = "name";
  private static final String KEY_IMAGE = "image";
  
  
  
  
  public DatabaseHandler(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  
  // Creating Tables
  @Override
  public void onCreate(SQLiteDatabase db) {
      String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_FLAGS + " ( "
              + KEY_ID + " INTEGER  PRIMARY KEY," + KEY_NAME + " VARCHAR(64)," 
              +KEY_IMAGE +" VARCHAR(64) ) ";
      db.execSQL(CREATE_CONTACTS_TABLE);
  
  
  }
  
  // Upgrading database
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      db.execSQL("DROP TABLE IF EXISTS " + TABLE_FLAGS);
  
      onCreate(db);
  }
  
  
  void addFlag(Flags flag) {//הכנסת מידע למערך
      SQLiteDatabase db = this.getWritableDatabase();
  
      ContentValues values = new ContentValues();
      values.put(KEY_IMAGE, flag.getImage());              //Image name/string
      values.put(KEY_ID, flag.getId());                   //Country Id
      values.put(KEY_NAME, flag.getName());              // Country Name
  
      db.insert(TABLE_FLAGS, null, values);
  
      db.close();                                           // Closing database connection
  }
  
  Flags getFlag(int id) {
      List&lt;Flags&gt; flagList = new ArrayList&lt;Flags&gt;();
      String selectQuery = "SELECT  * FROM " + TABLE_FLAGS;
  
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      if (cursor.moveToFirst()) {
          do {
  
              Flags flag = new Flags();
              flag.setId(Integer.parseInt(cursor.getString(0)));
              flag.setName(cursor.getString(1));
              flag.setImage(cursor.getString(2));
  
              //     flag.setPhoneNumber(cursor.getString(3));
              flagList.add(flag);
          } while (cursor.moveToNext());
      }
  
      Log.d("into ",flagList.get(id)+"" );
      Log.d("into ",id+"" );
  
      return flagList.get(id);
  }
  
  public List&lt;Flags&gt; getAllFlags() {
      List&lt;Flags&gt; flagList = new ArrayList&lt;Flags&gt;();
  
      String selectQuery = "SELECT  * FROM " + TABLE_FLAGS;
  
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      if (cursor.moveToFirst()) {
          do {
  
              Flags flag = new Flags();//String image, int id, String name
              flag.setImage(cursor.getString(2));
              flag.setId(Integer.parseInt(cursor.getString(0)));
              flag.setName(cursor.getString(1));
  
              //     contact.setPhoneNumber(cursor.getString(3));
              flagList.add(flag);
          } while (cursor.moveToNext());
      }
      return flagList;
  }
  
  
  public int updateContact(Flags flag) {
      SQLiteDatabase db = this.getWritableDatabase();
  
      ContentValues values = new ContentValues();
      values.put(KEY_NAME, flag.getName());
      values.put(KEY_IMAGE, flag.getImage());
  
      return db.update(TABLE_FLAGS, values, KEY_ID + " = ?",
              new String[] { String.valueOf(flag.getId()) });
  }
  
  public void deleteContact(Flags flag) {
      SQLiteDatabase db = this.getWritableDatabase();
      db.delete(TABLE_FLAGS, KEY_ID + " = ?",
              new String[] { String.valueOf(flag.getId()) });
      db.close();
  }
  
  
  public int getContactsCount() {
      String countQuery = "SELECT  * FROM " + TABLE_FLAGS;
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(countQuery, null);
      cursor.close();
  
      return cursor.getCount();
  }
  
  }
  </code></pre>
  
  <p><strong>The classicMode</strong> (the game itself)://as you can see the pic_view is import the image from the DB annd put it in the game</p>
  
  <pre><code>public class ClassicMode extends Activity implements AnimationListener{//מהמשחק עצמו
  
  String pic;//תמונה של הדגל
  Button answer1;//תשובות
  Button answer2;
  Button answer3;
  Button answer4;
  Button hint;
  TextView guess;
  TextView numOfGuess;
  TextView score;
  TextView scorenum;
  MediaPlayer mpHint;
  MediaPlayer mpNext;
  MediaPlayer mpWrong;
  Animation animationfadein;
  Animation animationfadeout;
  String fn;
  Guesses G;
  Score s;
  Button [] b = new Button[4];
  DatabaseHandler db = new DatabaseHandler(this);
  List&lt;String&gt;WrongAnswers=new ArrayList&lt;String&gt;();
  
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_second);
  
      ActionBar actionBar = getActionBar();
      actionBar.setDisplayHomeAsUpEnabled(true);
      score =(TextView)findViewById(R.id.score);
      scorenum =(TextView)findViewById(R.id.scorenum);
      scorenum.setText(String.valueOf(s.score));
      guess =(TextView)findViewById(R.id.guesses);
      numOfGuess=(TextView)findViewById(R.id.numOfGuesses);
      numOfGuess.setText(String.valueOf(Guesses.numOfGuesses));
      hint =(Button)findViewById(R.id.hint);
      hint.setOnClickListener(hintOnClickListener);
      mpHint = MediaPlayer.create(this,R.raw.hint_sound);
      mpNext = MediaPlayer.create(this, R.raw.next_flag);
      mpWrong = MediaPlayer.create(this, R.raw.wrong_answer);
      animationfadein = AnimationUtils.loadAnimation(this, R.anim.fade_in);
      animationfadeout = AnimationUtils.loadAnimation(this, R.anim.fade_out);
  
      Flags f = new Flags();
      Random r = new Random();//הדגל שיבחר לשאלה
      int num = r.nextInt(160);//Up
  
      f = db.getFlag(num);//הצגת הדגל הרנדומלי שיצא
      fn = f.getName().toString();
      pic = f.getImage().toString();
      pic_view(pic);//מעבר לפונקציה להשמת התמונה של הדגל במשחק
  
      //מערך ארבע כפתורים כנגד ארבע תשובות
  
      b[0] = (Button)findViewById(R.id.button1);
      b[1] = (Button)findViewById(R.id.button2);
      b[2] = (Button)findViewById(R.id.button3);
      b[3] = (Button)findViewById(R.id.button4);
  
      List&lt;String&gt;Answers=new ArrayList&lt;String&gt;();//מערך תשובות
  
      Answers.add(f.getName().toString());//הוספת התשובה הנכונה
      for(int i=1;i&lt;4;i++)
      {
          num = r.nextInt(200);
          String valToAdd1 = db.getFlag(num).getName().toString();
          if(!Answers.contains(valToAdd1)){
              WrongAnswers.add(valToAdd1);
              Answers.add(valToAdd1);
          }
  
      }
  
      /*num = r.nextInt(30);
      Answers.add(db.getFlag(num).getName().toString());//הוספת 3 תשובות רנדומליות
      num = r.nextInt(30);
      Answers.add(db.getFlag(num).getName().toString());
      num = r.nextInt(30);
      Answers.add(db.getFlag(num).getName().toString());*/
  
      Collections.shuffle(Answers);//ערבוב התשובות
  
      for(int i=0;i&lt;Answers.size();i++)
      {
          b[i].setText(Answers.get(i));//השמת התשובות מהמהערך למערך הכפתורים
          b[i].startAnimation(animationfadein);
      }
  }//end of OnCreat
  
  
  public boolean onOptionsItemSelected(MenuItem item){//actionbar activity
      Intent myIntent = new Intent(getApplicationContext(), MainActivity.class);
      startActivityForResult(myIntent, 0);
      return true;
  }
  
  @SuppressLint("NewApi")
  public void resetQuiz()
  {
      recreate();
  }
  
  private OnClickListener hintOnClickListener = new OnClickListener() {
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          mpHint.start();
          if(Guesses.numOfGuesses==1)
          {
              G.setNumOfGuesses(3);
              finish();//כאשר מספר הניחושים
              return;
          }
          else
              G.numOfGuesses--;
  
          int invisblecount=0;
          for(int i=0;i&lt;b.length;i++){
              if(invisblecount&lt;2){
                  String buttonText = b[i].getText().toString();  
                  if(buttonText.equals(WrongAnswers.get(0))||buttonText.equals(WrongAnswers.get(1)))
                  {
                      b[i].startAnimation(animationfadeout);
                      b[i].setVisibility(View.INVISIBLE);
                      invisblecount++;
                  }
              }
          }
      }
  };
  
  public void check(View v)
  {
      Log.d("yes", fn);
      Button b = (Button)v;
      String text = b.getText().toString();
      if(text.equals(fn))
      {
          mpNext.start();
          s.score+=5;
          resetQuiz();
      }
      else
      {
          mpWrong.start();
          if(Guesses.numOfGuesses==1)
          {
              Log.d("kkk", "inside if");
              G.setNumOfGuesses(3);
              Toast toast = Toast.makeText(getApplicationContext(), "No more guesses :( Lets see what you made so far...", Toast.LENGTH_SHORT);
              toast.show();
              Intent person = new Intent(ClassicMode.this,Person.class);
              String extra = scorenum.getText().toString();
              person.putExtra("Score", extra);
              startActivity(person);
          }
          Guesses.numOfGuesses--;
          if(s.score&gt;0)
              s.score-=5;
          scorenum.setText(String.valueOf(s.score));
          numOfGuess.setText(String.valueOf(Guesses.numOfGuesses));
      }
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.second, menu);
      return true;
  }
  
  private void pic_view(String pic2) {
      // TODO Auto-generated method stub
      //גישה לדגל לפי שמו וייבוא התמונה
      Log.d("Result from pic function " , pic2);
      ImageView imageView = (ImageView)findViewById(R.id.imageView1);
      String uri ="@drawable/";
      uri += pic2;    
      int imageResource = getResources().getIdentifier(uri, pic2, getPackageName());//הצוות התמונה 
      Drawable res= getResources().getDrawable(imageResource);//ציור התמונה
      imageView.setImageDrawable(res);
  }
  
  
  @Override
  public void onAnimationEnd(Animation animation) {
      // TODO Auto-generated method stub
      Toast.makeText(getBaseContext(), "Animatoin Stoped", Toast.LENGTH_SHORT).show();
  }
  
  
  @Override
  public void onAnimationRepeat(Animation animation) {
      // TODO Auto-generated method stub
  
  }
  
  
  @Override
  public void onAnimationStart(Animation animation) {
      // TODO Auto-generated method stub
  
  }
  
  }
  </code></pre>
  
  <p>Last stacktrace:(include the fatal exeption):</p>
  
  <pre><code>04-19 23:00:40.967: D/yes(10808): Botswana
  04-19 23:00:41.157: D/into(10808): com.example.flagsgame.Flags@424c4fc0
  04-19 23:00:41.157: D/into(10808): 154
  04-19 23:00:41.157: D/Result from pic function(10808): pitcairn_islands
  04-19 23:00:41.167: W/ResourceType(10808): No package identifier when getting value for resource number 0x00000000
  04-19 23:00:41.167: E/ActivityThread(10808): Failed to find resource
  04-19 23:00:41.167: E/ActivityThread(10808): android.content.res.Resources$NotFoundException: Resource ID #0x0
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.content.res.Resources.getValue(Resources.java:1195)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.content.res.Resources.getDrawable(Resources.java:729)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.content.res.Resources.getDrawable(Resources.java:711)
  04-19 23:00:41.167: E/ActivityThread(10808):    at com.example.flagsgame.ClassicMode.pic_view(ClassicMode.java:213)
  04-19 23:00:41.167: E/ActivityThread(10808):    at com.example.flagsgame.ClassicMode.onCreate(ClassicMode.java:82)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.Activity.performCreate(Activity.java:5231)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3762)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread.access$900(ActivityThread.java:144)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.os.Handler.dispatchMessage(Handler.java:102)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.os.Looper.loop(Looper.java:136)
  04-19 23:00:41.167: E/ActivityThread(10808):    at android.app.ActivityThread.main(ActivityThread.java:5146)
  04-19 23:00:41.167: E/ActivityThread(10808):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-19 23:00:41.167: E/ActivityThread(10808):    at java.lang.reflect.Method.invoke(Method.java:515)
  04-19 23:00:41.167: E/ActivityThread(10808):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
  04-19 23:00:41.167: E/ActivityThread(10808):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
  04-19 23:00:41.167: E/ActivityThread(10808):    at dalvik.system.NativeStart.main(Native Method)
  04-19 23:00:41.177: D/AndroidRuntime(10808): Shutting down VM
  04-19 23:00:41.177: W/dalvikvm(10808): threadid=1: thread exiting with uncaught exception (group=0x41674db8)
  04-19 23:00:41.177: E/AndroidRuntime(10808): FATAL EXCEPTION: main
  04-19 23:00:41.177: E/AndroidRuntime(10808): Process: com.example.flagsgame, PID: 10808
  04-19 23:00:41.177: E/AndroidRuntime(10808): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.flagsgame/com.example.flagsgame.ClassicMode}: android.content.res.Resources$NotFoundException: Resource ID #0x0
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2212)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3762)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread.access$900(ActivityThread.java:144)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.os.Handler.dispatchMessage(Handler.java:102)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.os.Looper.loop(Looper.java:136)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at  android.app.ActivityThread.main(ActivityThread.java:5146)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at java.lang.reflect.Method.invoke(Method.java:515)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at dalvik.system.NativeStart.main(Native Method)
  04-19 23:00:41.177: E/AndroidRuntime(10808): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.content.res.Resources.getValue(Resources.java:1195)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.content.res.Resources.getDrawable(Resources.java:729)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.content.res.Resources.getDrawable(Resources.java:711)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at com.example.flagsgame.ClassicMode.pic_view(ClassicMode.java:213)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at com.example.flagsgame.ClassicMode.onCreate(ClassicMode.java:82)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.Activity.performCreate(Activity.java:5231)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
  04-19 23:00:41.177: E/AndroidRuntime(10808):    ... 12 more
  </code></pre>
  
  <p>Sorry for long code and stacktrace but I gave all the information needed I think.</p>