Android Open Source - Android-Search-ListView-using-Filter Single Item View






From Project

Back to project page Android-Search-ListView-using-Filter.

License

The source code is released under:

Apache License

If you think the Android project Android-Search-ListView-using-Filter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.androidbegin.filterlistviewtutorial;
/* w ww. ja v a2 s .  c  om*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class SingleItemView extends Activity {
  // Declare Variables
  TextView txtrank;
  TextView txtcountry;
  TextView txtpopulation;
  String rank;
  String country;
  String population;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.singleitemview);
    // Retrieve data from MainActivity on item click event
    Intent i = getIntent();
    // Get the results of rank
    rank = i.getStringExtra("rank");
    // Get the results of country
    country = i.getStringExtra("country");
    // Get the results of population
    population = i.getStringExtra("population");

    // Locate the TextViews in singleitemview.xml
    txtrank = (TextView) findViewById(R.id.rank);
    txtcountry = (TextView) findViewById(R.id.country);
    txtpopulation = (TextView) findViewById(R.id.population);

    // Load the results into the TextViews
    txtrank.setText(rank);
    txtcountry.setText(country);
    txtpopulation.setText(population);
  }
}




Java Source Code List

com.androidbegin.filterlistviewtutorial.ListViewAdapter.java
com.androidbegin.filterlistviewtutorial.MainActivity.java
com.androidbegin.filterlistviewtutorial.SingleItemView.java
com.androidbegin.filterlistviewtutorial.WorldPopulation.java