Ejemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message_history_activity);

    contentList = (ListView) findViewById(R.id.msghistory_content_list);
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1);
    contentList.setAdapter(adapter);

    dbHelper = new DatabaseHelper(this);

    this.registerReceiver(
        messageReceiver, new IntentFilter("com.forchild.messages.history.display"));
  }
Ejemplo n.º 2
0
  @Override
  protected void onResume() {
    super.onResume();
    adapter.clear();

    Cursor message = dbHelper.getMessage(new String[] {"date", "name", "content"});
    message.moveToPosition(message.getCount());
    while (message.moveToPrevious()) {
      DateInfo dateInfo = new DateInfo(message.getLong(message.getColumnIndex("date")));
      adapter.add(
          dateInfo.getRTime()
              + "\n"
              + message.getString(message.getColumnIndex("name"))
              + "\n"
              + message.getString(message.getColumnIndex("content")));
    }
    message.close();
    dbHelper.close();
  }
Ejemplo n.º 3
0
 @Override
 protected void onPause() {
   super.onPause();
 }
Ejemplo n.º 4
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   this.unregisterReceiver(messageReceiver);
 }