0

いろいろ試しましたが、アップロード時の通知に進行状況を表示できませんでした。非同期タスクを使用してデータをサーバーにアップロードできますが、Facebook で画像やビデオをアップロードするときのように、データをサーバーにアップロードして通知バーに表示する必要があります。

私はこれを行うことができません。非同期でデータをアップロードするための私のコードは以下のとおりです。

doInBackGround() メソッドで以下のコードを記述します。

            HttpClient httpClient = new DefaultHttpClient();
            HttpPost postRequest = new HttpPost(
                    "http://********.php?f=setAvatar");
            ByteArrayBody bab = new ByteArrayBody(data, "receipt.jpg");
            // File file= new File("/mnt/sdcard/forest.png");
            // FileBody bin = new FileBody(file);
            File file = new File(ProfileEdit.selectedImagePath);
            MultipartEntity reqEntity = new MultipartEntity(
                    HttpMultipartMode.BROWSER_COMPATIBLE);
            ContentBody cbFile = new FileBody(file, "image/jpeg");
            reqEntity.addPart("im", cbFile);
            reqEntity.addPart("u", new StringBody(USERID));
            reqEntity.addPart("k", new StringBody(KEY));
            reqEntity.addPart("p", new StringBody(pannelId));

            //reqEntity.addPart("id", new StringBody(password));
            //reqEntity.addPart("addExpenseResult", new StringBody(expenceresult));
            postRequest.setEntity(reqEntity);
            HttpResponse response = httpClient.execute(postRequest);
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    response.getEntity().getContent(), "UTF-8"));
            String sResponse;
            StringBuilder s = new StringBuilder();
4

1 に答える 1

0

使用RemoteViewPendingIntentて通知バーに表示するには、次を参照してください: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView

詳細な進行状況については、進行状況バー android を更新するためにアップロードされたバイト数を知る必要があります

于 2012-09-07T09:51:15.350 に答える