@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook); // 필요한 위젯들 전부 로딩 faceBook_myTitleTxtVw = (TextView) findViewById(R.id.faceBook_movieTitle); faceBook_myWhenTxtVw = (TextView) findViewById(R.id.faceBook_myWhenTxtVw); faceBook_myWhereTxtVw = (TextView) findViewById(R.id.faceBook_myWhereTxtVw); faceBook_myWithTxtVw = (TextView) findViewById(R.id.faceBook_myWhoTxtVw); faceBook_myGenreTxtVw = (TextView) findViewById(R.id.faceBook_myGenreTxtVw); faceBook_myOpenInfoTxtVw = (TextView) findViewById(R.id.faceBook_myOpenInfoTxtVw); faceBook_myActorTxtVw = (TextView) findViewById(R.id.faceBook_myActorTxtVw); faceBook_myDirectorTxtVw = (TextView) findViewById(R.id.faceBook_myDirectorTxtVw); faceBook_myThumbnail = (ImageView) findViewById(R.id.faceBook_myThumbnail); faceBook_myRatingBar = (RatingBar) findViewById(R.id.faceBook_myRatingBar); // 전달받은 인텐트를 가져온다. Intent intent = getIntent(); // 인텐트가 존재하면 if (intent != null) { // movie객체를 가져와서 데이터를 뿌려준다. Movie movie = (Movie) intent.getSerializableExtra("movie"); this.movie = movie; faceBook_myTitleTxtVw.setText(movie.getTitle()); String getWhen = movie.getWhen(); String year = getWhen.substring(0, 4); String month = getWhen.substring(4, 5); String day = getWhen.substring(5, 7); faceBook_myWhenTxtVw.setText(year + "년 " + month + "월 " + day + "일"); faceBook_myWithTxtVw.setText(movie.getWith()); faceBook_myWhereTxtVw.setText(movie.getWhere()); rating = (float) ((movie.getGrade().equals("")) ? 0.0 : Float.parseFloat(movie.getGrade())) / (float) 2.0; faceBook_myRatingBar.setRating(rating); faceBook_myGenreTxtVw.setText(" ● 장르 : " + movie.getGenre()); faceBook_myActorTxtVw.setText(" ● 감독 : " + movie.getDirector()); faceBook_myActorTxtVw.setText(" ● 배우 : " + Arrays.toString(movie.getActor())); faceBook_myOpenInfoTxtVw.setText(" ● 개봉일 : " + movie.getOpenInfo()); imageDownloader.download(movie.getThumbnail(), faceBook_myThumbnail); } mEtContent = (EditText) findViewById(R.id.faceBook_etContent); mBtnFeed = (Button) findViewById(R.id.faceBook_btnFeed); mBtnFeed.setOnClickListener(this); faceBook_btnLogout = (Button) findViewById(R.id.faceBook_btnLogout); faceBook_btnLogout.setOnClickListener(this); mFacebookAccessToken = getAppPreferences(this, "ACCESS_TOKEN"); if (!mFacebookAccessToken.equals("")) { mFacebook.setAccessToken(mFacebookAccessToken); } }
// 글, 사진 등록하기 private void feed() { try { Log.v(C.LOG_TAG, "access token : " + mFacebook.getAccessToken()); Bundle params = new Bundle(); String message = "\n\n< WhenWhereWith APP으로 부터 자동 등록 > \n\n" + "● 어디서 : " + movie.getWhere() + "\n" + "● 나의 평점 : " + movie.getGrade() + "/10.0 \n" + faceBook_myGenreTxtVw.getText().toString().trim() + "\n" + faceBook_myOpenInfoTxtVw.getText().toString().trim() + "\n" + faceBook_myActorTxtVw.getText().toString().trim() + "\n\n\n" + "● 후기 : " + mEtContent.getText().toString().trim() + "\n\n"; params.putString("message", message); params.putString("name", faceBook_myTitleTxtVw.getText().toString().trim()); params.putString("link", ""); params.putString("description", "WhenWwhereWith APP"); params.putString("picture", movie.getThumbnail()); mFacebook.request("me/feed", params, "POST"); handler.sendEmptyMessage(0); } catch (Exception e) { e.printStackTrace(); } }