使用asmack接收文件时遇到问题.在这里,我粘贴我发送和接收日志的错误和数据包
// error
04-21 19:21:05.109: WARN/System.err(7401): Error in execution:
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: java.util.concurrent.ExecutionException:
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: No response from remote client:
04-21 19:21:05.109: WARN/System.err(7401): at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:199)
04-21 19:21:05.109: WARN/System.err(7401): at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFileTransfer.java:47)
04-21 19:21:05.109: WARN/System.err(7401): at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTransfer.java:124)
04-21 19:21:05.109: WARN/System.err(7401): at java.lang.Thread.run(Thread.java:1019)
04-21 19:21:05.109: WARN/System.err(7401): Nested Exception:
04-21 19:21:05.109: WARN/System.err(7401): java.util.concurrent.ExecutionException:
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: No response from remote client:
04-21 19:21:05.109: WARN/System.err(7401): at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:234)
04-21 19:21:05.109: WARN/System.err(7401): at java.util.concurrent.FutureTask.get(FutureTask.java:91)
04-21 19:21:05.109: WARN/System.err(7401): …Run Code Online (Sandbox Code Playgroud) 我使用下面的代码从网址获取图像,但它不适用于大图像.
在获取该类型的图像时我是否遗漏了一些东西?
imgView = (ImageView)findViewById(R.id.ImageView01);
imgView.setImageBitmap(loadBitmap("http://www.360technosoft.com/mx4.jpg"));
//imgView.setImageBitmap(loadBitmap("http://sugardaddydiaries.com/wp-content/uploads/2010/12/how_do_i_get_sugar_daddy.jpg"));
//setImageDrawable("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg");
//Drawable drawable = LoadImageFromWebOperations("http://www.androidpeople.com/wp-content/uploads/2010/03/android.png");
//imgView.setImageDrawable(drawable);
/* try {
ImageView i = (ImageView)findViewById(R.id.ImageView01);
Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg").getContent());
i.setImageBitmap(bitmap);
} catch (MalformedURLException e) {
System.out.println("hello");
} catch (IOException e) {
System.out.println("hello");
}*/
}
protected Drawable ImageOperations(Context context, String string,
String string2) {
// TODO Auto-generated method stub
try {
InputStream is = (InputStream) this.fetch(string);
Drawable d = Drawable.createFromStream(is, "src");
return d;
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
} catch (IOException e) …Run Code Online (Sandbox Code Playgroud) 提前致谢...
即时通讯使用此代码在http请求中设置http标头验证网址..
但我觉得有些什么是因为我无法得到回应......
响应仍然像"需要授权"......
httpParameters = new BasicHttpParams();
String auth = android.util.Base64.encodeToString(
("florin999@zitec.ro" + ":" + "test2323" + ":" + "zitec"
+ ":" + "7716099f468cc71670b68cf4b3ba545c5760baa7")
.getBytes("UTF-8"), android.util.Base64.NO_WRAP);
HttpConnectionParams.setSoTimeout(httpParameters, 0);
client = new DefaultHttpClient(httpParameters);
String getURL = "URL here";
get = new HttpGet(getURL);
get.addHeader("Authorization", "Basic "+ auth);
// get.addHeader("X-ZFWS-Accept", "text/json");
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
//do something with the response
//Toast.makeText(Login.this.getApplicationContext(),EntityUtils.toString(resEntityGet), Toast.LENGTH_SHORT).show();
String s = EntityUtils.toString(resEntityGet);
tv1.setText(s);
}
}catch(Exception e){
}
Run Code Online (Sandbox Code Playgroud)
plssss尽快帮助我
我在点击TabActivity当前选中的标签时尝试获取Click事件.
我尝试下面的代码,但当我点击一个选项卡时,其他选项卡无法正常工作/单击.
setupTab(new TextView(this), "Map");
setupTab(new TextView(this), "Attacks");
setupTab(new TextView(this), "Profile");
setupTab(new TextView(this), "Headquater");
int numberOfTabs = tabHost.getTabWidget().getChildCount();
for(int t=0; t<numberOfTabs; t++){
getTabWidget().getChildAt(t).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(tabHost.getCurrentTab() == 0){
Toast.makeText(TabContext, ""+"i m in on clickkkkk" ,1500).show();
getTabHost().setCurrentTab(0);
}
if(tabHost.getCurrentTab() == 1){
Toast.makeText(TabContext, ""+"i m in on clickkkkk....$#@$#$" ,1500).show();
getTabHost().setCurrentTab(1);
}
}
});
}
Run Code Online (Sandbox Code Playgroud) final Intent i = new Intent(android.content.Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ txt.getText().toString()});
i.putExtra(Intent.EXTRA_SUBJECT, "Merry Christmas");
i.setType("text/html");
Spanned html =Html.fromHtml("<html><body>h<b>ell</b>o<img src='http://www.pp.rhul.ac.uk/twiki/pub/TWiki/GnuPlotPlugin/RosenbrockFunctionSample.png'>world</body></html>",
new ImageGetter() {
InputStream s;
public Drawable getDrawable(String url) {
try {
s = (InputStream) (new URL(url)).getContent();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Drawable d = Drawable.createFromStream(s, null);
LogUtil.debug(this, "Got image: " + d.getClass() + ", " + d.getIntrinsicWidth() + "x" + d.getIntrinsicHeight());
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}},null);
i.putExtra(Intent.EXTRA_TEXT, html);
startActivity(Intent.createChooser(i, "Send email"));*
Run Code Online (Sandbox Code Playgroud) 我为不同的屏幕尺寸制作了一个动态布局的应用程序.
除320x240屏幕外,它还适用于所有屏幕尺寸.
我使用相同的代码来获取所有的宽度和高度,它也返回正确的值,但它没有返回正确的值,手动创建模拟器意味着320x240和240x400.
我使用了以下代码:
DisplayMetrics metrics = new DisplayMetrics();
WindowManager manager = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
manager.getDefaultDisplay().getMetrics(metrics);
int width=metrics.widthPixels;
int height=metrics.heightPixels;
Run Code Online (Sandbox Code Playgroud) 我目前正在处理一个应用程序..在该应用程序中我必须使用get和post两种方法.. get方法正常工作但在post方法突然我得到响应像
"invalid method.post required"..
Run Code Online (Sandbox Code Playgroud)
我的代码是:
String list_url = "************************";
try {
String appand = TimeStampForAuth.TimeStameMethod(main.this);
String auth = android.util.Base64.encodeToString(("iphone" + ":" +
"2a5a262d5a")
.getBytes("UTF-8"), android.util.Base64.NO_WRAP);
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(list_url+appand);
Log.d("URL_LIST", list_url+appand);
List nvps = new ArrayList();
nvps.add(new BasicNameValuePair("login",Login));
nvps.add(new BasicNameValuePair("password",password));
nvps.add(new BasicNameValuePair("title",title));
nvps.add(new BasicNameValuePair("category_id",cat_id));
UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,HTTP.UTF_8);
post.addHeader("Authorization", "Basic " + auth);
post.setEntity(p_entity);
HttpResponse response = client.execute(post);
HttpEntity responseEntity = response.getEntity();
String s = EntityUtils.toString(responseEntity);
Log.d("List response", s);
}
catch(Exception e){ …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,其中我必须根据用户导航旋转箭头。
我正在使用最新的 Mapbox SDK。
我尝试过设置障碍(使用纬度和经度计算)但未能成功。
我不知道如何实现它。
它(箭头标记)应该在预定义的多边形路径上导航。
我已经尝试了将Facebook与XMPP连接起来的所有事情,但我一直只遇到一个错误:
SASL身份验证失败使用机制DIGEST-MD5
我正在实现以下方法来执行此任务:
public class MySASLDigestMD5Mechanism extends SASLMechanism {
public MySASLDigestMD5Mechanism(SASLAuthentication saslAuthentication) {
super(saslAuthentication);
}
protected void authenticate() throws IOException, XMPPException {
String[] mechanisms = { getName() };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", hostname, props, this);
super.authenticate();
}
public void authenticate(String username, String host, String password) throws IOException, XMPPException {
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String,String> props = new HashMap<String,String>();
sc = Sasl.createSaslClient(mechanisms, …Run Code Online (Sandbox Code Playgroud) 我正在一个应用程序中工作,我必须从Facebook获取所有朋友列表.
我已经实现了这样的代码:
Facebook mFacebook = new Facebook("141118172662401");
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle params = new Bundle();
params.putString("fields", "name,id");
mAsyncRunner.request("me/friends", params, "GET", new FriendListRequestListener(), null);
}
});
}
public class FriendListRequestListener {
public void onComplete(final String response) {
_error = null;
try {
JSONObject json = Util.parseJson(response);
final JSONArray friends = json.getJSONArray("data");
FacebookFriendsActivity.this.runOnUiThread(new Runnable() {
JSONObject data;
public void run() {
try{
try {
data = Util.parseJson(response);
} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JSONArray …Run Code Online (Sandbox Code Playgroud) 我已经更新了当前的 Play 商店应用程序并启用了即时应用程序功能。但等了5天,仍然没有显示“立即尝试”按钮。
我已经在当前应用程序中实现了即时应用程序功能,并对其进行了更新,如下所示:
你们能帮我找出缺失的元素或方向吗?