Methods Summary |
---|
public static android.os.Bundle | getBundleFor(int numItems, int numRowsPerItem, double itemScreenHeightFactor)Initialize a bundle suitable for sending as the params of the intent that
launches this activity.
Bundle bundle = new Bundle();
bundle.putInt(BUNDLE_PARAM_NUM_ITEMS, numItems);
bundle.putInt(BUNDLE_PARAM_NUM_ROWS_PER_ITEM, numRowsPerItem);
bundle.putDouble(BUNDLE_PARAM_ITEM_SCREEN_HEIGHT_FACTOR, itemScreenHeightFactor);
return bundle;
|
public double | getItemScreenSizeFactor()Each item is screen height * this factor tall.
return mItemScreenSizeFactor;
|
public java.lang.String | getLabelForPosition(int position)
return "position " + position;
|
public android.widget.ListView | getListView()
return mListView;
|
public int | getNumItems()
return mNumItems;
|
public int | getNumRowsPerItem()
return mNumRowsPerItem;
|
public int | getScreenHeight()Get the screen height.
return mScreenHeight;
|
public android.util.InternalSelectionView | getSelectedView()Get the currently selected view.
return (InternalSelectionView) getListView().getSelectedView();
|
private void | initFromBundle(android.os.Bundle icicle)
int numItems = icicle.getInt(BUNDLE_PARAM_NUM_ITEMS, -1);
if (numItems != -1) {
mNumItems = numItems;
}
int numRowsPerItem = icicle.getInt(BUNDLE_PARAM_NUM_ROWS_PER_ITEM, -1);
if (numRowsPerItem != -1) {
mNumRowsPerItem = numRowsPerItem;
}
double screenHeightFactor = icicle.getDouble(BUNDLE_PARAM_ITEM_SCREEN_HEIGHT_FACTOR, -1.0);
if (screenHeightFactor > 0) {
mItemScreenSizeFactor = screenHeightFactor;
}
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
mScreenHeight = size.y;
Bundle extras = getIntent().getExtras();
if (extras != null) {
initFromBundle(extras);
}
mListView = new ListView(this);
mListView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mListView.setDrawSelectorOnTop(false);
mListView.setAdapter(new MyAdapter());
mListView.setItemsCanFocus(true);
setContentView(mListView);
|