Search Results

Search found 1 results on 1 pages for 'sirlunchalot'.

Page 1/1 | 1 

  • How to putExtra() in Searchable Dictionary Example

    - by sirlunchalot
    Hi, based on the Searchable Dictionary sample I tried to put extra data to a different activity. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner distance = (Spinner) findViewById(R.id.distanceSpinner); ArrayAdapter<CharSequence> adapterDistance = ArrayAdapter.createFromResource( this, R.array.distance, android.R.layout.simple_spinner_item); adapterDistance.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); distance.setAdapter(adapterDistance); Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { // handles a click on a search suggestion; launches activity to show word mapIntent = new Intent(this, Map.class); mapIntent.setData(intent.getData()); mapIntent.putExtra("Distance", distance.getSelectedItemPosition()); startActivity(mapIntent); finish(); } } In my Map Class Distance is always zero because distance.getSelectedItemPostion() gets the initialized value. How can I putExtra data with a click on a search suggestion? Thanks

    Read the article

1