当前位置: 代码迷 >> Eclipse >> your project contains error(s),please fix them before running your application解决方案
  详细解决方案

your project contains error(s),please fix them before running your application解决方案

热度:328   发布时间:2016-04-23 13:29:12.0
your project contains error(s),please fix them before running your application
如标题所示 eclipse中的 其中代码无显示任何错误 网上查阅良久 说什么重启或者删除项目重新导入 均试过 无效 就一个简单的spinner的练习 mars老师的 那么代码附上
package my.packge;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class SpinnerActivity extends Activity {
  /** Called when the activity is first created. */
private Spinner spinner = null;
 
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  spinner=(Spinner)findViewById(R.id.spinnerId);
  ArrayAdapter<CharSequence> hsb=ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item);
  hsb.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(hsb);
  spinner.setPrompt("测试");
  spinner.setOnItemSelectedListener(new SpinnerOnSelectedListener());
  }
  public class SpinnerOnSelectedListener implements OnItemSelectedListener{
  public void onItemSelected(AdapterView<?> adapterView, View view, int position,
  long id) {
  String selected = adapterView.getItemAtPosition(position).toString();
  System.out.println(selected);
  }

  public void onNothingSelected(AdapterView<?> adapterView) {
  System.out.println("nothingSelected");
  }}
  }

------解决方案--------------------
eclipse 里面有个窗口叫做Problem 看看里面的error是什么
  相关解决方案