b = this.getIntent().getExtras();
s = this.getIntent().getStringExtra("DEFAULTTEXT");
public void onClick(View v)
{
String a = "http://152.226.152.156:1010/jsp-examples/test1";
URL url = null;
HttpURLConnection httpurlconnection = null;
try {
url = new URL(a);
httpurlconnection = (HttpURLConnection) url
.openConnection();
httpurlconnection.setDoOutput(true);
httpurlconnection.setRequestMethod("POST");
Toast.makeText(Booking.this, a, Toast.LENGTH_SHORT).show();
Toast.makeText(Booking.this, "Toast1", Toast.LENGTH_SHORT).show();
ObjectOutputStream dos = new ObjectOutputStream(httpurlconnection.getOutputStream());
SendVEctor.add(txtArrivalTime.getText().toString());
SendVEctor.add(txtFerry.getText().toString());
SendVEctor.add(txtStatus.getText().toString());
SendVEctor.add(txtDestination.getText().toString());
SendVEctor.add(s.toString());
dos.writeObject(SendVEctor);
dos.close();
s would be my intent and how would i put it into my SendVEctor?
Thank you.
sis not your intent,sis the value of theDEFAULTTEXTattribute of your actual intent. From the question, it’s really hard to tell what you want to achieve.The actual code adds this value to the vector. Because all things you add to the vector are String, I assume the vector is declared and constructed like this:
In this case you won’t be able to add the intent object to the vector, because this vector can hold nothing but Strings.
If the vector is untyped, in other words, declared and constructed like this:
then you’ll be able to add the intent with the expression
but:
Intentis not serializable so you won’t be able to write the vector to theObjectOutputStream.Please add some more details and explain what you really want to serialize. Just text or text mixed with objects.