0

私はアンドロイドを学んでいるので、インターネット経由でデータベースにアクセスしようとしている小さなアプリを1つ開発しました。これを行うには、最初にWAMPサーバーとphpを使用してローカルホストを使用して試しましたが、必要なファイルを変更してWebサイトにアップロードしましたアプリを実行すると、インターネット経由でデータをフェッチしようとし、次の LOGCAT が表示されます。

私はそれが何を言っているのか理解できません:

10-30 23:48:23.986: E/WindowManager(4484): Activity com.kamani.nirav.androidphpdemo.AllProductsActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40cd4c88 V.E..... R.....ID 0,0-384,96} that was originally added here
10-30 23:48:23.986: E/WindowManager(4484): android.view.WindowLeaked: Activity com.kamani.nirav.androidphpdemo.AllProductsActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40cd4c88 V.E..... R.....ID 0,0-384,96} that was originally added here
10-30 23:48:23.986: E/WindowManager(4484):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
10-30 23:48:23.986: E/WindowManager(4484):  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
10-30 23:48:23.986: E/WindowManager(4484):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.Dialog.show(Dialog.java:281)
10-30 23:48:23.986: E/WindowManager(4484):  at com.kamani.nirav.androidphpdemo.AllProductsActivity$LoadAllProducts.onPreExecute(AllProductsActivity.java:54)
10-30 23:48:23.986: E/WindowManager(4484):  at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
10-30 23:48:23.986: E/WindowManager(4484):  at android.os.AsyncTask.execute(AsyncTask.java:534)
10-30 23:48:23.986: E/WindowManager(4484):  at com.kamani.nirav.androidphpdemo.AllProductsActivity.onCreate(AllProductsActivity.java:41)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.Activity.performCreate(Activity.java:5104)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
10-30 23:48:23.986: E/WindowManager(4484):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 23:48:23.986: E/WindowManager(4484):  at android.os.Looper.loop(Looper.java:137)
10-30 23:48:23.986: E/WindowManager(4484):  at android.app.ActivityThread.main(ActivityThread.java:5041)
10-30 23:48:23.986: E/WindowManager(4484):  at java.lang.reflect.Method.invokeNative(Native Method)
10-30 23:48:23.986: E/WindowManager(4484):  at java.lang.reflect.Method.invoke(Method.java:511)
10-30 23:48:23.986: E/WindowManager(4484):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-30 23:48:23.986: E/WindowManager(4484):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-30 23:48:23.986: E/WindowManager(4484):  at dalvik.system.NativeStart.main(Native Method)

ここに私のアプリのコードがあります:

public class AllProductsActivity extends ListActivity {

private ProgressDialog processDialog;

JSONParser jsonParse = new JSONParser();

ArrayList<HashMap<String, String>> productsList;

private static String url_all_products = "http://www.niravkamani.com/get_all_products.php";

private static final String TAG_SUCCESS = "success";
private static final String TAG_PRODUCTS = "products";
private static final String TAG_PID = "pid";
private static final String TAG_NAME = "name";

JSONArray products = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.all_products);

    productsList = new ArrayList<HashMap<String, String>>();

    new LoadAllProducts().execute();

}

class LoadAllProducts extends AsyncTask<String, String, String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        processDialog = new ProgressDialog(AllProductsActivity.this);
        processDialog.setMessage("Loading items...Please wait...");
        processDialog.setIndeterminate(false);
        processDialog.setCancelable(false);
        processDialog.show();
    }

    @Override
    protected String doInBackground(String... args) {

        JSONObject json = jsonParse.makeHttpRequest(url_all_products);

        try {
            int success = json.getInt(TAG_SUCCESS);
            if (success == 1) {

                products = json.getJSONArray(TAG_PRODUCTS);

                for (int i = 0; i < products.length(); i++) {
                    JSONObject c = products.getJSONObject(i);

                    String id = c.getString(TAG_PID);
                    String name = c.getString(TAG_NAME);

                    HashMap<String, String> map = new HashMap<String, String>();

                    map.put(TAG_PID, id);
                    map.put(TAG_NAME, name);

                    productsList.add(map);

                }

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        processDialog.dismiss();

        ListAdapter listAdapter = new SimpleAdapter(
                AllProductsActivity.this, productsList, R.layout.list_item,
                new String[] { TAG_PID, TAG_NAME }, new int[] { R.id.pid,
                        R.id.name });

        setListAdapter(listAdapter);
    }
}

}
4

1 に答える 1