title: How to pass dynamic values to a Query using SQLITE in Android ?
body: <p>i am trying to pass dynamic id to query every time no of passed id will change sometimes it may be 3 or  2 or etc.My question is how can i pass this id and select values from query.</p>
  
  <pre><code>String[] splits = clickedTopicIdString.split("-");
      Log.i("splits",""+splits.length); // length 2 bcoz clickedTopicIdString = 0-1 it may be 0-1-2 etc
      if(splits.length &gt; 0)
      {
          for(int i=0;i&lt;splits.length;i++)
          {clickedTopicIdInt = Integer.parseInt(splits[i]);// i want to save values in an array and pass it GetQuestionData(); this method after converting it in integer.....
           Log.i("clickedTopicIdInt",""+clickedTopicIdInt);
          }
  
      }
  
      clickedTopicIdInt = Integer.parseInt(clickedTopicIdString);
      dbhelper = new JamiaBinoriaDBHelper(context);
      dbhelper.open();
      GetQuestionData();
  </code></pre>
  
  <p>This function will recieve id dynamically in form of arrays and will apply it here topic_question.topic_id="+topic_id1+" OR topic_question.topic_id="+topic_id2+"  and so on how can i do this?</p>
  
  <pre><code>public List&lt;String&gt; GetClickedIdImages(int topic_id)
      { List&lt;String&gt; questionImageNameList = new ArrayList&lt;String&gt;();
      String query = "SELECT topic_question.question_image_name FROM topic_question,topic WHERE topic_question.topic_id="+topic_id+" AND topic.id=topic_question.topic_id";   
     // Cursor cursor = db.rawQuery("SELECT topic_question.question_image_name FROM topic_question,topic WHERE topic_question.topic_id=1 AND topic.id=topic_question.topic_id",null);
      Cursor cursor = db.rawQuery(query,null);
      Log.i("Cursor Query Print:",""+query);
          if(cursor != null) {
              cursor.moveToFirst();
              while (!cursor.isAfterLast()) {
           Log.d("cursor",""+cursor);
                  questionImageNameList.add(cursor.getString(0));
                  Log.i("cursor.getString(2)",""+cursor.getString(0));
                  cursor.moveToNext();
              }
          } else {
              Log.d("", "Cursor is Null");
              Log.d("retrieving all parameters", "count &lt; 0");
          }
  
          cursor.close();
          return questionImageNameList;
      }
  </code></pre>
  
  <p>can someone please help me in this task ? </p>