Android Widget remoteviews güncelleme üzerinde emülatör kayboluyor

0 Cevap php

Benim MySQL DB tablo anahtar olarak image_id ile bir BLOB görüntü tutar. Ben aşağıdakileri yapmaya çalışıyorum.

Ad değer çiftleri image_id ile Android App 1.HttpPost ("http://example.com/RetrieveImage.php").

Aşağıdaki gibi PHP Script:

<?php
mysql_connect("host","userid","password");
mysql_select_db("database");
$q=mysql_query("SELECT image FROM testblob WHERE image_id =".$_REQUEST['image_id']."");
$e=mysql_fetch_assoc($q);
print($e);
mysql_close();
?>
  1. httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    InputStream is = entity.getContent(); 
    response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();
    is = entity.getContent();
  2. InputStream nesne BLOB verileri depolamak dizi bayt için

ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buf = new byte[10240];
            int n = 0;
            try {
                while ((n=is.read(buf))>=0)
                {
                baos.write(buf, 0, n);
                }
  is.close();
  byte[] bytes = baos.toByteArray();
  1. Bayt bitmape dizisi ve Görüntü Android widget set ImageView dönüştürmek
Bitmap bitmap;
   RemoteViews updateViews = null;
   bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
   updateViews = new RemoteViews(context.getPackageName(), R.layout.tuwidget);
   updateViews.setImageViewBitmap(R.id.tuwidget_img_btn, bitmap);
   return updateViews;

Once this is run, I dont know why the widget does not even show up on the emulator and cannot even add the widget anymore to the screen. What am I doing wrong? Any help is much appreciated.

Oh and here is my widget layout.

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tuwidget"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/tuwidget_img_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ImageView>
</AbsoluteLayout>

0 Cevap