这个belove是我的load_data java类。我只得到屏幕上显示的变量s,因为"变量t从未使用过"。有人可以告诉我在哪里可以找到它吗?
package etn.transport.transporteexpress;
import...
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class display_clicked_load extends AppCompatActivity {
String id;
String loginemail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_clicked_load);
mLockScreenRotation();
Button send = (Button) findViewById(R.id.sendbutton);
id = getIntent().getStringExtra("id");
String shipping_date = getIntent().getStringExtra("shipping_date");
String shipping_time = getIntent().getStringExtra("shipping_time");
String shipping_address_address = getIntent().getStringExtra("shipping_address_address");
String shipping_address_postal_code = getIntent().getStringExtra("shipping_address_postal_code");
String shipping_address_city = getIntent().getStringExtra("shipping_address_city");
String shipping_address_nation = getIntent().getStringExtra("shipping_address_nation");
String description = getIntent().getStringExtra("description");
String weight = getIntent().getStringExtra("weight");
String destination_date = getIntent().getStringExtra("destination_date");
String destination_time = getIntent().getStringExtra("destination_time");
String destination_address_address = getIntent().getStringExtra("destination_address_address");
String destination_address_postal_code = getIntent().getStringExtra("destination_address_postal_code");
String destination_address_city = getIntent().getStringExtra("destination_address_city");
String destination_address_nation = getIntent().getStringExtra("destination_address_nation");
//loginemail = getIntent().getStringExtra("loginemail");
loginemail=global.email1;
TextView loaddate = (TextView) findViewById(R.id.txtloaddate);
TextView loadtime = (TextView) findViewById(R.id.txtloadtime);
TextView loadplace = (TextView) findViewById(R.id.txtloadplace);
TextView txtdesc = (TextView) findViewById(R.id.txtdescription);
TextView txtweight = (TextView) findViewById(R.id.txtweight);
TextView txtdestdate = (TextView) findViewById(R.id.txtdestinationdate);
TextView txtdesttime = (TextView) findViewById(R.id.txtdestinationtime);
TextView txtdestplace = (TextView) findViewById(R.id.txtdestplace);
/* String s = "<b>Shipping Date:</b>" + shipping_date.toString();
loaddate.setText(Html.fromHtml(s));
String t = "<b>Time:</b>" + shipping_time.toString();
loadtime.setText(Html.fromHtml(t));
String u = "<b>shipping_address</b>" + shipping_address_address.toString();
loadplace.setText(Html.fromHtml(u));
String v = "<b>Description:</b>" + description.toString();
txtdesc.setText(Html.fromHtml(v));
String w = "<b>Weight:</b>" + weight.toString() + " KG";
txtweight.setText(Html.fromHtml(w));
String x = "<b>Destination Date:</b>" + destination_date.toString();
txtdestdate.setText(Html.fromHtml(x));
String y = "<b>Time:</b>" + destination_time.toString();
txtdesttime.setText(Html.fromHtml(y));
String z = "<b>Destination Address:</b>" + destination_address_address.toString();
txtdestplace.setText(Html.fromHtml(z));
*/
String s = getResources().getString(R.string.shipping_date, shipping_date.toString());
loaddate.setText(Html.fromHtml(s));
String t= getResources().getString(R.string.shipping_time, shipping_time.toString());
/* loaddate.setText(Html.fromHtml(t));
String u= getResources().getString(R.string.shipping_address_c, shipping_address_address.toString());
loaddate.setText(Html.fromHtml(u));
String v= getResources().getString(R.string.transport_description_c, description.toString());
loaddate.setText(Html.fromHtml(v));
String w= getResources().getString(R.string.weight, weight.toString());
loaddate.setText(Html.fromHtml(w));
String x= getResources().getString(R.string.destination_date, shipping_date.toString());
loaddate.setText(Html.fromHtml(x));
String z= getResources().getString(R.string.destination_time, destination_time.toString());
loaddate.setText(Html.fromHtml(y));
String z= getResources().getString(R.string.destination_address, destination_address.toString());
loaddate.setText(Html.fromHtml(z));
/* loaddate.setText(Html.fromHtml(s));
loadtime.setText("Time:" + shipping_time.toString());
loadplace.setText("Shipping Address:" + shipping_address_address);
txtdesc.setText("Description:" + description);
txtweight.setText("Weight: " + weight + " KG");
txtdestdate.setText("Destination Date:" + destination_date.toString());
txtdesttime.setText("Time:" + destination_time.toString());
txtdestplace.setText("Destination Address:" + destination_address_address);
*/
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new myTask().execute();
}
});
}
class myTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
Log.d("inside", "onPre");
}
@Override
protected Void doInBackground(Void... voids) {
Log.d("inside", "DoIn");
sendData();
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(display_clicked_load.this);
dlgAlert.setMessage("Quotation Send Successfully");
dlgAlert.setTitle("Quotation Confirmation");
dlgAlert.setPositiveButton("OK", null);
dlgAlert.setCancelable(true);
dlgAlert.create().show();
}
}
public void sendData() {
try {
String ssendoffer;
String email;
// email=getIntent().getStringExtra("loginemail");
EditText sendoffer = (EditText) findViewById(R.id.sendoffer);
ssendoffer=sendoffer.getText().toString();
loginemail=global.email1;
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.testsite.com/folder/myfile.php");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(13);
nameValuePairs.add(new BasicNameValuePair("amount", ssendoffer));
nameValuePairs.add(new BasicNameValuePair("email",loginemail));
nameValuePairs.add(new BasicNameValuePair("quotation_id",id));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse hresponse = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("error....", e + "");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("error.......", e + "");
}
}
private void mLockScreenRotation() {
// Stop the screen orientation changing during an event
switch (this.getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_PORTRAIT:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
case Configuration.ORIENTATION_LANDSCAPE:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
}
}
}
答案 0 :(得分:0)
const [...butLast, last] = values
很简单,您定义了变量 String t= getResources().getString(R.string.shipping_time, shipping_time.toString());
/* loaddate.setText(Html.fromHtml(t)); */
,但注释掉了您使用它的位置。这不是错误,这是一个警告。
将来,搜索“t =”或者如果您通过“查找”功能(通常为Ctrl + F)使用通用编码标准“t =”。我不确定这是多么困难,变量是按字母顺序排列的,我确信你的IDE会在它下面出现一个波形。