Android Open Source - musetoolkit Test Activity






From Project

Back to project page musetoolkit.

License

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.

Java Source Code

package com.github.musetoolkit;
/*  w  w w  .ja  v  a  2s .co  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 TestActivity extends Activity {  

    private GridView mGridView;   //MyGridView
    //??????
   private int[] imageRes = { R.drawable.png07, R.drawable.png08, R.drawable.png09, R.drawable.png10 };
   //??????
   private String[] itemName = { "?????", "????", "??????", "????" };  
  
  
    public void onCreate(Bundle savedInstanceState) {  
  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.testtab);  
   
  
//        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(TestActivity.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.Spl" );
          startActivity(intent);                          
           break;
     case 1:
         Toast.makeText(getApplicationContext(), "????",
                 Toast.LENGTH_SHORT).show();  
       intent.setClassName( "com.github.musetoolkit",
                     "com.github.musetoolkit.Test" );
          startActivity(intent);                          
           break;
     case 2:
         Toast.makeText(getApplicationContext(), "??????",
                 Toast.LENGTH_SHORT).show();  
       intent.setClassName( "com.github.musetoolkit",
                     "com.github.musetoolkit.Piano" );
          startActivity(intent);                          
           break; 
     case 3:
         Toast.makeText(getApplicationContext(), "????",
                 Toast.LENGTH_SHORT).show();  
       intent.setClassName( "com.github.musetoolkit",
                     "com.github.musetoolkit.Touch" );
          startActivity(intent);                          
           break;

     }             
    
}
}        
        
        
  
}




Java Source Code List

com.github.musetoolkit.About.java
com.github.musetoolkit.CalcActivity.java
com.github.musetoolkit.CopyOfMainActivity.java
com.github.musetoolkit.MainActivity.java
com.github.musetoolkit.Metro.java
com.github.musetoolkit.MoreActivity.java
com.github.musetoolkit.Piano.java
com.github.musetoolkit.Pnoise.java
com.github.musetoolkit.Sawtooth.java
com.github.musetoolkit.SignalActivity.java
com.github.musetoolkit.Sine.java
com.github.musetoolkit.Spl.java
com.github.musetoolkit.Splash.java
com.github.musetoolkit.Sweep.java
com.github.musetoolkit.TestActivity.java
com.github.musetoolkit.Test.java
com.github.musetoolkit.TheoryActivity.java
com.github.musetoolkit.Touch.java
com.github.musetoolkit.Triangle.java
com.github.musetoolkit.Wnoise.java