title: How to pass the data from listview of one activity and pass it to another activity?
body: <p>In my android app I need to pass the data of listview to another activity,for example If I click the Item "Food" in listview,I want get that "Food" in the textview of another activity.</p>
  
  <p>Here is my code..</p>
  
  <p>public class list extends Activity {</p>
  
  <pre><code>String selected_id = "";
  SimpleCursorAdapter adapter;
  DBhelper helper;
  SQLiteDatabase db;
  Button btnd;
  String budget;
  
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.listlayout);
  
      helper = new DBhelper(this);
  
  
  
         Listview rldlist = (ListView) findViewById(R.id.rldlist);
         TextView ed= (TextView) findViewById(R.id.addbud);
         rldlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapter, View v, int position, long id) {
  
  
                  Cursor row = (Cursor) adapter.getItemAtPosition(position);
                  selected_id = row.getString(0);
                  budget = row.getString(1);
                  System.out.print("budget is"+budget);
                  ed.setText(budget);
  
              }
          });
  </code></pre>
  
  <p>In the above code,<code>TextView ed= (TextView) findViewById(R.id.addbud);</code> is referring the textview from another activity.</p>
  
  <p>But problem now is,The TextView remains empty.</p>
  
  <p>Below one is the code to go another activity.</p>
  
  <pre><code>rldlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) {
                  Intent myIntent = new Intent(list.this, addbudget.class);
                  list.this.startActivity(myIntent);
              }
          });
  </code></pre>