Code example for Context

Methods: getApplicationContext

0
  private final Context context;
 
  public ConversationListLoader(Context context, String filter) {
    super(context);
    this.filter  = filter;
    this.context = context.getApplicationContext();
  } 
 
  @Override 
  public Cursor loadInBackground() {
    if (filter != null && filter.trim().length() != 0) {
      List<String> numbers = ContactAccessor.getInstance()
          .getNumbersForThreadSearchFilter(filter, context.getContentResolver());
 
      return DatabaseFactory.getThreadDatabase(context).getFilteredConversationList(numbers);
    } else { 
      return DatabaseFactory.getThreadDatabase(context).getConversationList();
    } 
  } 
}