use of android.widget.SimpleAdapter in project android_frameworks_base by crdroidandroid.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra(EXTRA_PATH);
if (path == null) {
path = "";
} else {
// not root level, display where we are in the hierarchy
setTitle(path);
}
FragmentManager fm = getSupportFragmentManager();
if (fm.findFragmentById(android.R.id.content) == null) {
ListFragment listFragment = new TestListFragment();
listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
fm.beginTransaction().add(android.R.id.content, listFragment).commit();
}
}
use of android.widget.SimpleAdapter in project android_frameworks_base by crdroidandroid.
the class HwTests method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.android.test.hwui.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.
the class LongListActivity method onCreate.
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
populateData();
setContentView(R.layout.list_activity);
((TextView) findViewById(R.id.selection_row_value)).setText("");
((TextView) findViewById(R.id.selection_column_value)).setText("");
ListView listView = (ListView) findViewById(R.id.list);
String[] from = new String[] { STR, LEN };
int[] to = new int[] { R.id.item_content, R.id.item_size };
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ListAdapter adapter = new SimpleAdapter(this, data, R.layout.list_item, from, to) {
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.list_item, null);
}
TextView textViewOne = (TextView) convertView.findViewById(R.id.item_content);
if (textViewOne != null) {
textViewOne.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
((TextView) findViewById(R.id.selection_column_value)).setText("1");
}
});
}
TextView textViewTwo = (TextView) convertView.findViewById(R.id.item_size);
if (textViewTwo != null) {
textViewTwo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
((TextView) findViewById(R.id.selection_column_value)).setText("2");
}
});
}
return super.getView(position, convertView, parent);
}
};
View footerView = layoutInflater.inflate(R.layout.list_item, listView, false);
((TextView) footerView.findViewById(R.id.item_content)).setText("count:");
((TextView) footerView.findViewById(R.id.item_size)).setText(String.valueOf(data.size()));
listView.addFooterView(footerView, FOOTER, true);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> unusedParent, View clickedView, int position, long id) {
((TextView) findViewById(R.id.selection_column_value)).setText("");
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
}
});
}
use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new SimpleAdapter(this, getData(), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.
the class LongListActivity method onCreate.
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
populateData();
setContentView(R.layout.list_activity);
((TextView) findViewById(R.id.selection_row_value)).setText("");
((TextView) findViewById(R.id.selection_column_value)).setText("");
ListView listView = (ListView) findViewById(R.id.list);
String[] from = new String[] { STR, LEN };
int[] to = new int[] { R.id.item_content, R.id.item_size };
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ListAdapter adapter = new SimpleAdapter(this, data, R.layout.list_item, from, to) {
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.list_item, null);
}
TextView textViewOne = (TextView) convertView.findViewById(R.id.item_content);
if (textViewOne != null) {
textViewOne.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
((TextView) findViewById(R.id.selection_column_value)).setText("1");
}
});
}
TextView textViewTwo = (TextView) convertView.findViewById(R.id.item_size);
if (textViewTwo != null) {
textViewTwo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
((TextView) findViewById(R.id.selection_column_value)).setText("2");
}
});
}
return super.getView(position, convertView, parent);
}
};
View footerView = layoutInflater.inflate(R.layout.list_item, listView, false);
((TextView) footerView.findViewById(R.id.item_content)).setText("count:");
((TextView) footerView.findViewById(R.id.item_size)).setText(String.valueOf(data.size()));
listView.addFooterView(footerView, FOOTER, true);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> unusedParent, View clickedView, int position, long id) {
((TextView) findViewById(R.id.selection_column_value)).setText("");
((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
}
});
}
Aggregations