The following code does not give the expected results:
prefInputStream =
getResources().openRawResource(R.xml.preferences);
byte[] rawBytes = new byte[100];
prefInputStream.read( rawBytes, 0, 100 );
The bytes read are not printable ASCII characters.
Yeah, that's messy, but it will probably work. One other consideration
is what the next version of Android will do about this. It's pretty
clear that this is an important missing feature. I expect they'll
eventually make a version of getXXX that reads the default value from
preferences.xml if there
My application is somewhat complex and has lots of settable
preferences. Fortunately for the user, there are sensible defaults
that I can pre-configure. The SharedPreferences infrastructure
includes defaults in preferences.xml, which I have set accordingly.
The trouble is that if the user has never
The keystore is in the .android folder but it does not show in the
Export Wizard. I can see keystores that were created by the wizard but
can't see any that are built with the keytool. There must be some
import step to tell Eclipse about a new key. Something beyond just
dropping the keystore into t
I've created a new keystore using keytool and placed it in the Users/
MyName/.android folder. However, when I start the Eclipse Export
Wizard, it only shows my old debug keystore. How do I get Eclipse to
know about a new keystore? Also, once I have a second keystore, how do
I tell the debugger that
That's a fair point. I wasn't planning to generate a production key
until I was ready to publish but there's no harm in doing it now. On
careful reading of this:
http://developer.android.com/guide/publishing/app-signing.html#cert
there is a sentence that goes "You can not publish an application th
Except I don't have a production/release signing key yet. I've only
ever generated the debug key, which I also used to generate the maps
API key. I'm using the Export wizard in Eclipse with the "sign the
package" box checked and my debug key chosen.
I shouldn't be able to even install an unsigned
Yes, I mean from within Eclipse. I signed the package with my debug
key, which is also the key I used when I got the Maps API key. My
manifest has INTERNET permissions and anyway a permission violation
would show in the logcat. The device has connectivity, since it works
when I download from within
If I run my application on a physical phone from within the SDK then
the Google MapView works perfectly. If I export to an apk file and
install it to the same phone from the command line (adb install path/
filename.apk) then the MapView shows the Google logo and the grid, but
no map. Any ideas what
The essence of a beginner list is that you can ask stupid questions
without people acting like you are wasting their precious computer
cycles. From that perspective, this list is quite useful. Nobody acts
impatient or patronizing, no matter how elementary the question. I'll
miss this list too.
> B
> Now that wireless companies are moving to metered data plans, I would be
> very annoyed if I found that the initial install of an app required a
> network connection to download an undetermined amount of data. If anyone
> does this, they should make sure that they tell the user how much data
> is
I'd like to access S3 storage from an Android application. Amazon
provides a Java SDK (http://aws.amazon.com/sdkforjava/), but I suspect
it's too heavy for mobile apps. Is there something a little lighter
that I could use just to access S3 buckets and not the entire AWS
suite?
--
You received thi
Ben,
I agree with you about the crying need. From a product roadmap point
of view, this is a really obvious value for many developers. But I
wouldn't jump to a solution too quickly. I've been thinking about the
problem for a few days now and my opinion is that initial load data
should come from an
Yeah, I thought about that. The two app solution is certainly clunky,
though, especially when it's such a common problem. I think an S3
connection would be easier to implement, and certainly easier for the
user.
> I've seen several dictionary apps that include the data in an app that
> you downlo
The really interesting apps are those that combine two or more
sensors. How about using the accelerometer along with GPS to measure
how many calories someone burns jogging or walking? The GPS can give
you distance and the acceleration values can be filtered to detect
gait or number of steps. If the
I currently have a flat file in my assets directory that I read into
SQLite the first time I need something from the appropriate table.
That works OK, but I'm effectively doubling the space required for
that data and it's a lot of data.
I'd like to recover that space. I did some searching and this
That did it. It's working great. Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send
Well, you see, that's the thing. What I really want is a MapView
embedded in a larger Activity where one half the screen is a
(smallish) map and the other is an address and other details about the
particular location of a marker on the map. Think of how the pushpins
work in Yelp when you mouse over
That did it! Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
android-beg
I'm getting an inflator exception when I place a MapView inside a
LinearLayout. My test xml looks like this:
http://schemas.android.com/apk/res/android";>
http://schemas.android.com/apk/res/android";
android:id="@+id/eventDetailsMapView"
android:layout_width="fill_parent"
android:layo
My list preference code is shown below. The list of values has 7
choices and I'm setting the default value in one case to 2 (3rd item
in list) and the other case to 3 (4th item in list). However, when the
list preference is shown for the first time, none of the choices is
selected. Am I doing somet
It worked!
Now, how do we get this documented so the capability doesn't disappear
in later releases? Ideally, this would become part of the Android
regression tests. Any ideas?
Bret
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try
Mark,
Well, the manifest documentation is pretty sparse so it's not
surprising that it doesn't mention this case. A good example is the
screen of choices that face you when you look at the Application tab
in the manifest editor in Eclipse and click on one of the activities
or services. That calls
I removed the intent filter and still got the FC with the
ActivityNotFoundException. Is there a better way to debug this stuff
rather than trial and error?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your que
I changed the manifest to look as below and it still exits with the
same error.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging
I want to monitor the velocity of a phone. I can do this by looking at
accelerometer data over the last 30 seconds, saving about one sample
every 0.1 seconds (300 samples) and applying a sliding filter to the
data. If I create a service to do this, what's the best way to
preserve the state of the f
I have this in preferences.xml:
And this is the manifest:
The activity code looks like this:
public class AboutShipMateActivity extends Ac
Ah, I see. Cats will be chasing dogs and elected officials will speak
the truth.
Seriously, reading the forums I've seen a lot of people with a similar
issue. They have a bunch of application data that eventually needs to
live in the SQLite database. Google should create an Eclipse plug-in
that al
What happens if I open an OutputStream on a file in the assets folder?
Can I write over it? What happens to the file size if I write less
data than the original size?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and taggi
The map view comes up and draws the grid but no map is drawn on the
N1. It's fine on my Droid.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions
Here's what the logcat looks like. Something going wrong with the
connection factory. Is that a key problem?
I/MapActivity(19968): Handling network change notification:CONNECTED
E/MapActivity(19968): Couldn't get connection factory client
I/ActivityManager(11922): Starting activity: Intent
{ act=a
I'm building/signing my application with a debug key. Likewise, I'm
accessing Google Maps with an API key generated by the debug app key.
Now I've got a couple of beta testers and Google Maps isn't working
for them. Is it time to get a real application key and a new Maps key
or is there another way
Found the problem. I should have learned my lesson by now. When you do
any substantial resource changes, you have to uninstall the app from
all your targets or you end up with a toxic mix of old and new
resources info. Problem solved.
--
You received this message because you are subscribed to the
No, no line break. That's just an artifact of the cut and paste.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscrib
Here's a little more detail from layout-land (fails) and layout
(works) respectivley. The fist button causes a runtime exception in
findViewById, the second works:
FAILS
WORKS
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try ask
I mistyped. The file path is actually res/layout-land. The exception
is happening when I call findViewById for one particular button. I
stared at the two xml files as carefully as I could and the ID of that
button is identical in both files. Other buttons are not causing any
trouble. To add to the
My UI designer has created both a portrait and landscape version of
one of our screens. These have the same IDs for all the widgets but a
different layout as appropriate. One layout is in res/layout and the
other is in res/layout/land. I loaded her res files as described and
now I see a runtime exc
Jake,
At least on my Droid, Android 2.1 keeps the GPS receiver on
continuously whenever there is a registered listener, regardless of
the time/distance update parameters. It's much better to unregister
and re-register the listener when you need an update. Of course, this
might be fixed in Android
Calling the service's stopSelf from the onDestroy method of the parent
activity worked fine. It's fixed.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com
Well, my understanding from the docs is that once a service has the
wake lock cleared and no other services or activities are bound to it
then it should be destroyed in a short time. But it's only a small
change to my application logic to explicitly have the service call its
stopSelf when the main
I'm using the following code inside OnStartCommand of my service:
wakelock =
myPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK ,
getString(R.string.app_name) );
try {
wakelock.acquire();
wakelockAcquired = true;
} catch (Exception e)
I've used about every sensor available on an Android phone and I don't
know of one that would be appropriate for EMR. Here's the current
list:
http://developer.android.com/reference/android/hardware/Sensor.html
Which one are you planning to use?
--
You received this message because you are subs
As for connecting sensors to the phone, your best bet will be USB
based sensors. Almost the entire sensor market has gone over to these
devices because of their easy connection to PCs. The only hitch will
be getting access to the hardware I/O specifications of the sensor so
you can talk to it. Most
Actually, this is not true with my hack. I did a comparison of battery
drain with and without GPS running using 10 second updates and the
difference in drain between off and on was less than 10% on my Droid
phone.
On Jul 23, 8:42 am, cellurl wrote:
> GPS is such a power hog, no way around it. Phy
So let's say the key for that preferences button is "AboutPrefKey".
How do I reference that key? Here's what I mean:
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
switch( featureId ) {
case ??:
startActivit
I have an "About" screen defined in layout/about.xml.
I have a menu inside my default preferences hierarchy with a title
like "Show About". Is there a way to specify in xml/preferences.xml
that about.xml should be shown when the "Show About" menu item is
selected? Any sample xml code around like t
I finally got around to implementing this hack and it works great. The
GPS is on for a few hundred milliseconds out of 10 minutes in my
application, which means no significant GPS power used.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
That did it.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
android-beginners+u
That did it! I was using two different editor objects. I thought it
was static but I see that would never work for concurrent access.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflo
Take a look at QuickBase. You can import your excel data into it and
it's hosted online by Intuit so you will never lose data. That will
make it much easier to manage the data and they have a good REST
interface.
--
You received this message because you are subscribed to the Google
Groups "Androi
It depends on what database you are using on the server. If it's
Oracle, then you could use Oracle's Java JDBC library. This library
allows you to communicate securely over the internet with an Oracle
database just by knowing the IP address of the DB listner and login
credentials for the account. T
I uninstalled and reinstalled the app. The code now looks like this.
commit() is returning true but contains() is returning false and
getInt() is returning someOtherInt. Any ideas?
SharedPreferences myPrefs = PreferenceManager.getDefaultPreferences();
myPrefs.edit().putInt("Some_String",someInt);
My code looks something like this:
SharedPreferences myPrefs = getPreferences(MODE_PRIVATE);
myPrefs.edit().putInt("Some_String",someInt);
myPrefs.edit().commit();
Note that the key/value pair Some_String/someInt does not exist in
preferences.xml and I presume the editor should create it. Perhaps
Mark, you scored again. That worked perfectly. I owe you lunch. Do you
sit in the Bay Area?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/ta
I'm getting a null Intent returned from onActivityResult. A summary of
the code is listed below. Any ideas what I might be doing wrong?
Code in calling Activity:
Intent myIntent = new Intent( Intent.ACTION_VIEW );
myIntent.setClass(this,TheCalledActivity.class);
That worked. Mark, you rock...and after 7pm too!
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this grou
I'm getting an exception when I try to pop up an alert dialog from
within the onOptionsItemSelected method of an Activity. The exception
looks like this:
W/WindowManager( 57): Attempted to add window with non-application
token WindowToken{43c4d3b0 token=null}. Aborting.
I pasted the same code
I notice that several commercial applications have the same problem,
in particular the Yelp app. Maybe I should send them my work-around. :)
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack
Someone else emailed me directly with the same problem. It looks like
this is simply a bug in Android. The work-around should be pretty
simple:
1) Build a periodic Timer with a TimerTask that registers the
listener, say every 10 minutes or whatever frequency is required.
2) Unregister the listener
When I install a GPS update listener with
LocationManager.requestLocationUpdates with the period set to 600
seconds (600,000 milliseconds), the little GPS satellite icon comes on
and stays on until I call LocationManager.removeUpdates.
Is the GPS receiver really turned on full time when there's an
That worked. Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
android-beg
Just bumping this topic. I still haven't figured out how to make this
work. Does anyone know of an example?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.
Didn't work:
setContentView(R.layout.main);
View myView = findViewById( R.layout.main );
myView comes back null. The R.layout.main resource works fine in the
Activity, by the way.
--
You received this message because you are subscribed to the Google
Groups "Andro
After I call setContentView( resID ) in an activity, is there a way to
get the View object associated with the content?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://st
I'm setting my notification like this:
notification.defaults |= Notification.FLAG_NO_CLEAR;
I expect this to mean that pressing the "clear" button in the expanded
notification screen will not clear this notification. But the button
still clears the notification.
I think this may be a per
I'm about to implement a hack to work around a bug in Android 2.1. I'd
like that hack to be inactive in 2.2 where the bug is (reportedly)
fixed. How can I test at runtime for the version of Android that the
phone is running? In case anyone is interested, here's the hack:
https://sites.google.com/a
That's pretty much what I was doing...except I made a subtle typo that
was messing up the code. It's working fine now, at least no exceptions
or memory leaks. The sensors seem to behave a little differently when
the phone is in standby mode. I'm still studying that. But that
discussion is for a new
Well, I implemented something as an experiment, using the PowerManager
and acquiring a PARTIAL_WAKE_LOCK in the onStartCommand method of my
service. I try to release the lock in the onDestroy method of the
service but the wakelock object is null. Both the power manager object
and the wakelock objec
Actually, it might be fixed in 2.2. I can't tell exactly. What is the
release status of 2.2? Is it officially supported on my Droid?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow
This turns out to be a known bug. There appear to be some workarounds
for some phones with some OS releases. If I can test for phone type
and release level I can have my app apply the appropriate workaround
if available.
http://code.google.com/p/android/issues/detail?id=3708
However, I can't tell
I notice on my Droid phone that the accelerometer turns off when the
phone goes into sleep mode (screen dark). Is there a way to keep the
accelerometer active and sending events to the listener even when the
phone is in sleep mode? Alternatively and less desirably, could I turn
off the screen and k
I have a ListActivity that selects a cursor from an SQLite table in
order to build the list. The cursor is created inside
ListActivity.onCreate and closed inside ListActivity.onDestroy. I also
call startManagingCursor right after I generate the cursor, which I
thought would take care of the cursor
I found the problem. My lat/lon numbers were messed up. It's all good
now.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To
The zoomToSpan method appears to be working perfectly. I'm seeing a
nice small area in Kansas. I think the next step is to call getCenter
and see where the MapView thinks it is.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try askin
I'm having some trouble with this method. It doesn't seem to center
the map at the correct place. Here's my code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView( R.layout.eventmapview
Yeah, I've read this article before. But note this quote:
"If the object you pass is for some reason tied to the Activity/
Context, you will leak all the views and resources of the activity.
This means you should never pass a View, a Drawable, an Adapter, etc."
I believe a ServiceConnection objec
An interesting related problem is that rotating the screen causes my
Activity to be destroyed and (re)created in quick succession. This
means that the service unbind, bind, and unbind are called rapidly
too. And that seems to cause a null pointer exception inside the bind/
unbind logic somewhere. I
In fact, I believe I've found a bug. After calling unbindService on an
active service connection, ServiceConnection.onServiceDisconnected is
never called. This means I can't tell when the service has been
destroyed. That makes for rather convoluted logic in trying to manage
the state of the Compoun
I have an activity that contains a CompoundButton. I want that button
to reflect the started/destroyed state of a Service. If the button is
toggled off-to-on, then the service should be created-started. Once
the service is running, I don't want an exit from the activity to
destroy it. Alternatively
This issue is resolved.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
android-
I'm all fixed on these issues. Thanks for the help.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this g
If not an , what should be the type of the parallel
array for the ListPreference?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/andro
I've got two different threads going here and it looks like the two
issues are related. There's something fundamentally broken in my
implementation of SharedPreferences. One thread is entitled
"SharedPreferences.getFloat throwing ClassCastException " and the
other is "Default values for ListPrefere
Changing it to 100F didn't make any difference. It still throws. I
also note that getInt is throwing the same exception when I try to
access the value of a ListPreference key where no default is set.
Any other ideas?
--
You received this message because you are subscribed to the Google
Groups "A
That's exactly what I thought should be done. However, as soon as I
put 1 in for the default value, I get the following exception and
stack trace. Without a default value set, everything runs fine.
I/ActivityManager( 53): Displayed activity
com.shipmate/.Preferences: 1158 ms
(total 1158 ms)
D/da
In the above post, please replace "how can I tell getFloat to parse
the user input as a long?" with "how can I tell getFloat to parse the
user input as a float?"
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging yo
My preference is described in preferences.xml like this:
This behaves very nicely in the preferences view, only allowing the
user to enter valid decimal numbers.
However, when I call SharedPreferences.getFloat with the
"maxTempDegrees" key, it throws a ClassCastException. Beyond the
inputType k
Just to follow up, you were right, the problem is in
SharedPreferences.getFloat. I'm starting a new thread to ask about how
that method works exactly.
Thanks,
Bret
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging
Here's the last hundred lines of logcat:
D/qemud ( 34): fdhandler_accept_event: accepting on fd 10
D/qemud ( 34): created client 0x22c58 listening on fd 15
D/qemud ( 34): client_fd_receive: attempting registration for
service 'senso
rs'
D/qemud ( 34): client_fd_receive:-> recei
Here's the full stacktrace from traces.txt:
- pid 1457 at 2010-07-07 23:00:04 -
Cmd line: com.shipmate
DALVIK THREADS:
"main" prio=5 tid=3 NATIVE
| group="main" sCount=1 dsCount=0 s=N obj=0x4001b268 self=0xbd00
| sysTid=1457 nice=0 sched=0/0 cgrp=default handle=-1344001384
at andr
I can't understand from the Preferences and ListPreference documents
whether the defaultValue attribute in preferences.xml should be the
text choice displayed in the list, the Integer corresponding to that
choice, or the index of the choice. It also seems like best practice
to pick up the default v
I want to monitor battery temperature, if available. I create a
Receiver like this:
private BroadcastReceiver myTempReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context ctx, Intent myIntent ) {
int temp = myIntent
That was it! The original onBind stub had a return null at the end
which I had forgotten to remove. Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.
I don't see anything unusual in the log. I've got a few debug messages
and they are printing out fine. I've got a debug message in
onServiceConnected that is not printing. There are no error messages
to be seen. The really odd thing is that bindService is returning true
and not throwing any excepti
I think I may be confused about how these two methods are related. My
bind code looks something like this:
bindService(new Intent(myActivity.this,
myService.class), myServiceConnection,
Context.BIND_AUTO_CREATE));
Now, when I call this, the onServiceConnected method of
myServi
OK, so let me state where we stand at the moment. Current code to
start service:
Intent myIntent = new Intent();
myIntent.setClass(MainActivity.this,
SensorService.class);
start
I fixed the context as you suggested, using MainActivity.this to make
sure I have the right scope. The run behavior is unchanged. Here's
what appears in logcat. It looks like some sort of timeout when trying
to start the service.
W/InputManagerService( 52): Got RemoteException sending
setActive(
I'm in the DDMS file manager now and can't see anything related to
SQLite. Do you know the exact path and filename for the datafle?
Note that I discovered that onCreate wasn't being called because I got
an exception from insertOrThrow that said no such database. So I'm not
really sure if the db ex
Intent.setClass needs a Context for the first argument. Replacing
cb.getContext with "this" causes a compiler error. Do you mean I
should call getApplicationContext?
Here's the full trace:
com.shipmate.MainActivity [Android Application using Studio for
Android]
DalvikVM[localhost:8610]
Here's the full trace from the debugger.
com.shipmate.MainActivity [Android Application using Studio for
Android]
DalvikVM[localhost:8610]
Thread [<3> main] (Suspended (exception RuntimeException))
ActivityThread.performDestroyActivity(IBinder, boole
1 - 100 of 103 matches
Mail list logo