onActivityResult Is not responding when choosing from a list
<p>Hi Guys I am new with android programming and Java. I am trying to make a travel app. My issue is that how do I pass data from the selected item from the list to the editText filed. This is out I have done so far.. Pls. be kind I am newbee<br>
The activity class that uses the ListActivity</p>

<pre><code>import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class SelectStationActivity extends ListActivity {

    String stations[] = { "Acton Main Line","Ealing","Great Western","Albany Park"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ArrayAdapter &lt;String&gt; adapter =new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1, stations);
        setListAdapter(adapter);
    }

    protected void OnListItemClick(ListView l, View v, int position, long id) {
        String values = stations[(int) id];
        Intent result = new Intent().putExtra("SELECTED_STATION_NAME", values);
        setResult(RESULT_OK, result);
        finish();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        getMenuInflater().inflate(R.menu.select_station, menu);
        return true;
    }
</code></pre>

<p>The main class </p>

<pre><code>import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class TravelActivity extends Activity {

    // The request code for the selectChkInBt
    protected static final int SelectChkin_REQUEST_CODE = 1; 
    // The request code for the selectChkOutBt
    protected static final int SelectChkout_REQUEST_CODE = 2;

    private String checkinStation;
    private String checkoutStation;

    private Button checkinButton, checkoutButton, selectChkInButton, selectChkOutButton;
    private EditText checkinEditText, checkoutEditText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_travel);

        checkinButton = (Button) findViewById(R.id.btCkIn);
        checkoutButton = (Button) findViewById(R.id.BtChkOut);

        selectChkInButton = (Button) findViewById(R.id.btselectChkIn);
        selectChkOutButton = (Button) findViewById(R.id.btselectChkOut);

        checkinEditText = (EditText) findViewById(R.id.EditTxtChkIn);
        checkoutEditText = (EditText) findViewById(R.id.EditTxtChkOut);


        checkinButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkinEditText.getText().toString().equals("")) {
                    Toast.makeText(TravelActivity.this,
                            "Enter Check-in Station", Toast.LENGTH_LONG).show();
                } else {
                    checkinStation = checkinEditText.getText().toString();

                    // Enable the check-out EditText and Button
                    checkinEditText.setEnabled(false);
                    checkinEditText.setTextColor(Color.CYAN);
                    checkinButton.setEnabled(false);

                    // Disable the check-in- EdiText AND Button
                    checkoutEditText.setEnabled(true);
                    checkoutButton.setEnabled(true);
                    checkoutEditText.requestFocus();
                }
            }
        });

        checkoutButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkoutEditText.getText().toString().equals("")) {
                    Toast.makeText(TravelActivity.this,
                            "Enter Check-Out station", Toast.LENGTH_LONG)
                            .show();
                } else {
                    checkoutStation = checkoutEditText.getText().toString();

                    // Clear edit Text
                    checkoutEditText.setText("");
                    // Enable the check-in EditText and Button
                    checkoutEditText.setEnabled(false);
                    checkoutButton.setEnabled(false);
</code></pre>

<p>/*
   * Disable the check-out EditText and Button, to allow the
   * eternal cycle of checking in and out to commence once again */</p>

<pre><code>                    checkinEditText.setText("");
                    checkinEditText.setEnabled(true);
                    checkinButton.setEnabled(true);
                    checkinEditText.requestFocus();

                    Toast.makeText(getApplicationContext(),
                            "Travel information added!", Toast.LENGTH_SHORT)
                            .show();
                }
            }
        });         
</code></pre>

<p>I could implement a inner class for the two select buttons but i have diffculties to do it.Pls. provide some help how I could implement it thanks.</p>

<pre><code>selectChkInButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(TravelActivity.this,
                            SelectStationActivity.class);
                    startActivityForResult(intent, SelectChkin_REQUEST_CODE);
                }
            });

            selectChkOutButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(TravelActivity.this,SelectStationActivity.class);
            startActivityForResult(intent, SelectChkout_REQUEST_CODE);

                }
            });


        }
</code></pre>

<p>The onActivityResult is not responding here</p>

<pre><code>        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
                    super.onActivityResult(requestCode, resultCode, data);
                    if (resultCode== RESULT_OK){
                        if (requestCode == 1) {
                    checkinEditText.setText(data.getStringExtra("SELECTED_STATION_NAME"));
                }

            }

        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {

            MenuItem item = menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, "Recipt");
            item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

            return true;
        }

        public boolean OnMenuItemSelected(int featureId, MenuItem item) {

            String Recipt = "Recipt" + item.getItemId() + "\nCheck-in: "
                    + checkinStation + "\nCheck-Out: " + checkoutStation;
            Toast.makeText(getApplicationContext(), Recipt, Toast.LENGTH_LONG)
                    .show();
            return true;

        }

        protected void OnSaveInstanceState(Bundle outState) {
            outState.putString("lAST_CHECKIN", checkinStation);
            outState.putString("lAST_CHECKOUT", checkoutStation);
        }

        protected void onRestoreInstance(Bundle savedInstanceState) {
            checkinStation = savedInstanceState.getString(checkinStation);
            checkoutStation = savedInstanceState.getString(checkoutStation);

        }

    }
</code></pre>
