所以我正在为Android制作应用程序,我想强制平板电脑的横向定位和手机的纵向定位.然而,似乎我只能从我所看到的方向进行定位锁定,这会使想要两个单独的设备方向的目的失败.
平板电脑:风景电话:肖像
更具技术性.
我在"res/layout-xlarge-land"中有一个用于在平板电脑上进行美化的布局,我在"res/layout"中有原始布局,我只想明确地使用layout-xlarge-land作为平板电脑.没有别的,基本上只使用xlarge设备的横向.
谢谢!
我正在尝试将Flurry Analytics用于Android上的程序,但我无法从服务器获取xml文件.
我已经接近了,因为在Log Cat System.out标签中我可以出于某种原因得到它的一半,它说"XML传递异常= java.net.MalformedURLException:未找到协议:?xml version = 1.0 encoding ="UTF -8"等等......直到我的xml代码大约一半.不知道我做错了什么,我发送一个带有头的HTTP get请求接受application/xml并且它无法正常工作.任何帮助非常感谢!
try {
//HttpResponse response = client.execute(post);
//HttpEntity r_entity = response.getEntity();
//String xmlString = EntityUtils.toString(r_entity);
HttpClient client = new DefaultHttpClient();
String URL = "http://api.flurry.com/eventMetrics/Event?apiAccessCode=????&apiKey=??????&startDate=2011-2-28&endDate=2011-3-1&eventName=Tip%20Calculated";
HttpGet get = new HttpGet(URL);
get.addHeader("Accept", "application/xml");
get.addHeader("Content-Type", "application/xml");
HttpResponse responsePost = client.execute(get);
HttpEntity resEntity = responsePost.getEntity();
if (resEntity != null)
{
System.out.println("Not null!");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
String responseXml = EntityUtils.toString(responsePost.getEntity());
Document doc = db.parse(responseXml);
doc.getDocumentElement().normalize();
NodeList nodeList = …Run Code Online (Sandbox Code Playgroud)