小编hem*_*kar的帖子

为什么我收到警告:Class是原始类型.对泛型类型<T>的引用应该参数化"?

我在收到警告ListActivity.我得到的警告如下所示

  • Class is a raw type. References to generic type Class<T> should be parameterized

它没有造成任何问题,但我想知道为什么我会得到这个警告以及如何抑制它.查看用星号写的行.

public class Menu extends ListActivity {

    String classes[]={"Second","example1","example2","example3","example4"}; 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(Menu.this,android.R.layout.simple_list_item_1,classes));
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);
        String cheese=classes[position];
        try{
        **Class ourclass= Class.forName("com.app1."+cheese);**
        Intent ourintent= new Intent(Menu.this,ourclass);
        startActivity(ourintent);
        }catch(ClassNotFoundException e){
            e.printStackTrace();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

java android

7
推荐指数
3
解决办法
2万
查看次数

过剩的reshape()函数有什么用?

reshape()函数如何在此代码中工作?如何从glutReshapeFunc(reshape)reshape中的任何参数获取其参数glutReshapeFunc(reshape)?什么是价值int x,int yvoid keyboard (unsigned char key, int x, int y)功能?

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

static int year = 0, day = 0;

void init(void) 
{
   glClearColor (0.0, 0.0, 0.0, 0.0);
   glShadeModel (GL_FLAT);
}

void display(void)
{
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (1.0, 1.0, 1.0);

   glPushMatrix();
   glutWireSphere(1.0, 20, 16);   /* draw sun */
   glRotatef ((GLfloat) year, 0.0, 1.0, 0.0);
   glTranslatef (2.0, 0.0, 0.0);
   glRotatef ((GLfloat) day, 0.0, 1.0, …
Run Code Online (Sandbox Code Playgroud)

opengl

4
推荐指数
2
解决办法
1万
查看次数

为什么我无法引用我的原始文件夹的资源

我试图在原始文件夹中引用音乐但是有一些错误.它说.explosion cannot be resolved or is not a field可以任何人告诉我可能是什么原因.

package com.app1;

import android.R;
import android.app.Activity;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class SoundStuff extends Activity implements OnClickListener {
SoundPool sp;
    int explosion=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        View v= new View(this);
        v.setOnClickListener(this);
        setContentView(v);
        sp=new SoundPool(5,AudioManager.STREAM_MUSIC,0);
        **explosion=sp.load(SoundStuff.this, R.raw.explosion, 1);**
    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        if(explosion!=0)
        sp.play(explosion, 1, 1, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

android

-1
推荐指数
1
解决办法
69
查看次数

标签 统计

android ×2

java ×1

opengl ×1