我尝试发送字符串"Приветмир!"
String link = POST_URL;
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(link);
String xml ="?????? ???";
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("file", xml));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
Run Code Online (Sandbox Code Playgroud)
并通过PHP脚本保存:
if(!empty($_REQUEST['file'])){
$fp = fopen("C:\\windows\\temp\\1.xml", "w");
$mytext =$_POST["file"];
$test = fwrite($fp, $mytext);
fclose($fp);
Run Code Online (Sandbox Code Playgroud)
但是我得到了?????? ????? 在我的网络服务器上,我尝试使用utf编码重新打开文件,但它没有帮助.我该如何解决呢.
我需要将活动A中的EditText数据发送到活动B.我试过:
Intent intent1=new Intent(A.this,B.class);
intent1.putExtra("fromA", "text");
startActivity(intent1);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为活动B android:launchMode="singleTask"之前已经创建过.
怎么回事,我可以发送数据吗?
当我试图获得额外的东西,我得到致命的Eroorr
try{
Sdacha=getIntent().getExtras().getString("Sdacha");
}
catch(NullPointerException e){}
Run Code Online (Sandbox Code Playgroud)
我怎样才能检查存在的附加内容?
android ×3