LoginSignup
0
0

More than 5 years have passed since last update.

restfbで取得するFacebookアカウントの氏名を日本語にする方法

Last updated at Posted at 2013-04-10
Example.java
import java.util.Locale;

import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.Parameter;
import com.restfb.types.User;

public class Example {
    private static final String ACCESS_TOKEN = "yourtoken";

    public static void main(String[] args) {
        FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN);
        // パラメータにLocaleを指定する必要がある。
        Locale locale = Locale.JAPAN;
        User user = facebookClient.fetchObject("me", User.class,
                Parameter.with("locale", locale));
        System.out.println("last_name: " + user.getLastName());
        System.out.println("first_name: " + user.getFirstName());
    }
}

「new Locale("ja_JP");」を「Locale.JAPAN;」に変更しました。
@roundrop@github さんありがとうございました。

0
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0