本文整理匯總了Java中android.app.ListActivity類的典型用法代碼示例。如果您正苦於以下問題:Java ListActivity類的具體用法?Java ListActivity怎麽用?Java ListActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ListActivity類屬於android.app包,在下文中一共展示了ListActivity類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showList
import android.app.ListActivity; //導入依賴的package包/類
/**
* Displays a 'List' of 'Demo Beans'
*/
private void showList(ListActivity listApp)
{
//Reads the synchronized/locally stored demo beans from the 'offlineapp_demochannel' channel on the device
MobileBean[] demoBeans = MobileBean.readAll("offlineapp_demochannel");
//Shows these beans in a List
if(demoBeans != null && demoBeans.length >0)
{
String[] ui = new String[demoBeans.length];
for(int i=0,size=ui.length;i<size;i++)
{
ui[i] = demoBeans[i].getValue("demoString");
}
listApp.setListAdapter(new ArrayAdapter(listApp,
android.R.layout.simple_list_item_1,
ui));
//List Listener
ListItemClickListener clickListener = new ClickListener(demoBeans);
NavigationContext.getInstance().addClickListener(clickListener);
}
}
示例2: AssignmentAdapter
import android.app.ListActivity; //導入依賴的package包/類
/**
* <p>Constructor: Instantiate a new adapter.</p>
* @param parent ListActivity - associated list view
* @param cur Cursor - associate managed database query
*/
public AssignmentAdapter (ListActivity parent, Cursor cur) {
super (
parent, R.layout.list_item, cur,
// columns for item display
new String[] {
Repository.NumberCode.NUMBER,
Repository.NumberCode.NAME,
Repository.NumberCode.CODE
},
// associated view elements (identifiers)
new int[] {
R.id.txt_number,
R.id.txt_name,
R.id.txt_code
}
);
}
示例3: checkActivity
import android.app.ListActivity; //導入依賴的package包/類
void checkActivity() {
Context context = adapterView.getContext();
if (context instanceof ListActivity) {
throw new RuntimeException("ListView cannot belong to an activity which subclasses ListActivity");
}
if (context instanceof SherlockActivity || context instanceof SherlockFragmentActivity
|| context instanceof SherlockPreferenceActivity) {
return;
}
throw new RuntimeException("ListView must belong to an activity which subclasses SherlockActivity");
}
示例4: postRender
import android.app.ListActivity; //導入依賴的package包/類
@Override
/**
* Invoked by the MVC runtime once the screen is rendered. This callback allows the screen setup the business state of the screen
* and update the UI to show this information
*/
public void postRender()
{
//Gets the currently active 'Activity' instance
ListActivity listApp = (ListActivity)Services.getInstance().getCurrentActivity();
//Gets the 'Cloud' configuration
AppResources res = Services.getInstance().getResources();
Configuration configuration = Configuration.getInstance(listApp);
//Check to see if the 'Demo Beans' are synchronized from the 'Cloud'. If not, a 'Boot Sync' is issued.
if(configuration.isActive() && !MobileBean.isBooted("offlineapp_demochannel"))
{
//Boots up the 'Demo Bean' sync channel
CommandContext commandContext = new CommandContext();
commandContext.setTarget("/channel/bootup/helper");
Services.getInstance().getCommandService().execute(commandContext);
return;
}
//Show the List of "Demo Beans" synchronized from the 'Cloud'.
this.showList(listApp);
//Setup the App Menu
this.setMenuItems();
}
示例5: type
import android.app.ListActivity; //導入依賴的package包/類
public static SubjectFactory<ListActivitySubject, ListActivity> type() {
return new SubjectFactory<ListActivitySubject, ListActivity>() {
@Override
public ListActivitySubject getSubject(FailureStrategy fs, ListActivity that) {
return new ListActivitySubject(fs, that);
}
};
}
示例6: onItemClick
import android.app.ListActivity; //導入依賴的package包/類
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DataItem item = (DataItem) mListView.getItemAtPosition(position);
// if navigation is supported, open the next activity
if (item.getNavigationInfo() != DataSource.NO_NAVIGATION) {
Intent intent = new Intent(this, ListActivity.class);
intent.putExtra(TYPE, item.getNavigationInfo());
startActivity(intent);
}
}
示例7: LocationCursorAdapter
import android.app.ListActivity; //導入依賴的package包/類
/**
*
* @param activity
* {@link ListActivity} that uses this CursorAdapter
* @param uri
* {@link Uri} of the {@link Location}s to be displayed
*/
public LocationCursorAdapter(ListActivity activity, Uri uri) {
super(activity, R.layout.list_row, activity.managedQuery(uri, null,
null, null, null),
new String[]{RedpinContract.Location.SYMBOLIC_ID},
new int[]{R.id.list_row_label});
this.activity = activity;
this.uri = uri;
setStringConversionColumn(getCursor().getColumnIndex(
RedpinContract.Location.SYMBOLIC_ID));
}
示例8: MapCursorAdapter
import android.app.ListActivity; //導入依賴的package包/類
/**
*
* @param activity
* {@link ListActivity} that uses this CursorAdapter
* @param uri
* {@link Uri} of the {@link Map}s to be displayed
*/
public MapCursorAdapter(ListActivity activity, Uri uri) {
super(activity, R.layout.list_row, activity.managedQuery(uri, null,
null, null, null), new String[]{RedpinContract.Map.NAME},
new int[]{R.id.list_row_label});
this.activity = activity;
this.uri = uri;
setStringConversionColumn(getCursor().getColumnIndex(
RedpinContract.Map.NAME));
}
示例9: onListItemClick
import android.app.ListActivity; //導入依賴的package包/類
public static void onListItemClick(
ListActivity activity, ListView l, View v,
int position, long id) {
try {
Method m = ListActivity.class.getDeclaredMethod("onListItemClick", new Class[]{ListView.class, View.class, int.class, long.class});
m.setAccessible(true);
m.invoke(activity, new Object[]{new Object[]{l, v, position, id}});
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("error in onListItemClick", e);
}
}
示例10: GradeListAdapter
import android.app.ListActivity; //導入依賴的package包/類
public GradeListAdapter(ListActivity context, List<Note> list) {
super(context, list, R.layout.grade_list_item);
mGradeColors = new int[] {
getResources().getColor(R.color.grade_1),
getResources().getColor(R.color.grade_2),
getResources().getColor(R.color.grade_3),
getResources().getColor(R.color.grade_4),
getResources().getColor(R.color.grade_5)
};
}
示例11: ensureActivity
import android.app.ListActivity; //導入依賴的package包/類
private void ensureActivity() {
final Context context = adapterView.getContext();
if (context instanceof ListActivity) {
throw new RuntimeException("ListView cannot belong to an activity which subclasses ListActivity");
}
if (context instanceof ActionBarActivity) {
return;
}
throw new RuntimeException("ListView must belong to an activity which subclasses SherlockActivity");
}
示例12: test_basic
import android.app.ListActivity; //導入依賴的package包/類
public void test_basic() {
Router router = new Router();
router.map("users/:user_id", ListActivity.class);
Intent intent = router.intentFor("users/4");
Assert.assertEquals("4", intent.getExtras().getString("user_id"));
}
示例13: test_empty
import android.app.ListActivity; //導入依賴的package包/類
public void test_empty() {
Router router = new Router();
router.map("users", ListActivity.class);
Intent intent = router.intentFor("users");
Assert.assertNull(intent.getExtras());
}
示例14: test_url_starting_with_slash
import android.app.ListActivity; //導入依賴的package包/類
public void test_url_starting_with_slash() {
Router router = new Router();
router.map("/users", ListActivity.class);
Intent intent = router.intentFor("/users");
Assert.assertNull(intent.getExtras());
}
示例15: test_url_querystring
import android.app.ListActivity; //導入依賴的package包/類
public void test_url_querystring() {
Router router = new Router();
router.map("/users/:id", ListActivity.class);
Intent intent = router.intentFor("/users/123?key1=val2");
Bundle extras = intent.getExtras();
Assert.assertEquals("123", extras.getString("id"));
Assert.assertEquals("val2", extras.getString("key1"));
}