title: How to get id and pass to next activity?
body: <p>Below is my search activity</p>
  
  <pre><code>public class SearchActivity extends AppCompatActivity {
      // CONNECTION_TIMEOUT and READ_TIMEOUT are in milliseconds
      public static final int CONNECTION_TIMEOUT = 10000;
      public static final int READ_TIMEOUT = 15000;
      private SimpleCursorAdapter myAdapter;
      SearchView searchView = null;
      private String[] strArrData = {"No Suggestions"};
      //List&lt;WarehouseSalesDetails&gt; strArrData;
  
      @Override
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.search_item);
          Toolbar toolBarSearch = (Toolbar)findViewById(R.id.toolbarSearch);
          setSupportActionBar(toolBarSearch);
  
          final String[] from = new String[]{"title"};
          final int[] to = new int[]{android.R.id.text1};
          //setup SimpleCursorAdapter
          myAdapter = new SimpleCursorAdapter(SearchActivity.this,android.R.layout.simple_spinner_dropdown_item,null,from,to,
                  CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
  
          new RetrieveWarehouseSalesTask(this).execute();
  
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu){
          getMenuInflater().inflate(R.menu.menu_search,menu);
          MenuItem searchItem = menu.findItem(R.id.action_search);
          SearchManager searchManager = (SearchManager)SearchActivity.this.getSystemService(Context.SEARCH_SERVICE);
          if(searchItem!=null){
              searchView = (SearchView) searchItem.getActionView();
          }
          if(searchView!=null){
              searchView.setSearchableInfo(searchManager.getSearchableInfo(SearchActivity.this.getComponentName()));
              searchView.setIconified(false);
              searchView.setSuggestionsAdapter(myAdapter);
              //getting selected on item suggestion
              searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener(){
                  @Override
                  public boolean onSuggestionClick(int position){
                      //Add clicked text to search box
                      CursorAdapter ca = searchView.getSuggestionsAdapter();
                      Cursor cursor = ca.getCursor();
                      cursor.moveToPosition(position);
                      searchView.setQuery(cursor.getString(cursor.getColumnIndex("title")),false);
  
                      return true;
  
                  }
  
                  @Override
                  public boolean onSuggestionSelect(int position){
                      return true;
                  }
              });
              searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
                  @Override
                  public boolean onQueryTextSubmit(String s){
                      return false;
                  }
                  @Override
                  public boolean onQueryTextChange(String s){
                      //filter data
                      final MatrixCursor mc = new MatrixCursor(new String[]{
                              BaseColumns._ID,"title"
                      });
                      for(int i = 0; i&lt;strArrData.length; i++){
                          if(strArrData[i].toLowerCase().startsWith(s.toLowerCase())){
                              mc.addRow(new Object[]{i,strArrData[i]});
                          }
  
                      }
                      myAdapter.changeCursor(mc);
                      return false;
                  }
              });
  
          }
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item){
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      protected void onNewIntent(Intent intent){
          if(Intent.ACTION_SEARCH.equals(intent.getAction())){
              String query = intent.getStringExtra(SearchManager.QUERY);
              if(searchView!=null){
                  searchView.clearFocus();
              }
          }
      }
  
      class RetrieveWarehouseSalesTask extends AsyncTask&lt;Void,Void,Void&gt; {
          private String TAG = ActiveWarehouseSalesFragment.RetrieveWarehouseSalesTask.class.getSimpleName();
          private String TAG_PID = "pid";
          public ProgressDialog pDialog;
          private Context context;
          //URL to get JSON details
          private String url = "http://example.com/abc.php";
          ArrayList&lt;HashMap&lt;String,String&gt;&gt; sales_details;
          JSONObject jsonObj;
          String jsonStr;
          JSONArray sales;
  
          //for recycler view
          private RecyclerView warehouse_recycler;
          private AdapterRecycler mAdapter;
          List&lt;WarehouseSalesDetails&gt; data = new ArrayList&lt;&gt;();
  
          public RetrieveWarehouseSalesTask(Context context){
              this.context = context;
              sales_details = new ArrayList&lt;&gt;();
  
          }
  
  
  
          @Override
          protected void onPreExecute(){
              super.onPreExecute();
              pDialog = new ProgressDialog(context);
              pDialog.setMessage("Searching...");
              pDialog.setCancelable(false);
              pDialog.show();
          }
  
          @Override
          protected Void doInBackground(Void... arg0){
              HttpHandler sh = new HttpHandler();
              //making a request to URL and getting response
              jsonStr = sh.makeServiceCall(url);
              Log.e(TAG, "Response from url (SearchActivity): " + jsonStr);
  
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result){
              ArrayList&lt;String&gt; dataList = new ArrayList&lt;String&gt;();
              super.onPostExecute(result);
              if(pDialog.isShowing()){
                  pDialog.dismiss();
              }
              if(jsonStr != null){
                  try{
                      jsonObj = new JSONObject(jsonStr);
                      //Getting JSON Array Node
                      sales = jsonObj.getJSONArray("Result");
                      //looping through all results
                      for(int i = sales.length() - 1; i &gt;= 0 ;i--){
                          JSONObject s = sales.getJSONObject(i);
                          WarehouseSalesDetails wsd = new WarehouseSalesDetails();
                          wsd.id = s.getString("id");
                          wsd.company_name = s.getString("company_name");
                          wsd.promotion_image= s.getString("promotion_image");
                          wsd.title = s.getString("title");
                          dataList.add(s.getString("title"));
                          wsd.promotional_period = s.getString("promotional_period");
                          wsd.viewCount = s.getString("view_count");
                          data.add(wsd);
                      }
                      strArrData = dataList.toArray(new String[dataList.size()]);
                      Log.d("TAG",sales_details.toString());
                  }catch(final JSONException e){
                      Log.e(TAG, "JSON parsing error: " + e.getMessage());
                  }
              }else{
                  Log.e(TAG,"Couldn't get json from server");
              }
              /*//update RecyclerView
              warehouse_recycler = (RecyclerView)((AppCompatActivity) context).findViewById(R.id.recyclerView);
              mAdapter = new AdapterRecycler(context, data);
              System.out.println("mAdapter size is: " + mAdapter.getItemCount());
              System.out.println("Data size is: " + data.size());
              final LinearLayoutManager layoutManager = new LinearLayoutManager(context);
              layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
              warehouse_recycler.setLayoutManager(layoutManager);
              //mAdapter.notifyDataSetChanged();
              warehouse_recycler.setAdapter(mAdapter);
              warehouse_recycler.invalidate();
              */
          }
  
      }
  }
  </code></pre>
  
  <p>I am able to display the values obtained from php when user type in the search bar. However,how should I store the <code>id</code> of the item clicked so that I can pass it to the next activity. </p>
  
  <p>The line below stores the title:</p>
  
  <pre><code>strArrData = dataList.toArray(new String[dataList.size()]);
  </code></pre>
  
  <p>How can I store the id as well and identify the id which user has clicked ?</p>