我已经使用此代码在foursqure上发布图片。我知道我已经问过这个问题了,但经过大量的搜索后,我尝试使用此代码在foursqure上发布图片..但是我很困惑,我发布的图片将在哪里在foursqure上显示,我的个人资料图片没有显示。请帮助我。,谢谢你。
public class FoursqureMain extends Activity {
public Foursquare foursquare;
private SharedPreferences _sPrefs=null;
private int IMAGE_CAPTURE;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.four_squre);
_sPrefs=getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
foursquare = new Foursquare(
"IMFHTE3P5TUSH1F1GOIBTRF52U3NAUFLJVUTYZLQY1XMPNCE"
,
"UKP35K4J0GTMVY23OQBW5ZEFJDZZ1GCMLCQMDN3MCBVFVQ1X",
"http://www.techvalens.net/://connect");
foursquare.authorize(this, new FoursquareAuthenDialogListener());
}
class FoursquareAuthenDialogListener implements DialogListener {
private JSONObject element;
public FoursquareAuthenDialogListener() {
// TODO Auto-generated constructor stub
}
@Override
public void onComplete(Bundle values) {
try {
String aa = null;
aa = foursquare.request("users/self");
Log.d("Foursquare-Main", aa);
postImageonWall();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void postImageonWall() {
byte[] data = null;
/* Bitmap bi = BitmapFactory.decodeFile("/sdcard");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();*/
Bundle params = new Bundle();
params.putString(Foursquare.TOKEN,"");
params.putString("method", "photos.upload");
params.putByteArray("picture", data);
List<NameValuePair> request = new ArrayList<NameValuePair>(4);
Intent intent = getIntent();
// String message = intent.getStringExtra(SignIn.EXTRA_MESSAGE);
// requestParaList.add(new BasicNameValuePair("login_user_id", _sPrefs.getString("LOGIN_USER_ID", "")));
request.add(new BasicNameValuePair("user_id", _sPrefs.getString("USER_ID",Constant.USER_ID)));
request.add(new BasicNameValuePair("image",Constant._profilePicBase64));
Log.d("myresponse", Constant._profilePhotoUrl);
request.add(new BasicNameValuePair("oauth_token",Foursquare.TOKEN));
request.add(new BasicNameValuePair("v", "20121210"));
post("https://api.foursquare.com/v2/photos/add", request);
}
private void post(String string, List<NameValuePair> request) {
// TODO Auto-generated method stub
}
@Override
public void onFoursquareError(FoursquareError e) {
// TODO Auto-generated method stub
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
@Override
public void onCancel() {
// TODO Auto-generated method stub
}
}
}
这里是图片