このブログ記事はちょうどそのことについて話しているようです。
Post JSON Using Android And HttpClient
編集:私はあなたの返事を見ました。方法は次のとおりです。これは基本的に、この後、あなたがそれからちょうどあなたの第二のために編集し、
母そのリンクの手順に従ってください
StringEntity st = new StringEntity(json.toString());
を送信するために、文字列エンティティをトリック:)
public static void main(String[] args) {
File file = new File("<path to json file>");
FileInputStream fis;
String json = "";
try {
fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
// dis.available() returns 0 if the file does not have more lines.
while (dis.available() != 0) {
json += dis.readLine();
}
// dispose all the resources after using them.
fis.close();
bis.close();
dis.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
を作成しないホープ質問:データベースのテキストを含む文字列を作成するだけです。そのすべてがそれにある。上記のようなStringEntityを作成します。
リンクのためのthx、私は私のjsonの作成についての問題に遭遇します。 どうすれば作成できますか?私はpout {}する必要がありますか? – sayvortana
thx manish burmanさんが編集した回答のために、申し訳ありません。ただ質問を編集してください。 – sayvortana