【问题标题】:How to reload an activity from a tab activity in android?如何从android中的选项卡活动重新加载活动?
【发布时间】:2012-01-19 10:38:48
【问题描述】:

我想从自定义选项卡重新加载我的活动。活动主要包括其中的一个列表视图以及如何再次加载它。任何 sn-ps 或示例代码都会有所帮助。我已经尝试了所有与重新加载相对应的事情Android 中的一项活动,我想了解有关自定义选项卡的信息。谢谢。

 listContent = (ListView)findViewById(R.id.contentlist);

  mySQLiteAdapter = new SQLAdapter(this);
  mySQLiteAdapter.openToWrite();

  cursor = mySQLiteAdapter.queueAll();

  String[] from = new String[]{SQLAdapter.YMM,SQLAdapter.SS}
  int[] to = new int[]{R.id.ymm,R.id.ss};
  cursorAdapter =
   new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
  listContent.setAdapter(cursorAdapter);
  listContent.setOnItemClickListener(listContentOnItemClickListener);
  cursorAdapter.getCursor().requery(); 
  cursorAdapter.notifyDataSetChanged();

【问题讨论】:

    标签: android list tabs reload


    【解决方案1】:

    如果您更改列表中的数据并通过调用 getListView().invalidateViews() 使列表视图无效,则活动将自动更新。

    【讨论】:

    • 感谢您的回复,我已经在上面添加了我的代码,在上面我需要使其无效的地方完成这项工作。
    • 调用 listContent.invalidateViews()
    猜你喜欢
    • 1970-01-01
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多