on Nexus 7 (4.3), а не на моем старом устройстве, LG Optimus 3D (Android 2.2),
Когда я делаю httppost, я получаю это < /p>
e /inputdispster ﹕ канал '4273f7b0 ... MainActivity (сервер)' ~ Канал не будет разорван и будет разорван! /> Люди упомянули возможную утечку памяти. Видеть **. Тем не менее, эта проблема происходит сразу же при запуске, когда я пробую Httppost. Вероятно, это все еще утечка памяти?public void server_addUserGetId()
{
String url = GS.baseUrl() + "/users";
HttpPost theHttpPost = new HttpPost(url);
List nameValuePairs = new ArrayList();
nameValuePairs.add(new BasicNameValuePair("dId", s_UserInfo.getInstance().m_device_id ));
try {
theHttpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
HttpPostAsync theHttpPostAsync = new HttpPostAsync(new OnPostExecuteHandler() {
@Override
public void handlePostExecute(Object oHttpResponse) {
HttpResponse theHttpResponse = (HttpResponse) oHttpResponse;
JSONObject jo = GS.getJSONObject(theHttpResponse.getEntity());
try {
s_UserInfo.getInstance().m_user_id = jo.getString("_id");
} catch (JSONException e) {
e.printStackTrace();
}
}
});
theHttpPostAsync.execute(theHttpPost);
return;
}
< /code>
Вот моя httppostasync задача: < /p>
public class HttpPostAsync extends AsyncTask
{
private HttpPost m_HttpPost;
private HttpResponse m_HttpResponse;
private OnPostExecuteHandler m_OnPostExecuteHandler;
public HttpPostAsync(OnPostExecuteHandler listener)
{
m_OnPostExecuteHandler = listener;
}
protected HttpResponse doInBackground(HttpPost ... args)
{
m_HttpPost = args[0];
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "doInBackground: Thread.currentThread().getId()=" + Thread.currentThread().getId());
m_HttpResponse = visit(m_HttpPost);
return m_HttpResponse;
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(Long result) {
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: Thread.currentThread().getId()=" + Thread.currentThread().getId());
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: result=" + result);
//if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: m_HttpEntity="+m_HttpEntity);
m_OnPostExecuteHandler.handlePostExecute(m_HttpResponse);
}
public HttpResponse visit(HttpPost theHttpPost)
{
HttpResponse response = null;
try {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
// Execute HTTP Post Request
response = httpclient.execute(theHttpPost);
} catch (IOException e) {
e.printStackTrace();
Log.d("HttpPostAsync.java", "IOException e=" + e);
// TODO Auto-generated catch block
}
return response;
}
}
< /code>
Есть идеи?List nameValuePairs = new ArrayList(1);
< /code>
*: так что ответ, который не был полностью связан /справился:
приложение перестало работать Android < /p>
** Утечка памяти? http://android-developers.blogspot.com/ ... droid.html
Подробнее здесь: https://stackoverflow.com/questions/227 ... e-disposed
Httppost: inputdispatcher: «Канал невозможно сломаться и будет утилизироваться!» на Nexus 7 ⇐ Android
Форум для тех, кто программирует под Android
1755158995
Anonymous
on Nexus 7 (4.3), а не на моем старом устройстве, LG Optimus 3D (Android 2.2),
Когда я делаю httppost, я получаю это < /p>
e /inputdispster ﹕ канал '4273f7b0 ... MainActivity (сервер)' ~ Канал не будет разорван и будет разорван! /> Люди упомянули возможную утечку памяти. Видеть **. Тем не менее, эта проблема происходит сразу же при запуске, когда я пробую Httppost. Вероятно, это все еще утечка памяти?public void server_addUserGetId()
{
String url = GS.baseUrl() + "/users";
HttpPost theHttpPost = new HttpPost(url);
List nameValuePairs = new ArrayList();
nameValuePairs.add(new BasicNameValuePair("dId", s_UserInfo.getInstance().m_device_id ));
try {
theHttpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
HttpPostAsync theHttpPostAsync = new HttpPostAsync(new OnPostExecuteHandler() {
@Override
public void handlePostExecute(Object oHttpResponse) {
HttpResponse theHttpResponse = (HttpResponse) oHttpResponse;
JSONObject jo = GS.getJSONObject(theHttpResponse.getEntity());
try {
s_UserInfo.getInstance().m_user_id = jo.getString("_id");
} catch (JSONException e) {
e.printStackTrace();
}
}
});
theHttpPostAsync.execute(theHttpPost);
return;
}
< /code>
Вот моя httppostasync задача: < /p>
public class HttpPostAsync extends AsyncTask
{
private HttpPost m_HttpPost;
private HttpResponse m_HttpResponse;
private OnPostExecuteHandler m_OnPostExecuteHandler;
public HttpPostAsync(OnPostExecuteHandler listener)
{
m_OnPostExecuteHandler = listener;
}
protected HttpResponse doInBackground(HttpPost ... args)
{
m_HttpPost = args[0];
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "doInBackground: Thread.currentThread().getId()=" + Thread.currentThread().getId());
m_HttpResponse = visit(m_HttpPost);
return m_HttpResponse;
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(Long result) {
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: Thread.currentThread().getId()=" + Thread.currentThread().getId());
if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: result=" + result);
//if(GS.dl>5) Log.d("GRA: HttpPostAsync", "onPostExecute: m_HttpEntity="+m_HttpEntity);
m_OnPostExecuteHandler.handlePostExecute(m_HttpResponse);
}
public HttpResponse visit(HttpPost theHttpPost)
{
HttpResponse response = null;
try {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
// Execute HTTP Post Request
response = httpclient.execute(theHttpPost);
} catch (IOException e) {
e.printStackTrace();
Log.d("HttpPostAsync.java", "IOException e=" + e);
// TODO Auto-generated catch block
}
return response;
}
}
< /code>
Есть идеи?List nameValuePairs = new ArrayList(1);
< /code>
*: так что ответ, который не был полностью связан /справился:
приложение перестало работать Android < /p>
** Утечка памяти? http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html
Подробнее здесь: [url]https://stackoverflow.com/questions/22758482/httppost-inputdispatcher-channel-is-unrecoverably-broken-and-will-be-disposed[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия