try
{
GetText();
}
catch
(Exception ex) {
Dialog();
}
}
});
}
public
void
GetText()
throws
UnsupportedEncodingException {
Title = postTitle.getText().toString();
Name = postName.getText().toString();
Contents = postContents.getText().toString();
Log.d(
this
.getClass().getName(),
"정보받냐1"
);
String data = URLEncoder.encode(
"name"
,
"UTF-8"
)
+
"="
+ URLEncoder.encode(Title,
"UTF-8"
);
data +=
"&"
+ URLEncoder.encode(
"email"
,
"UTF-8"
) +
"="
+ URLEncoder.encode(Name,
"UTF-8"
);
data +=
"&"
+ URLEncoder.encode(
"user"
,
"UTF-8"
)
+
"="
+ URLEncoder.encode(Contents,
"UTF-8"
);
String text =
""
;
BufferedReader reader =
null
;
try
{
URL url =
new
URL(
"주소창"
);
Log.d(
this
.getClass().getName(),
"정보받냐2"
);
URLConnection conn = url.openConnection();
conn.setDoOutput(
true
);
OutputStreamWriter wr =
new
OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
reader =
new
BufferedReader(
new
InputStreamReader(conn.getInputStream()));
StringBuilder sb =
new
StringBuilder();
String line =
null
;
while
((line = reader.readLine()) !=
null
) {
sb.append(line +
"\n"
);
}
text = sb.toString();
}
catch
(Exception ex) {
}
finally
{
try
{
reader.close();
}
catch
(Exception ex) {
Dialog();
if
(Title !=
null
);
else
if
(Name !=
null
);
else
if
(Contents !=
null
);
Log.d(
this
.getClass().getName(),
"정보받냐3"
);
}
}