Back to project page interamap.
The source code is released under:
MIT License
If you think the Android project interamap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.richso.interamap; /*from w w w.ja v a2s .co m*/ import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.View; import android.widget.*; import com.richso.interamap.item.Category; import com.richso.interamap.adapter.ImageAdapter; import com.richso.interamap.utils.Constant; import java.util.ArrayList; /** * Created with IntelliJ IDEA. * User: nikolai * Date: 11.09.13 * Time: 13:28 * To change this template use File | Settings | File Templates. */ public class HomeScreen extends Activity { private TextView username; private String userText; private GridView gridView; private ImageAdapter gridViewAdapter; private Button browseMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Bundle extraBundle = getIntent().getExtras(); userText = extraBundle.getString(Constant.Extra.username); init(); } private void init() { username = (TextView)findViewById(R.id.usernameHome); if( userText != null && userText.length() > 0) { username.setText(userText); } browseMap = (Button)findViewById(R.id.browseMap); browseMap.setOnClickListener(browseMapListener); gridView = (GridView)findViewById(R.id.gridView); setImageAdapter(); } View.OnClickListener browseMapListener = new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(HomeScreen.this, MapScreen.class); startActivity(intent); } }; private void setImageAdapter() { gridViewAdapter = new ImageAdapter(this, R.layout.item_image_adapter, fillImageAdapter()); gridView.setAdapter(gridViewAdapter); gridView.setOnItemClickListener(gridViewItemListener); } private ArrayList<Category> fillImageAdapter() { ArrayList<Category> arrayList = new ArrayList<Category>(); Bitmap icon = BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_launcher); arrayList.add(new Category(icon, "Castles")); arrayList.add(new Category(icon, "Church")); arrayList.add(new Category(icon, "Parks")); arrayList.add(new Category(icon, "Monuments")); return arrayList; } AdapterView.OnItemClickListener gridViewItemListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ImageAdapter imageAdapter = (ImageAdapter) parent.getAdapter(); openCategoryScreen(imageAdapter.getTitle(position)); Toast.makeText(HomeScreen.this, "" + position, Toast.LENGTH_SHORT).show(); } }; private void openCategoryScreen(String categoryTitle){ Intent intent = new Intent(HomeScreen.this, CategoryScreen.class); intent.putExtra(Constant.Extra.categoryTitle, categoryTitle); startActivity(intent); } }