Android Open Source - AltSMS List Threads Activity






From Project

Back to project page AltSMS.

License

The source code is released under:

MIT License

If you think the Android project AltSMS listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ahmetkizilay.alt.sms;
//from w  w  w  .  j  a v a  2s.c o m
import com.ahmetkizilay.alt.sms.R;
import com.ahmetkizilay.alt.sms.SMSThreadCursorAdapter.ViewHolder;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ScrollView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class ListThreadsActivity extends Activity {
  private final String MY_TAG = "AltSMS.ListThreadsActivity";

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.altsms_list_threads_activity);
        
    SMSMediator smsMediator = new SMSMediator(this);
    Cursor smsCursor = smsMediator.getAllSmsThreads();
    
    final ListView listView = (ListView) findViewById(R.id.listview);
    listView.setAdapter(new SMSThreadCursorAdapter(this, smsCursor));
    listView.setOnItemClickListener(new OnItemClickListener() {

      @Override
      public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
        ViewHolder viewHolder = (ViewHolder) view.getTag();
        
        Intent intent = new Intent(ListThreadsActivity.this, ListMessagesActivity.class);
        intent.putExtra("thread_id", viewHolder.threadId);
        
        startActivity(intent);
        
      }
    });
  }
}




Java Source Code List

com.ahmetkizilay.alt.sms.ContactsUtils.java
com.ahmetkizilay.alt.sms.ListMessagesActivity.java
com.ahmetkizilay.alt.sms.ListThreadsActivity.java
com.ahmetkizilay.alt.sms.SMSMediator.java
com.ahmetkizilay.alt.sms.SMSMessagesCursorAdapter.java
com.ahmetkizilay.alt.sms.SMSThreadCursorAdapter.java