package com.option_u.stolpersteine.activities.cards;

import java.util.ArrayList;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.option_u.stolpersteine.R;
import com.option_u.stolpersteine.StolpersteineApplication;
import com.option_u.stolpersteine.activities.description.DescriptionActivity;
import com.option_u.stolpersteine.api.model.Stolperstein;

public class CardsActivity extends Activity {

    public static Intent createIntent(Context context, ArrayList<Stolperstein> stolpersteine) {
        Activity activity = (Activity) context;
        StolpersteineApplication stolpersteineApplication = (StolpersteineApplication) activity.getApplication();
        stolpersteineApplication.setStolpersteine(stolpersteine);
        return new Intent(context, CardsActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        setContentView(R.layout.activity_info);
        ListView listView = (ListView) findViewById(R.id.list);
        StolpersteineApplication stolpersteineApplication = (StolpersteineApplication) getApplication();
        if (stolpersteineApplication.hasStolperstein()) {
            showStolpersteine(stolpersteineApplication.getStolpersteine(), actionBar, listView);
            stolpersteineApplication.clearStolpersteine();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        StolpersteineApplication stolpersteineApplication = (StolpersteineApplication) getApplication();
        stolpersteineApplication.trackView(this.getClass());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.info, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            finish();
        }
        return true;
    }

    private void showStolpersteine(ArrayList<Stolperstein> stolpersteine, ActionBar actionBar, final ListView listView) {
        Integer numStolpersteine = stolpersteine.size();
        int resourceID = (numStolpersteine > 1) ? R.string.app_stolpersteine_plural : R.string.app_stolpersteine_singular;
        String title = getResources().getString(resourceID);
        actionBar.setTitle(Integer.toString(numStolpersteine) + " " + title);

        StolpersteineAdapter stolpersteinAdapter = new StolpersteineAdapter(this, stolpersteine);
        listView.setAdapter(stolpersteinAdapter);
        listView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Stolperstein stolperstein = (Stolperstein) listView.getItemAtPosition(position);
                String bioUrl = stolperstein.getPerson().getBiographyUri().toString();
                startActivity(DescriptionActivity.createIntent(CardsActivity.this, bioUrl));
            }
        });
    }

}
@@ -139,40 +139,8 @@
 ty;%0A
-import android.content.Context;%0A
 impo
@@ -720,23 +720,25 @@
 ent(
-Context context
+Activity activity
 , Ar
@@ -780,56 +780,8 @@
 ) %7B%0A
-        Activity activity = (Activity) context;%0A
     
@@ -986,15 +986,16 @@
 ent(
-context
+activity
 , Ca

Use type Activity in createIntent() to make sure we have the right class