ユーザーの評価をテキストビューに表示しようとしましたが、「プロセスが予期せず終了しました」というエラーだけが表示されます。3つの活動があります。評価バーを含むアクティビティの XML コーディングは次のとおりです。
<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:gravity="center"
tools:context=".RatingActivity" >
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:hint="@string/hello_world"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
Javaコーディングは次のとおりです。
package com.example.myfirstapp;
import android.app.Activity;
import android.os.Bundle;
import android.widget.RatingBar;
import android.widget.TextView;
public class RatingActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating);
RatingBar ratingBar1=(RatingBar)findViewById(R.id.ratingBar1);
TextView textView3 =(TextView) findViewById(R.id.textView3);
textView3.setTextSize(40);
textView3.setText("Rating is :"+ratingBar1.getRating());
}
}
私は何を間違っていますか?Androidアプリ開発初心者です。助けてください、事前に感謝します。