2016-07-16 20 views
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); 
    } 
} 

このエラーを解決するのに役立ちますか?

答えて

0

あなたは間違ってものの名前を変更されました。

//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 
    brands.setText(beerType); 
} 
+0

ありがとうございました。フセイン、ありがとうございました。あなたのポイントを得て、美しく動作します。 –

+0

ようこそ。あなたの問題を解決すれば、私の答えを投票し、それも受け入れることを忘れないでください。 :) –

関連する問題