안녕하세요, 활동에서 조각으로 이동하려합니다. 활동을 조각으로 변환
여기 내 활동import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TableLayout;
import android.widget.TextView;
public class SummaryActivity extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SimpleBookManager testBook = new SimpleBookManager();
setContentView(R.layout.summary);
TableLayout tableSummary = (TableLayout) this.findViewById(R.id.tableSummary);
tableSummary.setBackgroundResource(R.drawable.book2);
TextView nrOfBooksfield = (TextView) this.findViewById(R.id.nrOfBooksInCollection);
String text = Integer.toString(testBook.count());
nrOfBooksfield.setText(text);
}
}
에있는 코드입니다 그리고 그녀 내 조각
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class BFragmentTab extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return inflater.inflate(R.layout.summary, container, false);
}
SimpleBookManager testBook = new SimpleBookManager();
TableLayout tableSummary = (TableLayout) getView().findViewById(R.id.tableSummary);
tableSummary.setBackgroundResource(R.drawable.book2);
TextView nrOfBooksfield = (TextView) getView().findViewById(R.id.nrOfBooksInCollection);
String text = Integer.toString(testBook.count());
nrOfBooksfield.setText(text);
}
지금 그것은 "setBackgroundResource"과 "에 구문 오류가 있음을 말하는 tableSummary.setBackgroundResource(R.drawable.book2);
에 뿌려줍니다. " 식별자가 필요합니다.
그리고 거기에이 토큰 후 예상 텍스트 "VariableDeclarationId"토큰에와 구문 에러 "다른 nrOfBooksfield.setText(text);
"잘못된 구조의의 "에. 오류.
오류, 그것은 활동에서 잘 작동 뭐죠이며, 지금은에 불만 조각은 (그래 안드로이드 초보자 임).
사전에 감사합니다.