0
アンドロイドテストアプリの開発中にコードを実行するとエラーが発生します。 FindBeerActivityでAndroidコンパイルエラー:シンボルクラスを見つけることができませんTextview
Error:(20, 9) error: cannot find symbol class Textview
Error:(20, 38) error: cannot find symbol method findViewByID(int)
Error:(22, 35) error: cannot find symbol method FindviewbyId(int)
Error:(24, 9) error: cannot find symbol class string
Error:(26, 9) error: cannot find symbol variable brnads
ソースコードは以下の通りです。
package com.hfad.beeradviser;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Spinner;
import android.widget.TextView;
public class FindBeerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_beer);
}
//Call when the button gets clicked
public void onClickFindBeer(View view) {
//get a reference to the Textview
Textview brands = (TextView) findViewByID(R.id.brands) ;
//get a reference to the Spinner
Spinner color = (Spinner) FindviewbyId(R.id.color);
//Get the selected item in the Spinner
string beerType = String.valueOf(color.getSelectedItem());
//Display the selected item
brnads.setText(beerType);
}
}
このエラーを解決するのに役立ちますか?
ありがとうございました。フセイン、ありがとうございました。あなたのポイントを得て、美しく動作します。 –
ようこそ。あなたの問題を解決すれば、私の答えを投票し、それも受け入れることを忘れないでください。 :) –