[android-developers] Loading a bitmap from a byte buffer
I'm trying to populate a create a bitmap from something other than an RGBA int array. However, the Bitmap creation overloads only take int arrays as inputs. In particular, I have a byte buffer that is in the R5G6B5 format that I want to load directly into a bitmap. The format is supposedly supported internally, but I can't figure out how to create the bitmap without doing the R5G6B5 to A8R8G8B8 conversion first. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Loading a bitmap from a byte buffer
I inspected Bitmap.cpp and found this function: static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, const SkBitmap* bitmap, jboolean isMutable, jobject parcel) { if (parcel == NULL) { SkDebugf("--- writeToParcel null parcel\n"); return false; } android::Parcel* p = android::parcelForJavaObject(env, parcel); p->writeInt32(isMutable); p->writeInt32(bitmap->config()); p->writeInt32(bitmap->width()); p->writeInt32(bitmap->height()); p->writeInt32(bitmap->rowBytes()); if (bitmap->getConfig() == SkBitmap::kIndex8_Config) { SkColorTable* ctable = bitmap->getColorTable(); if (ctable != NULL) { int count = ctable->count(); p->writeInt32(count); memcpy(p->writeInplace(count * sizeof(SkPMColor)), ctable->lockColors(), count * sizeof(SkPMColor)); ctable->unlockColors(false); } else { p->writeInt32(0); // indicate no ctable } } size_t size = bitmap->getSize(); bitmap->lockPixels(); memcpy(p->writeInplace(size), bitmap->getPixels(), size); bitmap->unlockPixels(); return true; } I can manually marshal a Bitmap parcel in the proper format, and then append the custom byte buffer, and then use createFromParcel to create a bitmap. That gets me indirect access to creating a bitmap directly from a byte buffer. It's a bit of a hack obviously, and not ideal. Is there a better way to do this? On Dec 1, 2:41 pm, Koush <[EMAIL PROTECTED]> wrote: > I'm trying to populate a create a bitmap from something other than an > RGBA int array. > However, the Bitmap creation overloads only take int arrays as inputs. > > In particular, I have a byte buffer that is in the R5G6B5 format that > I want to load directly into a bitmap. The format is supposedly > supported internally, but I can't figure out how to create the bitmap > without doing the R5G6B5 to A8R8G8B8 conversion first. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Loading a bitmap from a byte buffer
And as I said, decodeByteArray is for compressed images, such as PNG and JPG. It does not work with uncompressed byte buffers that are in R8G8B8A8 or R5G6B5 formats. What is needed are the lockPixels and unlockPixels methods on a mutable Bitmap. On Dec 2, 1:15 am, Christine <[EMAIL PROTECTED]> wrote: > As John says, why don't you use BitmapFactory.decodeByteArray? > > On Dec 2, 10:03 am, Koush <[EMAIL PROTECTED]> wrote: > > > Also, the Bitmap class internally (in the C++ JNI atleast) supports > > the all familiar lockPixels and unlockPixels methods, which allows > > direct access to the byte buffer. I would suggest extending the Java > > API to include those methods. > > > On Dec 2, 1:00 am, Koush <[EMAIL PROTECTED]> wrote: > > > > Dianne Hackborn: I am asking this in the context of how to create a > > > screenshot application. Taking screenshots is not possible on the G1 > > > anyways, because reading from /dev/graphics/fb0 is only available to > > > root and shell and not available to actual applications. Thus is only > > > works on hacked phones. So you're asking me to not do something, when > > > I'm well past the line of things I should not be doing. :) > > > Incidentally, the inability to take a simple screenshot of what is on > > > your phone is a pretty significant oversight (you're not going to > > > always be hooked up to a PC with the SDK/DDMS tool at your disposal). > > > > John Spurlock: Decode byte array is for compressed byte arrays, such > > > as PNGs and JPG. > > > I am basically trying to copy directly into the pixel buffer. > > > > On Dec 1, 3:34 pm, John Spurlock <[EMAIL PROTECTED]> wrote: > > > > > BitmapFactory.decodeByteArray ? > > > > >http://code.google.com/android/reference/android/graphics/BitmapFacto... > > > > > On Dec 1, 5:58 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > > > I inspected Bitmap.cpp and found this function: > > > > > > static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, > > > > > const SkBitmap* bitmap, > > > > > jboolean isMutable, jobject > > > > > parcel) { > > > > > if (parcel == NULL) { > > > > > SkDebugf("--- writeToParcel null parcel\n"); > > > > > return false; > > > > > } > > > > > > android::Parcel* p = android::parcelForJavaObject(env, parcel); > > > > > > p->writeInt32(isMutable); > > > > > p->writeInt32(bitmap->config()); > > > > > p->writeInt32(bitmap->width()); > > > > > p->writeInt32(bitmap->height()); > > > > > p->writeInt32(bitmap->rowBytes()); > > > > > > if (bitmap->getConfig() == SkBitmap::kIndex8_Config) { > > > > > SkColorTable* ctable = bitmap->getColorTable(); > > > > > if (ctable != NULL) { > > > > > int count = ctable->count(); > > > > > p->writeInt32(count); > > > > > memcpy(p->writeInplace(count * sizeof(SkPMColor)), > > > > > ctable->lockColors(), count * sizeof(SkPMColor)); > > > > > ctable->unlockColors(false); > > > > > } else { > > > > > p->writeInt32(0); // indicate no ctable > > > > > } > > > > > } > > > > > > size_t size = bitmap->getSize(); > > > > > bitmap->lockPixels(); > > > > > memcpy(p->writeInplace(size), bitmap->getPixels(), size); > > > > > bitmap->unlockPixels(); > > > > > return true; > > > > > > } > > > > > > I can manually marshal a Bitmap parcel in the proper format, and then > > > > > append the custom byte buffer, and then use createFromParcel to create > > > > > a bitmap. That gets me indirect access to creating a bitmap directly > > > > > from a byte buffer. It's a bit of a hack obviously, and not ideal. Is > > > > > there a better way to do this? > > > > > > On Dec 1, 2:41 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > > > > I'm trying to populate a create a bitmap from something other than > > > > > > an > > > > > > RGBA int array. > > > > > > However, the Bitmap creation overloads only take int arrays as > > > > > > inputs. > > > > > > > In particular, I have a byte buffer that is in the R5G6B5 format > > > > > > that > > > > > > I want to load directly into a bitmap. The format is supposedly > > > > > > supported internally, but I can't figure out how to create the > > > > > > bitmap > > > > > > without doing the R5G6B5 to A8R8G8B8 conversion first. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Loading a bitmap from a byte buffer
Also, the Bitmap class internally (in the C++ JNI atleast) supports the all familiar lockPixels and unlockPixels methods, which allows direct access to the byte buffer. I would suggest extending the Java API to include those methods. On Dec 2, 1:00 am, Koush <[EMAIL PROTECTED]> wrote: > Dianne Hackborn: I am asking this in the context of how to create a > screenshot application. Taking screenshots is not possible on the G1 > anyways, because reading from /dev/graphics/fb0 is only available to > root and shell and not available to actual applications. Thus is only > works on hacked phones. So you're asking me to not do something, when > I'm well past the line of things I should not be doing. :) > Incidentally, the inability to take a simple screenshot of what is on > your phone is a pretty significant oversight (you're not going to > always be hooked up to a PC with the SDK/DDMS tool at your disposal). > > John Spurlock: Decode byte array is for compressed byte arrays, such > as PNGs and JPG. > I am basically trying to copy directly into the pixel buffer. > > On Dec 1, 3:34 pm, John Spurlock <[EMAIL PROTECTED]> wrote: > > > BitmapFactory.decodeByteArray ? > > >http://code.google.com/android/reference/android/graphics/BitmapFacto... > > > On Dec 1, 5:58 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > I inspected Bitmap.cpp and found this function: > > > > static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, > > > const SkBitmap* bitmap, > > > jboolean isMutable, jobject > > > parcel) { > > > if (parcel == NULL) { > > > SkDebugf("--- writeToParcel null parcel\n"); > > > return false; > > > } > > > > android::Parcel* p = android::parcelForJavaObject(env, parcel); > > > > p->writeInt32(isMutable); > > > p->writeInt32(bitmap->config()); > > > p->writeInt32(bitmap->width()); > > > p->writeInt32(bitmap->height()); > > > p->writeInt32(bitmap->rowBytes()); > > > > if (bitmap->getConfig() == SkBitmap::kIndex8_Config) { > > > SkColorTable* ctable = bitmap->getColorTable(); > > > if (ctable != NULL) { > > > int count = ctable->count(); > > > p->writeInt32(count); > > > memcpy(p->writeInplace(count * sizeof(SkPMColor)), > > > ctable->lockColors(), count * sizeof(SkPMColor)); > > > ctable->unlockColors(false); > > > } else { > > > p->writeInt32(0); // indicate no ctable > > > } > > > } > > > > size_t size = bitmap->getSize(); > > > bitmap->lockPixels(); > > > memcpy(p->writeInplace(size), bitmap->getPixels(), size); > > > bitmap->unlockPixels(); > > > return true; > > > > } > > > > I can manually marshal a Bitmap parcel in the proper format, and then > > > append the custom byte buffer, and then use createFromParcel to create > > > a bitmap. That gets me indirect access to creating a bitmap directly > > > from a byte buffer. It's a bit of a hack obviously, and not ideal. Is > > > there a better way to do this? > > > > On Dec 1, 2:41 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > > I'm trying to populate a create a bitmap from something other than an > > > > RGBA int array. > > > > However, the Bitmap creation overloads only take int arrays as inputs. > > > > > In particular, I have a byte buffer that is in the R5G6B5 format that > > > > I want to load directly into a bitmap. The format is supposedly > > > > supported internally, but I can't figure out how to create the bitmap > > > > without doing the R5G6B5 to A8R8G8B8 conversion first. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Loading a bitmap from a byte buffer
{ SkImageDecoder_GIF_Factory, SkImageDecoder::kGIF_Format }, { SkImageDecoder_PNG_Factory, SkImageDecoder::kPNG_Format }, { SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format }, { SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format }, { SkImageDecoder_BMP_Factory, SkImageDecoder::kBMP_Format }, // jpeg must be last, as it doesn't have a good sniffer yet { SkImageDecoder_JPEG_Factory, SkImageDecoder::kJPEG_Format } That's the list of formats supported by SKImageDecoder. Another possible solution is to dummy up a BMP header (pretty trivial) and then decode the bytes. But that is still a hack... On Dec 2, 1:15 am, Christine <[EMAIL PROTECTED]> wrote: > As John says, why don't you use BitmapFactory.decodeByteArray? > > On Dec 2, 10:03 am, Koush <[EMAIL PROTECTED]> wrote: > > > Also, the Bitmap class internally (in the C++ JNI atleast) supports > > the all familiar lockPixels and unlockPixels methods, which allows > > direct access to the byte buffer. I would suggest extending the Java > > API to include those methods. > > > On Dec 2, 1:00 am, Koush <[EMAIL PROTECTED]> wrote: > > > > Dianne Hackborn: I am asking this in the context of how to create a > > > screenshot application. Taking screenshots is not possible on the G1 > > > anyways, because reading from /dev/graphics/fb0 is only available to > > > root and shell and not available to actual applications. Thus is only > > > works on hacked phones. So you're asking me to not do something, when > > > I'm well past the line of things I should not be doing. :) > > > Incidentally, the inability to take a simple screenshot of what is on > > > your phone is a pretty significant oversight (you're not going to > > > always be hooked up to a PC with the SDK/DDMS tool at your disposal). > > > > John Spurlock: Decode byte array is for compressed byte arrays, such > > > as PNGs and JPG. > > > I am basically trying to copy directly into the pixel buffer. > > > > On Dec 1, 3:34 pm, John Spurlock <[EMAIL PROTECTED]> wrote: > > > > > BitmapFactory.decodeByteArray ? > > > > >http://code.google.com/android/reference/android/graphics/BitmapFacto... > > > > > On Dec 1, 5:58 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > > > I inspected Bitmap.cpp and found this function: > > > > > > static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, > > > > > const SkBitmap* bitmap, > > > > > jboolean isMutable, jobject > > > > > parcel) { > > > > > if (parcel == NULL) { > > > > > SkDebugf("--- writeToParcel null parcel\n"); > > > > > return false; > > > > > } > > > > > > android::Parcel* p = android::parcelForJavaObject(env, parcel); > > > > > > p->writeInt32(isMutable); > > > > > p->writeInt32(bitmap->config()); > > > > > p->writeInt32(bitmap->width()); > > > > > p->writeInt32(bitmap->height()); > > > > > p->writeInt32(bitmap->rowBytes()); > > > > > > if (bitmap->getConfig() == SkBitmap::kIndex8_Config) { > > > > > SkColorTable* ctable = bitmap->getColorTable(); > > > > > if (ctable != NULL) { > > > > > int count = ctable->count(); > > > > > p->writeInt32(count); > > > > > memcpy(p->writeInplace(count * sizeof(SkPMColor)), > > > > > ctable->lockColors(), count * sizeof(SkPMColor)); > > > > > ctable->unlockColors(false); > > > > > } else { > > > > > p->writeInt32(0); // indicate no ctable > > > > > } > > > > > } > > > > > > size_t size = bitmap->getSize(); > > > > > bitmap->lockPixels(); > > > > > memcpy(p->writeInplace(size), bitmap->getPixels(), size); > > > > > bitmap->unlockPixels(); > > > > > return true; > > > > > > } > > > > > > I can manually marshal a Bitmap parcel in the proper format, and then > > > > > append the custom byte buffer, and then use createFromParcel to create > > > > > a bitmap. That gets me indirect access to creating a bitmap directly > > >
[android-developers] Re: Loading a bitmap from a byte buffer
Dianne Hackborn: I am asking this in the context of how to create a screenshot application. Taking screenshots is not possible on the G1 anyways, because reading from /dev/graphics/fb0 is only available to root and shell and not available to actual applications. Thus is only works on hacked phones. So you're asking me to not do something, when I'm well past the line of things I should not be doing. :) Incidentally, the inability to take a simple screenshot of what is on your phone is a pretty significant oversight (you're not going to always be hooked up to a PC with the SDK/DDMS tool at your disposal). John Spurlock: Decode byte array is for compressed byte arrays, such as PNGs and JPG. I am basically trying to copy directly into the pixel buffer. On Dec 1, 3:34 pm, John Spurlock <[EMAIL PROTECTED]> wrote: > BitmapFactory.decodeByteArray ? > > http://code.google.com/android/reference/android/graphics/BitmapFacto... > > On Dec 1, 5:58 pm, Koush <[EMAIL PROTECTED]> wrote: > > > I inspected Bitmap.cpp and found this function: > > > static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, > > const SkBitmap* bitmap, > > jboolean isMutable, jobject > > parcel) { > > if (parcel == NULL) { > > SkDebugf("--- writeToParcel null parcel\n"); > > return false; > > } > > > android::Parcel* p = android::parcelForJavaObject(env, parcel); > > > p->writeInt32(isMutable); > > p->writeInt32(bitmap->config()); > > p->writeInt32(bitmap->width()); > > p->writeInt32(bitmap->height()); > > p->writeInt32(bitmap->rowBytes()); > > > if (bitmap->getConfig() == SkBitmap::kIndex8_Config) { > > SkColorTable* ctable = bitmap->getColorTable(); > > if (ctable != NULL) { > > int count = ctable->count(); > > p->writeInt32(count); > > memcpy(p->writeInplace(count * sizeof(SkPMColor)), > > ctable->lockColors(), count * sizeof(SkPMColor)); > > ctable->unlockColors(false); > > } else { > > p->writeInt32(0); // indicate no ctable > > } > > } > > > size_t size = bitmap->getSize(); > > bitmap->lockPixels(); > > memcpy(p->writeInplace(size), bitmap->getPixels(), size); > > bitmap->unlockPixels(); > > return true; > > > } > > > I can manually marshal a Bitmap parcel in the proper format, and then > > append the custom byte buffer, and then use createFromParcel to create > > a bitmap. That gets me indirect access to creating a bitmap directly > > from a byte buffer. It's a bit of a hack obviously, and not ideal. Is > > there a better way to do this? > > > On Dec 1, 2:41 pm, Koush <[EMAIL PROTECTED]> wrote: > > > > I'm trying to populate a create a bitmap from something other than an > > > RGBA int array. > > > However, the Bitmap creation overloads only take int arrays as inputs. > > > > In particular, I have a byte buffer that is in the R5G6B5 format that > > > I want to load directly into a bitmap. The format is supposedly > > > supported internally, but I can't figure out how to create the bitmap > > > without doing the R5G6B5 to A8R8G8B8 conversion first. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Iptables
You won't be able to get iptables onto an actual phone unless it is rooted. Incidentally, iptables has already been cross compiled. It's actually being used on rooted phones to make them serve as wireless routers. See this thread: http://forum.xda-developers.com/showthread.php?t=444004 On Dec 3, 8:32 am, fred <[EMAIL PROTECTED]> wrote: > Hi, > ls is a binary that's there on default Android install, but iptables > is not. > In order for your app to work, you should make sure that : > a) Iptables support is built in the kernel > b) There is an iptables binary in the system. > > For this, you'll most probably need to configure a toolchain and cross- > compile C code. > More information can be found on the android-platform list. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Compass X & Y inverted on G1 phone?
That actually sounds like it is working properly. On the G1 accelerometer, (and all other HTC devices), the positive Z axis is face up, the positive X axis is from the center of the screen to the right, and the positive y axis is from the center of the screen to the mouthpiece. Hence, if you are pointing the display with the earpiece to the north, I would expect to see a negative Y value. I actually wrote a Sensor API for the Windows Mobile line of phones, and one of the things I needed to do with the HTC implementation of their sensor vector was to reverse the Y axis so that positive Y points is in the direction of the earpiece. http://www.koushikdutta.com/2008/07/using-htc-touch-diamond-sensor-sdk-from.html On Dec 3, 7:05 am, Jean-Baptiste Queru <[EMAIL PROTECTED]> wrote: > There are quite a few significant issues with the sensor API as it > currently exists in the G1, where many aspects were too loosely > defined, and where there are a few bugs. > > A later version of the Android API is expected to resolve those issues > (and to provide backward-compatibility with the current API). > > At this point your best bet is to modify your code based on what you > see on the device until it does what you expect. I realize that's a > sad recommendation, but it's pretty much the only realistic one. > > JBQ > > On Wed, Dec 3, 2008 at 7:00 AM, Ian <[EMAIL PROTECTED]> wrote: > > > I'm trying to make sense of the SENSOR_MAGNETIC_FIELD sensor values on > > the G1 phone. It looks to me like the X and Y values are pointing to > > magnetic south, while the Z value is pointing north. In other words, > > if I hold the phone with the earpiece end pointing north, I get a > > negative Y value; if I hold it with the face of the display pointing > > north, I get a positive Z value. > > > Looking at the accelerometer X, Y and Z values, they behave as I > > expect. > > > Is anyone else seeing this, or am I missing something? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Compass X & Y inverted on G1 phone?
Ahh, you are right, HTC has it reversed. The Y value needs to be negated for both the accelerometer and compass to align with the documentation: A constant describing an accelerometer. Sensor values are acceleration in the X, Y and Z axis, where the X axis has positive direction toward the right side of the device, the Y axis has positive direction toward the top of the device and the Z axis has positive direction toward the front of the device. The direction of the force of gravity is indicated by acceleration values in the X, Y and Z axes. The typical case where the device is flat relative to the surface of the Earth appears as -STANDARD_GRAVITY in the Z axis and X and Z values close to zero. Acceleration values are given in SI units (m/s^2) On Dec 3, 10:44 am, Koush <[EMAIL PROTECTED]> wrote: > That actually sounds like it is working properly. > > On the G1 accelerometer, (and all other HTC devices), the positive Z > axis is face up, the positive X axis is from the center of the screen > to the right, and the positive y axis is from the center of the screen > to the mouthpiece. > > Hence, if you are pointing the display with the earpiece to the north, > I would expect to see a negative Y value. > > I actually wrote a Sensor API for the Windows Mobile line of phones, > and one of the things I needed to do with the HTC implementation of > their sensor vector was to reverse the Y axis so that positive Y > points is in the direction of the earpiece. > > http://www.koushikdutta.com/2008/07/using-htc-touch-diamond-sensor-sd... > > On Dec 3, 7:05 am, Jean-Baptiste Queru <[EMAIL PROTECTED]> wrote: > > > There are quite a few significant issues with the sensor API as it > > currently exists in the G1, where many aspects were too loosely > > defined, and where there are a few bugs. > > > A later version of the Android API is expected to resolve those issues > > (and to provide backward-compatibility with the current API). > > > At this point your best bet is to modify your code based on what you > > see on the device until it does what you expect. I realize that's a > > sad recommendation, but it's pretty much the only realistic one. > > > JBQ > > > On Wed, Dec 3, 2008 at 7:00 AM, Ian <[EMAIL PROTECTED]> wrote: > > > > I'm trying to make sense of the SENSOR_MAGNETIC_FIELD sensor values on > > > the G1 phone. It looks to me like the X and Y values are pointing to > > > magnetic south, while the Z value is pointing north. In other words, > > > if I hold the phone with the earpiece end pointing north, I get a > > > negative Y value; if I hold it with the face of the display pointing > > > north, I get a positive Z value. > > > > Looking at the accelerometer X, Y and Z values, they behave as I > > > expect. > > > > Is anyone else seeing this, or am I missing something? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Using Google Gears inside a web view
Hi, I am trying to use a Google Gears enabled site in Android's WebView, but it fails, saying Gears is not installed. For example, my test application sets up a WebView and loadUrls: http://code.google.com/apis/gears/samples/hello_world_geolocation.html and I see a "Gears is not installed" message. The WebSettings on the WebView has JavaScript and Plugins enabled. WebView.getPluginList is empty. import java.util.List; import android.app.Activity; import android.graphics.Path; import android.graphics.drawable.GradientDrawable.Orientation; import android.os.Bundle; import android.webkit.Plugin; import android.webkit.PluginList; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.LinearLayout; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setPluginsEnabled(true); webView.refreshPlugins(true); PluginList pluginList = webView.getPluginList(); List list = pluginList.getList(); for(int i = 0; i < list.size(); i++) { Plugin plugin = (Plugin)list.get(i); } webView.loadUrl("http://code.google.com/apis/gears/samples/ hello_world_geolocation.html"); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); Button button = new Button(this); layout.addView(button); layout.addView(webView); setContentView(layout); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Using Google Gears in a WebView
Does anyone know how to set Google Gears up to work properly in a WebView? The following fails with the error "Gears is not installed" on the web page. public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setPluginsEnabled(true); //webView.loadUrl("http://code.google.com/apis/gears/samples/ hello_world_database.html"); webView.loadUrl("http://code.google.com/apis/gears/samples/ hello_world_geolocation.html"); //webView.loadUrl("http://www.google.com";); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); Button button = new Button(this); layout.addView(button); layout.addView(webView); setContentView(layout); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] issues with system.img created from the android source
Hi all, I'm successfully able to build the android source code. However, the emulator does not seem to be able to access the internet (but the stock emulator image can). I am launching the emulator with the following parameters while in the out/target/product/generic directory of the source root: emulator -image system.img -ramdisk ramdisk.img -data userdata.img - kernel ../../../../prebuilt/android-arm/kernel/kernel-qemu. Am I missing an argument or some built parameter to enable networking on the built output image? Thanks, Koush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Dalvik and BOOTCLASSPATH
>From adb shell on the emulator, I am prepend the BOOTCLASSPATH to include a jar that contains an implementation of android.widget.EditText. Then from ADB, I launch an activity using the "am" tool. However, "am" is failing to launch at all with the following errors in logcat. Any ideas on how to successfully tweak the BOOTCLASSPATH in Dalvik/Android? D/AndroidRuntime( 186): >> AndroidRuntime START << D/AndroidRuntime( 186): CheckJNI is ON W/dalvikvm( 186): DexOpt: incorrect opt magic number (0xff ff ff ff) D/dalvikvm( 186): Stale deps in cache file; removing and retrying D/dalvikvm( 186): DexOpt: --- BEGIN 'koushikdutta.testboot.jar' (bootstrap=1) - -- E/dalvikvm( 187): Too many exceptions during init (failed on 'Ljava/ lang/NoClas sDefFoundError;' 'java.lang.NoClassDefFoundError') E/dalvikvm( 187): VM aborting I/DEBUG ( 21): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** * ** I/DEBUG ( 21): Build fingerprint: 'generic/generic/generic/: 1.0/110632/11063 2:sdk/test-keys' I/DEBUG ( 21): pid: 187, tid: 187 >>> /system/bin/dexopt <<< I/DEBUG ( 21): signal 11 (SIGSEGV), fault addr deadd00d I/DEBUG ( 21): r0 0320 r1 000c r2 000c r3 0026 I/DEBUG ( 21): r4 deadd00d r5 000124a8 r6 ad06a54c r7 I/DEBUG ( 21): r8 r9 10 fp I/DEBUG ( 21): ip ad07eed4 sp bec278d8 lr afe1238d pc ad039132 cpsr 200 00030 I/DEBUG ( 21): #00 pc ad039132 /system/lib/libdvm.so I/DEBUG ( 21): #01 pc ad03890e /system/lib/libdvm.so I/DEBUG ( 21): #02 pc ad038b6a /system/lib/libdvm.so I/DEBUG ( 21): #03 pc ad059684 /system/lib/libdvm.so I/DEBUG ( 21): #04 pc ad0598b2 /system/lib/libdvm.so I/DEBUG ( 21): #05 pc ad059cf8 /system/lib/libdvm.so I/DEBUG ( 21): #06 pc ad038914 /system/lib/libdvm.so I/DEBUG ( 21): #07 pc ad038b6a /system/lib/libdvm.so I/DEBUG ( 21): #08 pc ad059684 /system/lib/libdvm.so I/DEBUG ( 21): #09 pc ad0598b2 /system/lib/libdvm.so I/DEBUG ( 21): #10 pc ad059cf8 /system/lib/libdvm.so I/DEBUG ( 21): #11 pc ad04f134 /system/lib/libdvm.so I/DEBUG ( 21): #12 pc ad050460 /system/lib/libdvm.so I/DEBUG ( 21): #13 pc ad05061a /system/lib/libdvm.so I/DEBUG ( 21): #14 pc 8dd6 /system/bin/dexopt I/DEBUG ( 21): #15 pc 8e92 /system/bin/dexopt I/DEBUG ( 21): #16 pc afe1dbd2 /system/lib/libc.so I/DEBUG ( 21): #17 pc afe0b010 /system/lib/libc.so I/DEBUG ( 21): #18 pc bd70 /system/bin/linker I/DEBUG ( 21): stack: I/DEBUG ( 21): bec27898 ad07edf8 I/DEBUG ( 21): bec2789c I/DEBUG ( 21): bec278a0 afe35f3c I/DEBUG ( 21): bec278a4 afe35f90 I/DEBUG ( 21): bec278a8 I/DEBUG ( 21): bec278ac afe1238d /system/lib/libc.so I/DEBUG ( 21): bec278b0 000124a8 [heap] I/DEBUG ( 21): bec278b4 afe11539 /system/lib/libc.so I/DEBUG ( 21): bec278b8 000124a8 [heap] I/DEBUG ( 21): bec278bc ad07edf8 I/DEBUG ( 21): bec278c0 000124a8 [heap] I/DEBUG ( 21): bec278c4 ad06a54c /system/lib/libdvm.so I/DEBUG ( 21): bec278c8 I/DEBUG ( 21): bec278cc afe1159d /system/lib/libc.so I/DEBUG ( 21): bec278d0 df002777 I/DEBUG ( 21): bec278d4 e3a070ad I/DEBUG ( 21): #00 bec278d8 ad07edf8 I/DEBUG ( 21): bec278dc ad038911 /system/lib/libdvm.so I/DEBUG ( 21): #01 bec278e0 000124a8 [heap] I/DEBUG ( 21): bec278e4 ad06a54d /system/lib/libdvm.so I/DEBUG ( 21): bec278e8 ad06a54c /system/lib/libdvm.so I/DEBUG ( 21): bec278ec 000124a8 [heap] I/DEBUG ( 21): bec278f0 ad06a54c /system/lib/libdvm.so I/DEBUG ( 21): bec278f4 I/DEBUG ( 21): bec278f8 ad06a54c /system/lib/libdvm.so I/DEBUG ( 21): bec278fc ad038b6d /system/lib/libdvm.so W/dalvikvm( 186): DexOpt: --- END 'koushikdutta.testboot.jar' --- status=0x000b , process failed E/dalvikvm( 186): Unable to extract+optimize DEX from '/system/ framework/koushi kdutta.testboot.jar' D/dalvikvm( 186): Failed on '/system/framework/ koushikdutta.testboot.jar' (boot =1) D/dalvikvm( 186): VM cleaning up D/dalvikvm( 186): LinearAlloc 0x0 used 4100 of 4194304 (0%) W/dalvikvm( 186): JNI_CreateJavaVM failed E/AndroidRuntime( 186): JNI_CreateJavaVM failed --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~---
[android-developers] Re: Dalvik and BOOTCLASSPATH
Yes, I ran the jar through dx. On Nov 14, 5:39 pm, shyamal <[EMAIL PROTECTED]> wrote: > I don't know about the BOOTCLASSPATH, but did actually run the jar > through dx --dex etc? > > On Nov 14, 1:37 pm, Koush <[EMAIL PROTECTED]> wrote: > > > From adb shell on the emulator, I am prepend the BOOTCLASSPATH to > > include a jar that contains an implementation of > > android.widget.EditText. > > > Then from ADB, I launch an activity using the "am" tool. > > > However, "am" is failing to launch at all with the following errors in > > logcat. Any ideas on how to successfully tweak the BOOTCLASSPATH in > > Dalvik/Android? > > > D/AndroidRuntime( 186): >>>>>>>>>>>>>> AndroidRuntime START > > <<<<<<<<<<<<<< > > D/AndroidRuntime( 186): CheckJNI is ON > > W/dalvikvm( 186): DexOpt: incorrect opt magic number (0xff ff ff ff) > > D/dalvikvm( 186): Stale deps in cache file; removing and retrying > > D/dalvikvm( 186): DexOpt: --- BEGIN > > 'koushikdutta.testboot.jar' (bootstrap=1) - > > -- > > E/dalvikvm( 187): Too many exceptions during init (failed on 'Ljava/ > > lang/NoClas > > sDefFoundError;' 'java.lang.NoClassDefFoundError') > > E/dalvikvm( 187): VM aborting > > I/DEBUG ( 21): *** *** *** *** *** *** *** *** *** *** *** *** *** > > *** *** * --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to debug G1 on Vista 64
There is now a 64 bit version of the drivers. http://www.koushikdutta.com/2008/11/android-debug-bridge-x64-windows.html On Nov 14, 6:05 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > Robert Green wrote: > > Anyone?? > > I am not aware of a 64-bit Vista driver for the G1, though I'm not a > Vista user and so haven't exactly kept an eye out for one. > > >> is there any workaround I can do short of running VMWare or dual booting? > > You could boot a live Linux CD. > > You could switch your logging to put the data somewhere that you can > read it without a working driver (e.g., put it on the /sdcard, then read > that card using another Vista-compatible card reader). > > You could switch your logging to keep the data in memory, then add an > Easter egg activity to your app that pops up the log for your perusal. > > There's probably other tricks as well, but those are the ones that pop > to mind. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dalvik and BOOTCLASSPATH
Ahh, I see. Thanks for the heads up on that documentation. I had looked at the dexopt source and it looked like that libraries in the boot class path were restricted to being in dependency order... so that basically shoots down my idea of overriding class loading. On Nov 16, 10:26 pm, fadden <[EMAIL PROTECTED]> wrote: > On Nov 14, 1:37 pm, Koush <[EMAIL PROTECTED]> wrote: > > > From adb shell on the emulator, I am prepend theBOOTCLASSPATHto > > include a jar that contains an implementation of > > android.widget.EditText. > > This won't work. Generally speaking, it's not a good idea to try to > change the bootstrap class path. > > For a full explanation, see dalvik/docs/dexopt.html in the open source > tree. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Dalvik and BOOTCLASSPATH
Also, I've tried just pushing a vanilla framework.jar and framework- apk.jar (as built from the source) to the emulator. This didn't work at first. I found that it was looking for EGLImpl, and then pushed lib/ libandroid_runtime.so to the phone to fix it, and though it worked, most of the applications would continue crashing? Any reason that updating all or any of the files on the emulator would keep it from running properly? I've also tried running the emulator off the resultant system.img, but that image is doesn't seem to have internet access. On Nov 16, 10:26 pm, fadden <[EMAIL PROTECTED]> wrote: > On Nov 14, 1:37 pm, Koush <[EMAIL PROTECTED]> wrote: > > > From adb shell on the emulator, I am prepend theBOOTCLASSPATHto > > include a jar that contains an implementation of > > android.widget.EditText. > > This won't work. Generally speaking, it's not a good idea to try to > change the bootstrap class path. > > For a full explanation, see dalvik/docs/dexopt.html in the open source > tree. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Interfacing with AndNav (via Intent-Broadcast)
Why did you implement it as a broadcast? On Nov 25, 12:35 pm, plusminus <[EMAIL PROTECTED]> wrote: > Hello Developers, > > I want to introduce the nice and small AndNav-API to you all. With a > tiny snippet you can make any application use the full navigation > capabilities of AndNav2 and or AndNav1. This API can be useful for any > application, especially all kinds of Piggyback- or FriendFinder- > Applications! > > See sample code > here:http://www.andnav.org/index.php/component/content/article/30-the-comm... > > API-Talk:http://www.andnav.org/index.php/community-forum?task=viewforum&id=8 > > We are open to all suggestions! > > Best Regards, > Nicolas & Pascal > #http://www.andnav.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Android Developer Console and the Market - Several Issues
The Android Developer Console doesn't allow me to unpublish my previously published applications. I thought it may be a browser/ javascript issue, but I tried several browsers with no luck. In addition, the applications I've published that are not free do not show up on the Market. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---