Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
commit 78333e7b1811d8326b4e6fa5e566883d78e6972d 2 parents 81ca223 + 9e8b74a
@yundt yundt authored
Showing with 32 additions and 14 deletions.
  1. +3 −3 res/layout/main.xml
  2. +29 −11 src/com/devcamp/SettingsActivity.java
View
6 res/layout/main.xml
@@ -4,11 +4,11 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
- <LinearLayout
- android:id="@+id/linearLayout1"
+ <ListView
+ android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
- </LinearLayout>
+ </ListView>
</LinearLayout>
View
40 src/com/devcamp/SettingsActivity.java
@@ -3,18 +3,36 @@
import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
public class SettingsActivity extends ListActivity {
-
-
- static final String[] test = new String[] { "silent", "test", "costam", "dupa"};
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, test));
- }
+
+ static final String[] test = new String[] { "silent", "test", "costam",
+ "dupa" };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, test));
+
+ ListView lv = getListView();
+ lv.setTextFilterEnabled(true);
+
+ lv.setOnItemClickListener(new OnItemClickListener() {
+ public void onItemClick(AdapterView<?> parent, View view,
+ int position, long id) {
+ Toast.makeText(getApplicationContext(),
+ ((TextView) view).getText(), Toast.LENGTH_SHORT).show();
+ }
+
+ });
+ }
}

0 comments on commit 78333e7

Please sign in to comment.
Something went wrong with that request. Please try again.