package com.agiliq.android.moreappslib;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;

public class MoreAppsActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mal_activity_more_apps);

        String drawableNamePrefix = "mal_agiliq_app_icon";
        String stringResourcePrefix = "mal_agiliq_apps_title_a";
        int i;
        for(i=0; ; i++){
            int drawableResourceId = getResources().
                    getIdentifier(drawableNamePrefix + i, "drawable", getPackageName());
            int stringResourceId = getResources().
                    getIdentifier(stringResourcePrefix + i, "string", getPackageName());
            if(drawableResourceId == 0 || stringResourceId == 0){
                System.out.println(i);
                break;
            }
        }

        GridItemData[] gridItems = new GridItemData[i];
        for (i = 0; i < gridItems.length; i++) {
            int drawableResourceId = getResources().
                    getIdentifier(drawableNamePrefix + i, "drawable", getPackageName());
            int stringResourceId = getResources().
                    getIdentifier(stringResourcePrefix + i, "string", getPackageName());

            gridItems[i] = new GridItemData(drawableResourceId,
                    getResources().getString(stringResourceId));
        }

        GridItemAdapter adapter = new GridItemAdapter(this, R.layout.mal_grid_item, gridItems);

        GridView gridView = (GridView) findViewById(R.id.mal_gridView);
        gridView.setAdapter(adapter);
    }
}
@@ -82,17 +82,133 @@
 oid.
-os.Bundle
+content.Intent;%0Aimport android.net.Uri;%0Aimport android.os.Bundle;%0Aimport android.view.View;%0Aimport android.widget.AdapterView
 ;%0Aim
@@ -1776,16 +1776,626 @@
 dapter);
+%0A%0A        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() %7B%0A            @Override%0A            public void onItemClick(AdapterView%3C?%3E parent, View view, int position, long l) %7B%0A                String packageName = getString(getResources().%0A                        getIdentifier(%22mal_agiliq_apps_package_a%22 + position,%0A                                %22string%22, getPackageName()));%0A                Intent intent = new Intent(Intent.ACTION_VIEW);%0A                intent.setData(Uri.parse(%22market://details?id=%22 + packageName));%0A                startActivity(intent);%0A            %7D%0A        %7D);
 %0A    %7D%0A%7D

Add code to intent to the Play Store app whenever an app is clicked from the list.