Back to project page musetoolkit.
The source code is released under:
GNU General Public License
If you think the Android project musetoolkit 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.github.musetoolkit; /*ww w. j a va2 s. c o m*/ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; public class MoreActivity extends Activity { private GridView mGridView; //MyGridView //?????? private int[] imageRes = { R.drawable.png11, R.drawable.png12 }; //?????? private String[] itemName = { "??", "??" }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.moretab); // TextView textview = new TextView(this); // textview.setText("This is the Artists tab"); // setContentView(textview); mGridView = (GridView) findViewById(R.id.MyGridView); List<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); int length = itemName.length; for (int i = 0; i < length; i++) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("ItemImageView", imageRes[i]); map.put("ItemTextView", itemName[i]); data.add(map); } //?itme.xml?????? SimpleAdapter simpleAdapter = new SimpleAdapter(MoreActivity.this, data, R.layout.item, new String[] { "ItemImageView","ItemTextView" }, new int[] { R.id.ItemImageView,R.id.ItemTextView }); mGridView.setAdapter(simpleAdapter); //?mGridView??????????? mGridView.setOnItemClickListener(new GridViewItemOnClick()); } //??????????? public class GridViewItemOnClick implements OnItemClickListener { @Override public void onItemClick(AdapterView<?> arg0, View view, int position,long arg3) { // Toast.makeText(getApplicationContext(), position + "", // Toast.LENGTH_SHORT).show(); /* ?????????GridView????????? * ????Intent????????? * ?????????????? */ Intent intent = new Intent(); switch(position){ case 0: Toast.makeText(getApplicationContext(), "??", Toast.LENGTH_SHORT).show(); intent.setClassName( "com.github.musetoolkit", "com.github.musetoolkit.About" ); startActivity(intent); break; case 1: finish(); break; } } } }