微信开发-自定义菜单

public static void createMenu(String token,String menuStr)throws ClientProtocolException, IOException
	{
		token = "你获取的access_token";
		menuStr = "{"+
                ""button":["+
                "{"name":"xxx","+
                ""type":"view"," +
                ""url":"http://www.baidu.com"" +
                "},"+
                "{"name":"xxx","+
                ""type":"view"," +
                ""url":"http://www.qq.com"" +
                "},"+
                "{"name":"xxxx","+
                ""type":"view"," +
                ""url":"http://www.163.com"" +
                "}"+
            "]"+
        "}";
		
		String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+ token;

		DefaultHttpClient httpClient = new DefaultHttpClient();
		HttpPost post = new HttpPost(url);

		post.setEntity(new StringEntity(menuStr, WxData.CharSet));
		HttpResponse response = httpClient.execute(post);
		String jsonStr = EntityUtils.toString(response.getEntity(),WxData.CharSet);
		
		System.out.println(jsonStr);
	}
菜单格式为json然后你Post给微信;它会帮你完成,一般修改之后会有3-10分钟延迟,或者取消关注之后再次关注等待刷新;
原文地址:https://www.cnblogs.com/MedivhQ/p/4101263.html