私のアプリケーションは Android バージョン 2.3 以下で正常に実行されますが、Android 4.0 および 4.2 では応答が null になります。Google で検索した結果、HoneyComb と Ice Cream Sandwich は UI スレッドに対する悪用についてより厳格であることがわかりました。
ICS と HoneyComb が UI スレッドで実行できない他の操作の例を次に示します。
Opening a Socket connection (i.e. new Socket()).
HTTP requests (i.e. HTTPClient and HTTPUrlConnection).
Attempting to connect to a remote MySQL database.
Downloading a file (i.e. Downloader.downloadFile()).
If you are attempting to perform any of these operations on the UI thread, you must wrap them in a worker thread. The easiest way to do this is to use of an AsyncTask, which allows you to perform asynchronous work on your user interface. An AsyncTask will perform the blocking operations in a worker thread and will publish the results on the UI thread, without requiring you to handle threads and/or handlers yourself.
古いコードを変更する必要はありませんか?プロジェクトで HTTP リクエストを 50 回以上呼び出しました。したがって、すべてのクラスで手動で変更する必要があるため、HTTP 要求で実行されますか?
任意の提案をいただければ幸いです。