package com.aluxoft.earrecognition.intents;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;

import com.aluxoft.earrecognition.activities.SelectFollowupActivity;

/**
 * Created by dkor on 11/13/15.
 */
public class IntentSearchFeatures extends Activity{

    @Override
    protected void onCreate(Bundle saveInstanceState) {
        super.onCreate(saveInstanceState);

        Cursor c = this.managedQuery(Uri.parse("content://org.commcare.dalvik.case/casedb/case"), null, null, null, null);

        StringBuffer buffer = new StringBuffer();

        while (c.moveToNext()) {
            String caseId = c.getString(c.getColumnIndex("case_id"));
            if (caseId != null) {
                buffer.append(" ");
                buffer.append(caseId);
            }
        }

        Intent returningIntent = new Intent(getIntent());
        returningIntent.putExtra(
                "ear_search_result",
                buffer.toString().trim());
        this.setResult(Activity.RESULT_OK, returningIntent);
        finish();

    }

 }
