android

Problem creating a Drawable from a SQLite Blob

I'm caching image files as a blob in a SQLite database. I have a similar application on another platform that does the same thing with the same image files. The databases on both platforms report the exact same size for the same images. So I think, but can't guarantee, that the image data is getting into the database intact. But when...

does android sdk give any convenience methods for converting Shape to Path?

the Canvas class does not take Shape as a parameter for any of its methods. There is no drawShape or clipShape, etc... So, I need to use Path instead. Does android sdk expose any way to convert Shape to Path or Path to shape? I haven't been able to find relationship any between the 2 classes...? Thank you ...

getCurrentPosition on a G1

I have the following code on a website being developed for mobile browsers. For some reason, the G1 phone doesn't run the getCurrentPosition (neither the foundLocation nor the noLocation). Does anyone have any idea why??? I tried to paste it in here, but it got all messed up. here it is on Pastie: http://pastie.org/1104458 ...

Android Communicate with a Location Manager started from another activity

Hi all, In my app I want to obtain a gps lock and record the coords. But I do not want to lock the device into looking for the gps. The user is to be free to traverse through the app and the different activities within. So If I call a locationListener in activity A, can I reference it in activities B C and D? if is was still in activ...

Check for specific column in Android SQLite database

I am trying to check if there is a specific column in my database when onUpgrade() gets called. Is there an easy way to check like if(database does not have specific column){ db.execSQL("ALTER TABLE table" + " ADD COLUMN column" ); } I saw some other answer, Pragma Table, but I don't know how to use it or even what it really is for. ...

How to get images from gallery and display them to the screen in android sdk

I would like to know how to get a pre-saved image from the gallery and then display it onto the screen. Any tutorials/helpful links and info would be appreciated. If there is anything you would like me to explain more, please ask. ...

Seekbar width in a custom preference

Hi, I'm trying to code a preferences widget to set a value with a SeekBar. This includes a Title, Summary, Seekbar and a TextView to show current value. All of them but Title should be shown in a second row (as standard preferences). I can't make it work. I first tried with a RelativeLayout but BELOW, etc. rules where not applied.Then ...

Android - Activity Not Found Exception

I am using startActivity to call another Activity and I get the "Activity Not Found Exception". Here is my code: TextView textView = (TextView) itemClicked; String strText = textView.getText().toString(); String key = "symptom"; Intent mIntent = new Intent(symptomActivity.this, symptomRemedyActivity.class); Bundle mBundle = n...

Adding MP3 to ContentProvider

I'm trying to use an Mp3 on the SDCard as a ringtone. I'm basing my code off various snippets/tutorials online, but none seem to be working. I'm running FroYo. This is my code: Uri uri = MediaStore.Audio.Media.getContentUriForPath(file.getAbsolutePath()); ContentValues values = new ContentValues(); values.put(MediaStore.Me...

How to determine if a view is visible in a ListView?

I want to be able to tell if a view is visible in my listview, which is populated by a custom CursorAdapter. How can I do this? ...

Pass this object into event handler

Hi, I got the code below how do I pass the current object "this" into the event handler so that I can pass it to the object Foo: btn.setOnClickListener(new View.OnClickListener(this) { public void onClick(View view) { new Foo(this).AlertBox("Hello Lennie!"); } }); Where "this" is: android.app.Activity i get an error that it can't ...

Canvas.DrawCircle VS ShapeDrawable.setBounds()

Hello What is a more efficient methods for drawing circles on a canvas. I can do it two ways: 1) Use canvas.drawcircle(...) 2) ShapeDrawable.SetBounds() followed by ShapeDrawable.draw(canvas) what renders faster? What's better practice? Or does it not matter? ...

How to add multiple widgets to one application?

I have developed a widget that has certain functionality, but some people have asked me to create a similar widget but with a slight different functionality. Both widgets will look the same but behave slightly different. I tried adding a different receiver for the second widget to my manifest file. I also created a separate widget provid...

Table Layout baffle

I'm wrestling with the Android UI to try to create a table layout that has two rows with two buttons in each row. I want the buttons to each take up 50% of the space in the row. However, no matter what I set the layout_width and layout_height to, I always get two skinny buttons in each row. <?xml version="1.0" encoding="utf-8"?> <Linear...

While in Safe-Mode user should not have any access to application.

When emulator is running is safe mode, my application is not visible to user but On HTC-G1 run in safe mode , its visible to the user. How can I keep the app invisible on device also while its runing in safe mode. ...

Hit testing on a MapView, Android

Hi, I hava a MapView and I define a Rect. Touching the map I compare the coordinates to detect whether the rect is touched or not. But it does not work RectF hitTestRecr = new RectF(); hitTestRecr.set(0,100,0,100); hitTestRecr.offset(0,0); if (hitTestRecr.contains(event.getX(),event.getY())) { Toast.makeText(getBaseContext(), "hit...

NullPointerException while working with Android development in Eclipse.

Hi, I'm just getting started with Android app development on a Mac, and I keep getting a NullPointerException everytime I go into Strings.xml to edit it. Here's the steps I followed - Downloaded eclipse 3.5 Installed the Android SDK Downloaded SDKs from Android SDK manager. Created a basic Hello World Project. The project compiles ...

Monitor performance of Module

Hi, I have written a module. I wanted to test the run-time performance of the module (processor and other resource utilization) on various platforms, like on a Netbook, Laptop, Android Mobile Phone etc. I would like to monitor the performance of only the thread that is running my module and not the overall resource/processor utilizati...

MediaPlayer.setDataSource() and prepare() not working - android

I'm having a crack at using the MediaPlayer object and not having much success. If I add a sound asset to my raw folder and call it using the int value within R, it works fine. But I want to be able to pull things off of url. According to all of the documentation I've read setDataSource() should accept a string param with a url to a f...

Serialization problem with Enums at Android

I'm using XStream to serialize some objects to XML, and am facing a problem with Enums. The exception I get when I try to serialize the object: "ObjectAccessException: invalid final field java.lang.Enum.name". Apparently, this is a problem with the reflection API implementation in android: It doesn't treat final fields correctly. This p...