安卓:我如何将微调器添加到我的代码中(我这样做会产生错误) 字符串键,k[]; 整数指数; @凌驾 创建时受保护的void(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity\u tarsos\u dsp); 微调器微调器=(微调器)findViewById(R.id.spinner1); ArrayAdapter=ArrayAdapter.createFromResource( 这个,R.array.key,android.R.layout.simple\u微调器\u项); 旋转器。设置适配器(适配器); for(int i=0;i arg0){ //无所事事 } }); THAT tht=新THAT(); Bundle extras=getIntent().getExtras(); 如果(附加值!=null){ key=extras.getString(“key”); Toast.makeText(getApplicationContext(),key,Toast.LENGTH_SHORT.show(); } 如果(savedInstanceState==null){ getSupportFragmentManager().beginTransaction() .add(R.id.container,新的占位符片段()).commit(); } AudioDispatcher=AudioDispatcherFactory.fromDefaultMirror(220501024,0); dispatcher.addAudioProcessor(新PitchStimationAlgorithm.FFT_-YIN,220501024,新PitchDetectionHandler(){ @凌驾 公共无效handlePitch(PitchDetectionResult PitchDetectionResult,AudioEvent AudioEvent){ 最终浮点pitchInHz=pitchDetectionResult.getPitch(); runOnUiThread(新的Runnable(){ @凌驾 公开募捐{ TextView text=(TextView)findViewById(R.id.textView1); TextView d=(TextView)findViewById(R.id.textView2); } }

安卓:我如何将微调器添加到我的代码中(我这样做会产生错误) 字符串键,k[]; 整数指数; @凌驾 创建时受保护的void(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity\u tarsos\u dsp); 微调器微调器=(微调器)findViewById(R.id.spinner1); ArrayAdapter=ArrayAdapter.createFromResource( 这个,R.array.key,android.R.layout.simple\u微调器\u项); 旋转器。设置适配器(适配器); for(int i=0;i arg0){ //无所事事 } }); THAT tht=新THAT(); Bundle extras=getIntent().getExtras(); 如果(附加值!=null){ key=extras.getString(“key”); Toast.makeText(getApplicationContext(),key,Toast.LENGTH_SHORT.show(); } 如果(savedInstanceState==null){ getSupportFragmentManager().beginTransaction() .add(R.id.container,新的占位符片段()).commit(); } AudioDispatcher=AudioDispatcherFactory.fromDefaultMirror(220501024,0); dispatcher.addAudioProcessor(新PitchStimationAlgorithm.FFT_-YIN,220501024,新PitchDetectionHandler(){ @凌驾 公共无效handlePitch(PitchDetectionResult PitchDetectionResult,AudioEvent AudioEvent){ 最终浮点pitchInHz=pitchDetectionResult.getPitch(); runOnUiThread(新的Runnable(){ @凌驾 公开募捐{ TextView text=(TextView)findViewById(R.id.textView1); TextView d=(TextView)findViewById(R.id.textView2); } },android,android-layout,spinner,onitemselectedlistener,Android,Android Layout,Spinner,Onitemselectedlistener,如果我添加它void run它仍然给出错误,我如何使用intent添加带有来自上一个活动的默认值的微调器添加确切错误的文本和堆栈跟踪please@Larry不幸的是,错误是,Gurukool(应用程序)已停止全部堆栈跟踪。我没有在日志中写入日志code@Larry我使用的是一个uithread,所以如果我在线程内部添加微调器代码,它会给出错误,如果我在线程外部添加微调器代码,应用程序也会给出错误 String key,k[]; int index; @Override protected vo

如果我添加它void run它仍然给出错误,我如何使用intent添加带有来自上一个活动的默认值的微调器添加确切错误的文本和堆栈跟踪please@Larry不幸的是,错误是,Gurukool(应用程序)已停止全部堆栈跟踪。我没有在日志中写入日志code@Larry我使用的是一个uithread,所以如果我在线程内部添加微调器代码,它会给出错误,如果我在线程外部添加微调器代码,应用程序也会给出错误
String key,k[];
int index;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tarsos_dsp);
    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
     ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, R.array.key, android.R.layout.simple_spinner_item);
     spinner.setAdapter(adapter);
     for(int i =0;i<=11;i++)
     {
           k = getResources().getStringArray(R.array.key);
           if(key.equals(k[i].toString()))
           {
               spinner.setSelection(i);
           }
     }

      spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
            index = arg0.getSelectedItemPosition();

                   // storing string resources into Array
                   k = getResources().getStringArray(R.array.key);

                    Toast.makeText(getBaseContext(), "You have selected key : " +k[index], 
                            Toast.LENGTH_SHORT).show();

            }

            public void onNothingSelected(AdapterView<?> arg0) {
                // do nothing

            }


        });
Thaat tht =  new Thaat();
    Bundle extras = getIntent().getExtras();
      if(extras !=null) {
          key= extras.getString("key");
          Toast.makeText(getApplicationContext(), key, Toast.LENGTH_SHORT).show();

      }

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }

    AudioDispatcher dispatcher = AudioDispatcherFactory.fromDefaultMicrophone(22050,1024,0);            
    dispatcher.addAudioProcessor(new PitchProcessor(PitchEstimationAlgorithm.FFT_YIN, 22050, 1024, new PitchDetectionHandler() {            
         @Override
            public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
                        final float pitchInHz = pitchDetectionResult.getPitch();
                        runOnUiThread(new Runnable() {                      

                            @Override
                             public void run() {
                                 TextView text = (TextView) findViewById(R.id.textView1);
                                 TextView d =(TextView) findViewById(R.id.textView2);

                             }
                       }