speed = (TextView) findViewById(R.id.speed);
이 (가) 입니다. "속도를 해결할 수 없거나 필드가 아닙니다."입니다.안드로이드의 findViewById 오류
내 레이아웃은 다음과 같습니다
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".SpeedometerActivity" >
<Button
android:id="@+id/download"
android:layout_width="150dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="13dp"
android:layout_marginLeft="300dp"
android:text="Begin Test" />
<TextView
android:id="@+id/speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/meter"
android:layout_marginLeft="191dp"
android:layout_marginTop="55dp"
android:layout_toRightOf="@+id/meter"
android:text="TextView"
android:textSize="20dp"
android:textColor="#000000"/>
</RelativeLayout>
내
MainActivity
:
public class MainActivity extends Activity {
TextView speed;
Button download;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.speedometer);
download = (Button)findViewById(R.id.download);
}
@Override
protected void onResume() {
super.onResume();
h = new Handler();
new speedTask().execute();
speed = (TextView) findViewById(R.id.speed);
}
}
사람이이 문제를 해결하기 위해 도와주세요.
속도 버튼에 유형 추가'(Button) speed = (Button) findViewById (R.id.speed);'그런데 Textview를 버튼으로 변환 할 수 없습니다. – Arshak92
속도는 텍스트보기입니다. 단추로 변경하는 방법 – appukrb
전체 MainActivity.Java 파일을 붙여 넣으십시오. –