Skip to content
This repository was archived by the owner on Dec 17, 2020. It is now read-only.
This repository was archived by the owner on Dec 17, 2020. It is now read-only.

AppIndexingService not fully implemented #3

@JhonErl

Description

@JhonErl

Hey, I noticed that the getAllRecipes() function in AppIndexingService is not fully implemented,
so i suggest the following, i know that it is not the best solution but is works.

public class AppIndexingService extends IntentService {
  .  .  .
   private List<Recipe> getAllRecipes() {
        ArrayList recipesList = new ArrayList();
        String[] projection = {RecipeTable.ID, RecipeTable.TITLE,
                RecipeTable.DESCRIPTION, RecipeTable.PHOTO,
                RecipeTable.PREP_TIME};
        Uri sUri = RecipeContentProvider.CONTENT_URI.buildUpon().build();
        Cursor cursor = getContentResolver().query(sUri, projection,
                null, null, null);
        cursor.moveToFirst();
        while (cursor != null && !cursor.isAfterLast()){
            recipesList.add( Recipe.fromCursor(cursor));
            cursor.moveToNext();
            `}`
        }
        return recipesList;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions