나는 인터넷에서 샘플과 코드로 내 안드로이드 애플 리케이션을 해결하려고 노력 해왔다. 같은 대한첫 번째 타이머 android development
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="10dip">
<Button
android:id="@+id/brew_time_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="40dip" />
<TextView
android:id="@+id/brew_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:textSize="40dip"
android:padding="10dip" />
<Button
android:id="@+id/brew_time_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+"
android:textSize="40dip" />
</LinearLayout>
자바 코드 - 그들을 따라 나는 코드
**Button brewAddTime = (Button) findViewById(R.id.brew_time_up);**
이 부분에 대한 XML의 줄을 다음과 같은 오류
**"Brew_Time_Add cannot be resolved or is not a field."**
있어 -
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button brewAddTime = (Button) findViewById(R.id.brew_time_up);
Button brewDecreaseTime = (Button) findViewById(R.id.brew_time_down);
Button startBrew = (Button) findViewById(R.id.brew_start);
TextView brewCountLabel = (TextView) findViewById(R.id.brew_count_label);
TextView brewTimeLabel = (TextView) findViewById(R.id.brew_time);
}
왜 오류가 있으며 어떻게 해결 될 수 있습니까?
감사 AT- 이미지를 참조하시기 바랍니다.
layout.xml 파일에 'brew_time_up'을 추가 했습니까? 또한 이미지에 표시하는 대신 질문에 코드를 추가하십시오. –
@codingcrow 지금 확인하고 도움하십시오. 이것 없이는 앞으로 나아갈 수 없다. –
Logcat에있는 오류를 붙여넣고 @bodge 대답을 보았습니까? –