[android-developers] Progress monitor graphic broken with ICS

2011-12-18 Thread Mariano Kamp
Hi,

I am wondering if anybody else is seeing this and knows what it is.

I use a progress monitor that with ICS now looks like this:
[image: Screen shot 2011-12-16 at 4.22.18 PM.png]

This is the relevant code:

ProgressBar
android:id=@+id/background_progress
 style=?android:attr/progressBarStyleSmall

android:layout_width=wrap_content
 android:layout_height=fill_parent
*
*
*android:paddingRight=17dp*
* android:paddingLeft=18dp*
**
*android:paddingTop=14dp*
*android:paddingBottom=14dp*
*
*
android:background=@drawable/title_button

##* happens with and without the following line*
android:indeterminateDrawable=@drawable/progress_small_white
 android:focusable=true
android:clickable=true

android:indeterminate=true
android:visibility=visible /

I ran it on the emulator after Nexus Galaxy users reported the issue. Is
this my code that is broken or ICS? Shouldn't dp solve this? It works with
ldpi, mdpi and hdpi with releases before ICS.

Best, Mariano

-- 
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=enScreen shot 2011-12-16 at 4.22.18 PM.png

[android-developers] ICS: Progress monitor graphic broken, Different Padding?

2011-12-18 Thread Mariano Kamp
Hi,

I am wondering if anybody else is seeing this and knows what it is.

I use a progress monitor that with ICS now looks like this:
[image: Screen shot 2011-12-16 at 4.22.18 PM.png]

This is the relevant code:

ProgressBar
android:id=@+id/background_progress
style=?android:attr/progressBarStyleSmall

android:layout_width=wrap_content
android:layout_height=fill_parent
*
*
*android:paddingRight=17dp*
* android:paddingLeft=18dp*
**
*android:paddingTop=14dp*
*android:paddingBottom=14dp*
*
*
android:background=@drawable/title_button

##* happens with and without the following line*
android:indeterminateDrawable=@drawable/progress_small_white 
android:focusable=true
android:clickable=true

android:indeterminate=true
android:visibility=visible /

I ran it on the emulator after Nexus Galaxy users reported the issue. Is 
this my code that is broken or ICS? Shouldn't dp solve this? It works with 
ldpi, mdpi and hdpi with releases before ICS.

Best, Mariano

-- 
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

[android-developers] App Broken After Android Refactoring Rename Application Package / android.view.InflateException

2011-02-16 Thread Mariano Kamp
I want to create a new version of my app that caters to the needs of users
with Android 1.5/1.6/2.0 devices and move ahead with the normal version of
my app. For that I copied my app directory then applied the Rename
Application Package refactoring. That helped a lot. So far I mostly had to
fix references to styles.

Unfortunately I cannot launch the app. I get the following stacktrace:

java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.newsrob.threetosix/com.newsrob.DashboardListActivity}:
android.view.InflateException: Binary XML file line #31: Error inflating
class java.lang.reflect.Constructor
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
  at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
  at android.app.ActivityThread.access$1800(ActivityThread.java:112)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:3948)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.view.InflateException: Binary XML file line #31: Error
inflating class java.lang.reflect.Constructor
  at android.view.LayoutInflater.createView(LayoutInflater.java:512)
  at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
  at android.app.Activity.setContentView(Activity.java:1626)
  at
com.newsrob.DashboardListActivity.onCreate(DashboardListActivity.java:45)
  at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
  at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
  ... 11 more
 Caused by: java.lang.reflect.InvocationTargetException
  at android.widget.TextView.init(TextView.java:308)
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
  at android.view.LayoutInflater.createView(LayoutInflater.java:499)
  ... 24 more
 Caused by: android.content.res.Resources$NotFoundException: File
res/drawable/label_background.xml from color state list resource ID #0x0
  at android.content.res.Resources.loadColorStateList(Resources.java:1744)
  at android.content.res.TypedArray.getColorStateList(TypedArray.java:289)
  at android.widget.TextView.init(TextView.java:608)
  ... 28 more

The little sense I can make of this tells me that it may have two causes.

(a) The source of the issue is in line #31.
(b) There is an issue accessing  res/drawable/label_background.xml.

Here are excerpts of the layout xml that I think is causing the issue:

?xml version=1.0 encoding=utf-8?

[..]
LinearLayout
android:id=@+id/status_bar

android:layout_width=fill_parent
android:layout_height=wrap_content

android:orientation=vertical
   * android:background=@drawable/label_background --- Line #21*

android:visibility=gone

LinearLayout
android:id=@+id/label
android:layout_width=fill_parent
android:layout_height=wrap_content
android:orientation=horizontal

TextView
android:id=@+id/control_panel_title

android:layout_width=fill_parent
android:layout_height=fill_parent
[..]
*android:textColor=?lightTextColor / --- Line #31*


ProgressBar
android:id=@+id/progress_status_bar
style=?android:attr/progressBarStyleSmall

android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_margin=3dp

android:visibility=invisible /
/LinearLayout
/LinearLayout
[..]

When I comment out Line #21 the error is not raised. That would be cause (b)
then I suppose.
I do have a file however that is called
app/res/drawable/label_background.xml:

?xml version=1.0 encoding=utf-8?
shape
xmlns:android=http://schemas.android.com/apk/res/android;
gradient
android:angle=270

[android-developers] Q: How to do an expand animation?

2010-11-16 Thread Mariano Kamp
Hi,

please consider the following. I have two containers and in between them I
want to expand/grow a third container that should show some temporary
information. The undo message in the Gmail app is an example for that. It
expands between the status bar and the body of the list, thereby pushing the
list down.

How would you implement that? I place the third/new container in my layout.
Then I need to make it visible before I start the animation, because
otherwise I wouldn't see it. However then in the parent there will be a gap
for the third component right away and the gap will have the full size (the
calculated/measured size) right away. Hence when I then start the animation
to scaleY from 0.0 to 1.0 I first see the complete space of the
underlying container and then slowly the actual component appears ;( What I
want is that space growing with the animation.

Any ideas? Do I need to set the height to 0 first and then measure myself to
define the goal height/Y of the animation as well as to set the component's
height myself after the animation is done?  Do you know a code sample that
does that?

Cheers,
Mariano

-- 
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

[android-developers] How to debug CursorIndexOutOfBoundsException with ListView?

2010-11-01 Thread Mariano Kamp
Hi,

I occasionally get exceptions like this one here:

android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a
size of 0
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
at
android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:172)
at
android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:99)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:194)
at android.widget.CursorAdapter.getView(CursorAdapter.java:177)
at android.widget.AbsListView.obtainView(AbsListView.java:1254)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1142)
at android.widget.ListView.onMeasure(ListView.java:1055)
at android.view.View.measure(View.java:7117)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:7117)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
at android.view.View.measure(View.java:7117)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:7117)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
at android.view.View.measure(View.java:7117)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:7117)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:7117)
at android.view.ViewRoot.performTraversals(ViewRoot.java:866)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1718)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)

My own code isn't really touched in this stack trace and I am wondering what
I might be doing wrong here?

I suspect it is something about the coordination of redraw/invalidation
events, but I don't know where to look exactly.

When I update the model (the sqlitedatabase) I run the following code on the
UI thread afterwards:

  void refreshUI() {

((BaseAdapter) getListAdapter()).notifyDataSetChanged();

// the remaining calls are just included for completeness

// they update different ui elements, but don't access the cursor in
any way.

updateButtons();

updateControlPanelTitle();

updateProgressBar();

}


Any other information I can provide?

Cheers,

Mariano

-- 
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

Re: [android-developers] How to debug CursorIndexOutOfBoundsException with ListView?

2010-11-01 Thread Mariano Kamp
Any idea how I can get to the bottom of this?

I am wondering if this error message means that the list view ask for the
number of rows in the list adapter, but during the rendering of the list
this number changes (is reduced). That code is not in my hand though.

How would I deal with that?

Currently I change the database on a background thread, send a notification
(notification in the generic sense, not an Android notification) afterwards
and the listeners that want to change the UI (like refreshUI() form below)
use runOnUiThread() to process the event.

On Mon, Nov 1, 2010 at 5:34 PM, Romain Guy romain...@android.com wrote:

This kind of error usually happens when there's a concurrency issue in
the application.

On Mon, Nov 1, 2010 at 4:02 AM, Mariano Kamp mariano.k...@gmail.com wrote:
 Hi,
 I occasionally get exceptions like this one here:
 android.database.CursorIndexOutOfBoundsException: Index 0 requested, with
a
 size of 0
 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
 at

android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:172)
 at

android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:99)
 at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:194)
 at android.widget.CursorAdapter.getView(CursorAdapter.java:177)
 at android.widget.AbsListView.obtainView(AbsListView.java:1254)
 at android.widget.ListView.measureHeightOfChildren(ListView.java:1142)
 at android.widget.ListView.onMeasure(ListView.java:1055)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
 at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
 at

android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
 at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
 at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
 at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
 at android.view.View.measure(View.java:7117)
 at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
 at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
 at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
 at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
 at android.view.View.measure(View.java:7117)
 at android.view.ViewRoot.performTraversals(ViewRoot.java:866)
 at android.view.ViewRoot.handleMessage(ViewRoot.java:1718)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:123)
 at android.app.ActivityThread.main(ActivityThread.java:3948)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:521)
 at

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
 at dalvik.system.NativeStart.main(Native Method)
 My own code isn't really touched in this stack trace and I am wondering
what
 I might be doing wrong here?
 I suspect it is something about the coordination of redraw/invalidation
 events, but I don't know where to look exactly.
 When I update the model (the sqlitedatabase) I run the following code on
the
 UI thread afterwards:

  void refreshUI() {

 ((BaseAdapter) getListAdapter()).notifyDataSetChanged();

 // the remaining calls are just included for completeness

 // they update different ui elements, but don't access the cursor
in
 any way.

 updateButtons();

 updateControlPanelTitle();

 updateProgressBar();

 }

 Any other information I can provide?

 Cheers,

 Mariano


 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

--
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--
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

Re: [android-developers] How to debug CursorIndexOutOfBoundsException with ListView?

2010-11-01 Thread Mariano Kamp
Hi Rajesh,

when there is no data in the model then the empty view is shown, which I
think is correct.

Also I don't think I do any of the things you mentioned.

The only thing where I don't have a good feeling about is the following
method, that is run on the UI thread. It is called when the model is
updated, which may include a change to the query criteria:

  private void updateCursor() {


if (dbQuery.hasChanged()) {

Timing t = null;

if (NewsRob.isDebuggingEnabled(this))

t = new Timing(ArticleListActivity.updateCursor() change of
cursor, this);

final Cursor oldCursor = listAdapter.getCursor();

if (oldCursor != null) {

stopManagingCursor(oldCursor);

listAdapter.notifyDataSetInvalidated();

oldCursor.close();

}


final Cursor cursor = getEntryManager().getContentCursor(dbQuery
);

startManagingCursor(cursor);

listAdapter.changeCursor(cursor);

if (t != null)

t.stop();

// listAdapter.notifyDataSetChanged();


} else {

Timing t = null;

if (NewsRob.isDebuggingEnabled(this))

t = new Timing(ArticleListActivity.updateCursor() requery,
this);

// listAdapter.notifyDataSetChanged(); doesn't work. use requery

// instead

listAdapter.getCursor().requery();


if (t != null)

t.stop();

}

}

But with the limited knowledge I have about the current issue, this code
doesn't seem like the culprit.But if you have a good idea about it, I am
very willing to listen.

?

On Mon, Nov 1, 2010 at 6:44 PM, Rajesh Kumar rajnitj.g...@gmail.com wrote:

 Hello Mariano Kamp,
 *
 *
 *Usually This kind of exception comes when your are not closing cursor
 mainly when you press home key or End Key .Or doing delete operation on Same
 table which you are fetching data.*
 *Be ensure When there is No data in table for which you are retrieving
 data you display some toast and close activity or Display some TextView
 rather than ListView.
 *
 On Mon, Nov 1, 2010 at 11:05 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Any idea how I can get to the bottom of this?

 I am wondering if this error message means that the list view ask for the
 number of rows in the list adapter, but during the rendering of the list
 this number changes (is reduced). That code is not in my hand though.

 How would I deal with that?

 Currently I change the database on a background thread, send a
 notification (notification in the generic sense, not an Android
 notification) afterwards and the listeners that want to change the UI (like
 refreshUI() form below) use runOnUiThread() to process the event.

 On Mon, Nov 1, 2010 at 5:34 PM, Romain Guy romain...@android.com wrote:

 This kind of error usually happens when there's a concurrency issue in
 the application.

 On Mon, Nov 1, 2010 at 4:02 AM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Hi,
  I occasionally get exceptions like this one here:
  android.database.CursorIndexOutOfBoundsException: Index 0 requested,
 with a
  size of 0
  at
 android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
  at
 
 android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:172)
  at
 
 android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:99)
  at
 android.database.AbstractCursor.moveToPosition(AbstractCursor.java:194)
  at android.widget.CursorAdapter.getView(CursorAdapter.java:177)
  at android.widget.AbsListView.obtainView(AbsListView.java:1254)
  at android.widget.ListView.measureHeightOfChildren(ListView.java:1142)
  at android.widget.ListView.onMeasure(ListView.java:1055)
  at android.view.View.measure(View.java:7117)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  at android.view.View.measure(View.java:7117)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  at
 
 android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  at android.view.View.measure(View.java:7117)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  at android.view.View.measure(View.java:7117)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  at android.view.View.measure(View.java:7117)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  at android.view.View.measure(View.java:7117

[android-developers] How to find out that the global auto-sync state has been changed?

2010-10-22 Thread Mariano Kamp
Hey guys.

Is there any way that my code can be notified / receive a broadcast when the
global auto-sync state changes?

Cheers,
Mariano

http://developer.android.com/reference/android/content/ContentResolver.html#getMasterSyncAutomatically()

-- 
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

Re: [android-developers] Re: On using themes?!

2010-09-22 Thread Mariano Kamp
As it wasn't possible to submit a new post to the existing/old conversation
using the web interface I am copying the message here with Danilo's
permission:

Hi Mariano.

Did you manage to work using themes from drawables xml?
I have same problem and there is no any reference but this thread and
there is no solution here.
If you find solution please let me know.

I currently solved it by using different drawable xml for every
theme but as you can see this isn't a god solution at all.

About your question about getting a color from a theme (I know its old
but for future readers :) ) solution I created is like this:

   private static int getColor(final Context context, final int id,
final int defaultColor) {
   try {
   final Theme theme = context.getTheme();
   if (theme == null) {
   return defaultColor;
   }
   TypedValue typedValue = new TypedValue();

   if (theme.resolveAttribute(id, typedValue, false)) {
   final Resources resources =
context.getResources();
   final int resourceId = typedValue.resourceId;
   if (typedValue.type ==
TypedValue.TYPE_INT_COLOR_RGB8 ||
typedValue.type == TypedValue.TYPE_INT_COLOR_RGB4 || typedValue.type
== TypedValue.TYPE_INT_COLOR_ARGB4
   || typedValue.type ==
TypedValue.TYPE_INT_COLOR_ARGB8 ||
typedValue.type == TypedValue.TYPE_FIRST_COLOR_INT) {
   return typedValue.data;
   } else {
   return
resources.getColor(resourceId);
   }
   }
   return defaultColor;
   } catch (NotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
   return defaultColor;
   }
   }

On Tue, May 11, 2010 at 9:08 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hi Dianne.

 Thanks very much, almost there.

 I understand the procedure, it would do what I want, but I run into an
 exception:

 D/NewsRobDefaultExceptionHandler( 1839): Caused by:
 java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
 D/NewsRobDefaultExceptionHandler( 1839): at
 android.content.res.TypedArray.getColor(TypedArray.java:273)
 D/NewsRobDefaultExceptionHandler( 1839): at
 android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:647)
 D/NewsRobDefaultExceptionHandler( 1839): at
 android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
 D/NewsRobDefaultExceptionHandler( 1839): at
 android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
 D/NewsRobDefaultExceptionHandler( 1839): at
 android.content.res.Resources.loadDrawable(Resources.java:1690)

 This happens when using it the way we described here in a drawable xml.
 However to better understand the error I used it on other attributes and
 when using it on the background attribute of a View it works. Maybe this
 approach is incompatible with drawables that are expressed in xml?

 Btw. Is there any way to get the actual #rgb string for a color from a
 theme?

 Cheers,
 Mariano

 On Tue, May 11, 2010 at 8:02 AM, Dianne Hackborn hack...@android.comwrote:

 You need to define an attribute for your value:

 attr name=myColor format=color /

 Then make a custom theme that supplies a value for it:

 style name=MyTheme parent=android:Theme
 item name=com.my.package:myColor#ff808080/item
 /style

  And now you can reference that value from other XML:

 shape xmlns:android=http://schemas.android.com/apk/res/android

 
 android:shape=rectangle
 gradient android:startColor=?com.my.package:myColor

 android:endColor=#66FF
 android:angle=270 /
 /shape


 Note that com.my.package is your manifest's package name.

 Also I just wrote this by hand so I won't guarantee it is completely
 right. :}

 On Mon, May 10, 2010 at 11:02 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hmmh, also no answer to this question on themes. Maybe the answer cannot
 be given with two lines? So let me explain what I would expect step by step
 and you stop me were I deviate from the Golden Path? I'll try yes/no
 questions.

 In the simplest terms I would expect that in every place I can specify a
 color in RGB (#) I could also specify a symbolic name instead. This
 should work like @color/xyz, but with one more level of indirection that
 lets me switch between themes, like dark and light.

 Is that possible?

 I would expect those themes to be applicable to (a) widgets, (b)
 drawables (see the mentioned example) and (c) when I need to style something
 myself like HTML. Are (a) - (c) possible?

 Furthermore I would expect that I could define style keys

Re: [android-developers] Licensing

2010-07-27 Thread Mariano Kamp
That's really not all that good.

So if I want to have my app listed on an alternative market, because Google
doesn't provide all users with access to paid apps, then I cannot use the
new mechanism ... unless the alternative market provides a binary compatible
lib. Right? Otherwise I would need to disable the check for non-Android
Market apps.
Maybe that isn't too bad (except of course for the alternative markets), but
it would mean that somebody who has the Android Market needs to buy the apps
exclusively there and cannot use an alternative market.

Of course, I could also make different versions of my app or just shoot me.

On Tue, Jul 27, 2010 at 8:11 PM, Shane Isbell shane.isb...@gmail.comwrote:

 It's addressing a direct need of developers. From my perspective, I wonder
 what the impact will be for alternative stores, as they can't use the
 service.

 The basic equation developers have to take into account is: are losses from
 pirated sales (through weakly protected apps on alternative stores) greater
 than sales from those alternative stores generate? I'm still trying to
 digest this.

 On Tue, Jul 27, 2010 at 10:29 AM, Chris Stewart cstewart...@gmail.comwrote:

 With the just announced licensing feature for Android (
 http://developer.android.com/guide/publishing/licensing.html), I'm
 curious to hear what you all think about it.  Is piracy a big enough problem
 on Android that this is a breath of fresh air, or more of a precaution for
 the future?

 Chris Stewart
 cstewart...@gmail.com
 http://www.androidsdkforum.com

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Shane Isbell (Founder of ZappMarket)
 http://apps.facebook.com/zappmarket/

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] Re: Don't see YouTube thumbnails anymore on Froyo

2010-07-12 Thread Mariano Kamp
Does this code snippet work for anybody else with Froyo?

On Tue, Jun 29, 2010 at 8:22 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hi.

 using a WebView with Froyo I don't see the YouTube thumbnails anymore.
 WebViewClient.shouldOverrideUrlLoading() is not called in Froyo, but was
 called before. Please check out the example below. With Pre-Froyo you would
 see a YouTube thumbnail two/thirds into the article, with Froyo you don't.

 Any ideas?

 Cheers,
 Mariano

 public class WebViewTestActivity extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   WebView wv = (WebView) findViewById(R.id.webview);
   wv.setWebViewClient(new WebViewClient() {
   public boolean shouldOverrideUrlLoading(WebView view, 
 String url) {

   if (url.startsWith(http:) || 
 url.startsWith(https:))
   return false;

   Intent intent;

   try {
   intent = Intent.parseUri(url, 
 Intent.URI_INTENT_SCHEME);
   } catch (URISyntaxException ex) {
   Log.w(Browser, Bad URI  + url + : 
  + ex.getMessage());
   return false;
   }

   if (getPackageManager().resolveActivity(intent, 
 0) == null) {
   String packagename = 
 intent.getPackage();
   if (packagename != null) {
   intent = new 
 Intent(Intent.ACTION_VIEW,
   
 Uri.parse(market://search?q=pname:
   
 + packagename));
   
 intent.addCategory(Intent.CATEGORY_BROWSABLE);
   startActivity(intent);
   return true;
   } else {
   return false;
   }
   }

   intent.addCategory(Intent.CATEGORY_BROWSABLE);
   intent.setComponent(null);
   try {
   if (startActivityIfNeeded(intent, -1)) {
   return true;
   }
   } catch (ActivityNotFoundException ex) {
   }

   return super.shouldOverrideUrlLoading(view, 
 url);
   }

   });

   wv.getSettings().setPluginsEnabled(true);
   wv
   
 .loadUrl(http://www.fscklog.com/2010/06/sammelsurium-zweite-ipad-
 auslieferungswelle-scheint-anzulaufen-iphone-codesperre-kann-auch-unter-windows-
 ausgetrickst-werde.html);
   }
 }



-- 
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

Re: [android-developers] Re: Best httpclient re-use stategy

2010-06-29 Thread Mariano Kamp
On Mon, Jun 28, 2010 at 1:31 PM, David dago...@gmail.com wrote:

 Ok, thanks for this advice. So you decide to manage preference by yourself
 using the filesystem directly ?


I only do it for the two(2) preferences where I frequently do a write. For
99% of my preferences I still use the normal preferences.

Just in case you want to have a look at it, this is my code. Please be aware
that for every preferences I keep a reference to the file descriptor. This
code is not meant for a case where you maintain 2,000 preferences ;)

package com.newsrob.util;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.HashMap;
import java.util.Map;

import android.content.Context;

public class SingleValueStore {

private Context ctx;
private MapString, File files = new HashMapString, File();

public SingleValueStore(Context context) {
this.ctx = context.getApplicationContext() != null ?
context.getApplicationContext() : context;
}

public String getString(final String key) {
File f = getFile(key);
if (!f.exists())
return null;

RandomAccessFile raf = null;
String s = null;

try {
raf = new RandomAccessFile(f, r);
s = raf.readLine();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (raf != null)
try {
raf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return s;

}

public void putString(final String key, final String value) {
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile(getFile(key), rw);
raf.writeBytes(value + \n);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (raf != null)
try {
raf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

public void putLong(final String key, final Long value) {
putString(key, String.valueOf(value));
}

public Long getLong(final String key) {
return getLong(key, null);
}

public Long getLong(final String key, final Long def) {
String s = getString(key);
if (s == null)
return def;
try {
return Long.parseLong(s);
} catch (NumberFormatException nfe) {
return def;
}
}

private File getFile(String key) {
if (!files.containsKey(key))
files.put(key, new File(ctx.getFilesDir(), svs_ + key));
return files.get(key);
}

}

package com.newsrob.test.unit;

import java.io.File;

import android.content.Context;
import android.test.InstrumentationTestCase;

import com.newsrob.util.SingleValueStore;

public class SingleValueStoreTests extends InstrumentationTestCase {

private SingleValueStore svs;
private Context ctx;

 @Override
protected void setUp() throws Exception {
super.setUp();
 ctx = getInstrumentation().getTargetContext();
svs = new SingleValueStore(ctx);

for (File f : ctx.getFilesDir().listFiles())
if (f.getName().startsWith(svs_))
 System.out.println(Removed  + (f.getName() + f.delete()));
}

public void testSaveAndRestoreString() {
svs.putString(key1, val1);
 assertEquals(val1, svs.getString(key1));
}

 public void testSaveAndRestoreStringWithNewInstance() {
svs.putString(key2, hello);
 svs = new SingleValueStore(ctx);
assertEquals(hello, svs.getString(key2));
 }

public void testValueNotThere() {
assertNull(svs.getString(null));
 }

public void test1000() {
svs.putString(key, value);
 for (int i = 0; i  1000; i++) {
assertEquals(value, svs.getString(key));
 }
}

public void testOverwriteValue() {
 svs.putString(key, value1);
assertEquals(value1, svs.getString(key));
 svs.putString(key, value2);
assertEquals(value2, svs.getString(key));
 }

public void testLong() {
svs.putLong(key, 100l);
 assertEquals(Long.valueOf(100l), svs.getLong(key));
}

 public void testLongWithDefault() {
assertEquals(Long.valueOf(-99l), svs.getLong(non-existing-key, -99l));
 }

}




 On Fri, Jun 25, 2010 at 10:48 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Just a sidenote on an issue that you touch, but not the actual main
 issue:

  - Save the cookie (String serialized into SharedPreferences) and
  create every time a new httpclient instance (then set the cookie to
  the new instance) = overhead to get the http connection
 I tried that in my app and found out there is a huge performance penalty
 involved as compared to just writing it to a file directly. I got the
 impression if you set any preference and do a commit, then all the settings
 are serialized into one single XML file and that's written to the very slow
 flash memory. If you have, say 50 other settings, this may take 300-600ms
 vs. 15 ms. Don't get hung

[android-developers] Don't see YouTube thumbnails anymore on Froyo

2010-06-29 Thread Mariano Kamp
Hi.

using a WebView with Froyo I don't see the YouTube thumbnails anymore.
WebViewClient.shouldOverrideUrlLoading() is not called in Froyo, but was
called before. Please check out the example below. With Pre-Froyo you would
see a YouTube thumbnail two/thirds into the article, with Froyo you don't.

Any ideas?

Cheers,
Mariano

public class WebViewTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv = (WebView) findViewById(R.id.webview);
wv.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, 
String url) {

if (url.startsWith(http:) || 
url.startsWith(https:))
return false;

Intent intent;

try {
intent = Intent.parseUri(url, 
Intent.URI_INTENT_SCHEME);
} catch (URISyntaxException ex) {
Log.w(Browser, Bad URI  + url + : 
 + ex.getMessage());
return false;
}

if (getPackageManager().resolveActivity(intent, 
0) == null) {
String packagename = 
intent.getPackage();
if (packagename != null) {
intent = new 
Intent(Intent.ACTION_VIEW,

Uri.parse(market://search?q=pname:

+ packagename));

intent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(intent);
return true;
} else {
return false;
}
}

intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setComponent(null);
try {
if (startActivityIfNeeded(intent, -1)) {
return true;
}
} catch (ActivityNotFoundException ex) {
}

return super.shouldOverrideUrlLoading(view, 
url);
}

});

wv.getSettings().setPluginsEnabled(true);
wv

.loadUrl(http://www.fscklog.com/2010/06/sammelsurium-zweite-ipad-
auslieferungswelle-scheint-anzulaufen-iphone-codesperre-kann-auch-unter-windows-
ausgetrickst-werde.html);
}
}

-- 
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

Re: [android-developers] ListView - Row Background Animation

2010-06-25 Thread Mariano Kamp
IMHO the list view doesn't shuffle the rows around, but the views that form
these rows are re-used in order to avoid the repeated inflation of the
views. Instead you get a previously setup view and you only do the data
binding, i.e. set the actual values from your model in the views's text
fields, bitmaps etc..

However it would only re-use a view that previously was scrolled out of the
viewable part of the list. So when your transitions are gone before the view
is scrolled out, no jumping should occur as the view cannot be seen anymore.
This view might be re-used though by the next view (row) that gets scrolled
in and when the animation still runs on it then you would still see it.

You could reset the animation before re-using the view. That might have the
drawback that an item with a slowly fading background is scrolled out while
the transition is in progress and then scrolled in again, also while the
transition is still in progress, but as you just reset the animation before
the re-use you won't see it anymore. Am I making any sense?

Maybe, if your views are very simple, you don't need to re-use them anyway
and still have a good performance?

Before going into more detail it may make sense for you to checkout those
convert views.
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

On Fri, Jun 25, 2010 at 5:58 PM, Daniel Lew danle...@gmail.com wrote:

 Back when I originally wrote my app, I thought I could use some tricks
 with TransitionDrawable to briefly highlight some rows in a ListView.
 However, when I actually implemented this (a fading background), the
 background would jump from item to item randomly.

 As my knowledge of Android has progressed, I've learned why this no
 longer works: the ListView uses optimizations and actually shuffles
 rows around, so the row that I may have originally told to animate
 ends up placed in a different spot by the time the ListView is
 visible.

 My question is whether there's a solution to this problem.  I've
 thought of using a different view type, but that would only work if I
 can turn *off* the view type for that row at the right time; since I'm
 using a TransitionDrawable, there's no way for me (right now) to mark
 once the animation is done.

 Does anyone have any ideas on how to make a temporary fading
 background on particular rows in a ListView?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

Re: [android-developers] Re: Best httpclient re-use stategy

2010-06-25 Thread Mariano Kamp
Just a sidenote on an issue that you touch, but not the actual main issue:

 - Save the cookie (String serialized into SharedPreferences) and
 create every time a new httpclient instance (then set the cookie to
 the new instance) = overhead to get the http connection
I tried that in my app and found out there is a huge performance penalty
involved as compared to just writing it to a file directly. I got the
impression if you set any preference and do a commit, then all the settings
are serialized into one single XML file and that's written to the very slow
flash memory. If you have, say 50 other settings, this may take 300-600ms
vs. 15 ms. Don't get hung up on the the actual numbers, just see the
difference in principle here.
Also when you have other stuff (the stream?) that you want to write, then
you're also clogging the flash memory.

On Fri, Jun 25, 2010 at 4:46 PM, MoxFulder dago...@gmail.com wrote:

 nobody has any idea ?

 On Jun 21, 10:33 am, MoxFulder dago...@gmail.com wrote:
  Hi there,
  I'm new using android sdk/httpclient
 
  I'm writing a small application which needs httpclient lib, basically
  to manage the cookie/session automatically.
  The website I'm targeting needs a valid session, so, between each http
  call, I need to send the cookie. Httpclient does it well. This is a tv
  stream application and I have to fetch the channel url, the url has a
  token parameter and I have to be logged / authenticated / (= have a
  valid cookie/sessionid) to fetch the channel url.
 
  I got the first cookie/sessionid with the first connection to the
  website. The cookie is valid for a certain amount of time, there is no
  expires but I don't know if there is any server cron to cleanup the
  sessions. I assume I have to ping every x secondes to maintain the
  session valid.
 
  Between each http call, the time could be from 1 sec to several
  minutes, it depends if the user wants to change the watched tv
  channel. The http call (to fetch the url) is not made by the UI
  Thread.
 
  There are several possibilities to manage the httpclient :
  - a single httpclient static singleton instance accessed by a custom
  synchronized getClient() on an helper class = when / how to release
  the http connection ? How to handle that correctly if the user got a
  phone call / does not use the application for now (unvalidate during
  onResume, etc)?
  - Save the cookie (String serialized into SharedPreferences) and
  create every time a new httpclient instance (then set the cookie to
  the new instance) = overhead to get the http connection
  - other ?
 
  I'm asking here what is the best way to implement that.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Re: Need help with a Java issue

2010-06-23 Thread Mariano Kamp
On Wed, Jun 23, 2010 at 1:23 AM, Indicator Veritatis mej1...@yahoo.comwrote:

 True, this is a Java question, not an Android question. SO it doesn't
 r-e-a-l-l-y belong here.

I am glad we cleared that up.


 1) no, the NPE does not imply that isMarkAllReadPossibleCache is the
 null variable. Rather, it implies that in the course of trying to
 execute the get method of isMarkAllReadPossibleCache, the DVM
 encountered a null pointer.

How so? Where do you see the get() method?


 2) the NPE occurred during the call to UpdateButtons(), which in turn
 took place during the call to the above get() method.

I am really puzzled by that.
You mean that looking at the stacktrace the NPE happens here:
com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
?
How do you come to this conclusion? In case of a non-wrapped exception isn't
the top stack frame the place where the exception occurs? An exception blows
up and the JVM provides the stacktrace up to this point. You think
otherwise?

3) to tell in any more detail where it came from, I would need the
 rest of your stack trace, which you chose not to show.

The stack trace is complete.


 But now you
 have a better idea how to narrow this down by yourself, without
 exposing the code to us, I hope.

I don't have a better idea and now you got me confused about how to read the
stack trace.

As this is kind of a last straw I would be delighted to learn something new
about exceptions. Maybe that's the cue that's missing.


 On Jun 22, 2:59 am, Mariano Kamp mariano.k...@gmail.com wrote:
  Hey guys.
 
  This is not an Android issue per-se, but I am puzzled about a Java issue
 and
  want to pick your brains.
 
  I recently got a couple of bug reports with a NPE that I don't understand
  and can't reproduce myself. Here is an abbreviated representation of the
  offending class. I tried to stay as close to the actual code as possible.
 
  public class EntryManager {
 
private static EntryManager instance;
private MapDBQuery, Boolean isMarkAllReadPossibleCache;
 
private EntryManager(Context ctx) {
  ..
  isMarkAllReadPossibleCache = new HashMapDBQuery, Boolean();
  ..
}
 
public static synchronized EntryManager getInstance(final Context
 context)
  {
 if (instance == null)
 instance = new EntryManager(context.getApplicationContext());
 return instance;
 }
 
 void fireModelUpdated(final String atomId) {
  ..
  isMarkAllReadPossibleCache.clear();
  ..
 }
 
public boolean isMarkAllReadPossible(final DBQuery dbq) {
  if (!isMarkAllReadPossibleCache.containsKey(dbq))
  isMarkAllReadPossibleCache.put(dbq,
  databaseHelper.isMarkAllReadPossible(dbq));
 
 return isMarkAllReadPossibleCache.get(dbq); !-- NPE is raised
 here
  }
 ..
 
  }
 
  In the last line from above a NPE is thrown. So the instance variable
  isMarkAllReadPossibleCache must be null, right? But I don't see where
 this
  could happen. It's initialized in the constructor and never set to null
  afterwards.
 
  For completeness here is a stack trace:
 
  java.lang.NullPointerException
  at com.newsrob.EntryManager.isMarkAllReadPossible(EntryManager.java:1529)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.shouldMarkAllReadButtonBeEnabled(AbstractNewsRobListActivity.java:327)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.access$2(AbstractNewsRobListActivity.java:215)
  -- removed the private access modifier meanwhile
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity$13.run(AbstractNewsRobListActivity.java:626)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)
 
  Any ideas?
 
  Cheers,
  Mariano

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Re: Need help with a Java issue

2010-06-23 Thread Mariano Kamp
Ok, meanwhile a coworker of mine pointed out that this is a known issue with
autoboxing (not showing up in the stacktrace), it was just unknown to me.

http://javahowto.blogspot.com/2006/07/not-your-typical-npe.html

Thanks for your help guys.

On Wed, Jun 23, 2010 at 8:39 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 On Wed, Jun 23, 2010 at 1:23 AM, Indicator Veritatis mej1...@yahoo.comwrote:

 True, this is a Java question, not an Android question. SO it doesn't
 r-e-a-l-l-y belong here.

 I am glad we cleared that up.


 1) no, the NPE does not imply that isMarkAllReadPossibleCache is the
 null variable. Rather, it implies that in the course of trying to
 execute the get method of isMarkAllReadPossibleCache, the DVM
 encountered a null pointer.

 How so? Where do you see the get() method?


 2) the NPE occurred during the call to UpdateButtons(), which in turn
 took place during the call to the above get() method.

 I am really puzzled by that.
 You mean that looking at the stacktrace the NPE happens here:

 com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
 ?
 How do you come to this conclusion? In case of a non-wrapped exception
 isn't the top stack frame the place where the exception occurs? An exception
 blows up and the JVM provides the stacktrace up to this point. You think
 otherwise?

 3) to tell in any more detail where it came from, I would need the
 rest of your stack trace, which you chose not to show.

 The stack trace is complete.


 But now you
 have a better idea how to narrow this down by yourself, without
 exposing the code to us, I hope.

 I don't have a better idea and now you got me confused about how to read
 the stack trace.

 As this is kind of a last straw I would be delighted to learn something new
 about exceptions. Maybe that's the cue that's missing.


 On Jun 22, 2:59 am, Mariano Kamp mariano.k...@gmail.com wrote:
  Hey guys.
 
  This is not an Android issue per-se, but I am puzzled about a Java issue
 and
  want to pick your brains.
 
  I recently got a couple of bug reports with a NPE that I don't
 understand
  and can't reproduce myself. Here is an abbreviated representation of the
  offending class. I tried to stay as close to the actual code as
 possible.
 
  public class EntryManager {
 
private static EntryManager instance;
private MapDBQuery, Boolean isMarkAllReadPossibleCache;
 
private EntryManager(Context ctx) {
  ..
  isMarkAllReadPossibleCache = new HashMapDBQuery, Boolean();
  ..
}
 
public static synchronized EntryManager getInstance(final Context
 context)
  {
 if (instance == null)
 instance = new EntryManager(context.getApplicationContext());
 return instance;
 }
 
 void fireModelUpdated(final String atomId) {
  ..
  isMarkAllReadPossibleCache.clear();
  ..
 }
 
public boolean isMarkAllReadPossible(final DBQuery dbq) {
  if (!isMarkAllReadPossibleCache.containsKey(dbq))
  isMarkAllReadPossibleCache.put(dbq,
  databaseHelper.isMarkAllReadPossible(dbq));
 
 return isMarkAllReadPossibleCache.get(dbq); !-- NPE is raised
 here
  }
 ..
 
  }
 
  In the last line from above a NPE is thrown. So the instance variable
  isMarkAllReadPossibleCache must be null, right? But I don't see where
 this
  could happen. It's initialized in the constructor and never set to null
  afterwards.
 
  For completeness here is a stack trace:
 
  java.lang.NullPointerException
  at
 com.newsrob.EntryManager.isMarkAllReadPossible(EntryManager.java:1529)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.shouldMarkAllReadButtonBeEnabled(AbstractNewsRobListActivity.java:327)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.access$2(AbstractNewsRobListActivity.java:215)
  -- removed the private access modifier meanwhile
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity$13.run(AbstractNewsRobListActivity.java:626)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)
 
  Any ideas?
 
  Cheers,
  Mariano

 --
 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.comandroid

Re: [android-developers] Re: Need help with a Java issue

2010-06-23 Thread Mariano Kamp
Thanks Adam.

That was exactly my issue.

Written on a mobile device

On Jun 24, 2010 12:20 AM, Adam Powell ad...@android.com wrote:
 The line reporting the NPE is implicitly unboxing the Boolean returned by
 your Map's get method to retrieve a primitive boolean value. If get
returns
 null it would have the behavior you describe.

 On Tue, Jun 22, 2010 at 4:23 PM, Indicator Veritatis mej1...@yahoo.com
wrote:

 Hi, Mariano

 True, this is a Java question, not an Android question. SO it doesn't
 r-e-a-l-l-y belong here. But in the interest of speeding you on your
 way, I will make a couple observations I hope you will find helpful.

 1) no, the NPE does not imply that isMarkAllReadPossibleCache is the
 null variable. Rather, it implies that in the course of trying to
 execute the get method of isMarkAllReadPossibleCache, the DVM
 encountered a null pointer.

 2) the NPE occurred during the call to UpdateButtons(), which in turn
 took place during the call to the above get() method.

 3) to tell in any more detail where it came from, I would need the
 rest of your stack trace, which you chose not to show. But now you
 have a better idea how to narrow this down by yourself, without
 exposing the code to us, I hope.

 On Jun 22, 2:59 am, Mariano Kamp mariano.k...@gmail.com wrote:
  Hey guys.
 
  This is not an Android issue per-se, but I am puzzled about a Java
issue
 and
  want to pick your brains.
 
  I recently got a couple of bug reports with a NPE that I don't
understand
  and can't reproduce myself. Here is an abbreviated representation of
the
  offending class. I tried to stay as close to the actual code as
possible.
 
  public class EntryManager {
 
  private static EntryManager instance;
  private MapDBQuery, Boolean isMarkAllReadPossibleCache;
 
  private EntryManager(Context ctx) {
  ..
  isMarkAllReadPossibleCache = new HashMapDBQuery, Boolean();
  ..
  }
 
  public static synchronized EntryManager getInstance(final Context
 context)
  {
  if (instance == null)
  instance = new EntryManager(context.getApplicationContext());
  return instance;
  }
 
  void fireModelUpdated(final String atomId) {
  ..
  isMarkAllReadPossibleCache.clear();
  ..
  }
 
  public boolean isMarkAllReadPossible(final DBQuery dbq) {
  if (!isMarkAllReadPossibleCache.containsKey(dbq))
  isMarkAllReadPossibleCache.put(dbq,
  databaseHelper.isMarkAllReadPossible(dbq));
 
  return isMarkAllReadPossibleCache.get(dbq); !-- NPE is raised
 here
  }
  ..
 
  }
 
  In the last line from above a NPE is thrown. So the instance variable
  isMarkAllReadPossibleCache must be null, right? But I don't see where
 this
  could happen. It's initialized in the constructor and never set to null
  afterwards.
 
  For completeness here is a stack trace:
 
  java.lang.NullPointerException
  at
com.newsrob.EntryManager.isMarkAllReadPossible(EntryManager.java:1529)
  at
 

com.newsrob.activities.AbstractNewsRobListActivity.shouldMarkAllReadButtonBeEnabled(AbstractNewsRobListActivity.java:327)
  at
 

com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
  at
 

com.newsrob.activities.AbstractNewsRobListActivity.access$2(AbstractNewsRobListActivity.java:215)
  -- removed the private access modifier meanwhile
  at
 

com.newsrob.activities.AbstractNewsRobListActivity$13.run(AbstractNewsRobListActivity.java:626)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)
 
  Any ideas?
 
  Cheers,
  Mariano

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers

[android-developers] Need help with a Java issue

2010-06-22 Thread Mariano Kamp
Hey guys.

This is not an Android issue per-se, but I am puzzled about a Java issue and
want to pick your brains.

I recently got a couple of bug reports with a NPE that I don't understand
and can't reproduce myself. Here is an abbreviated representation of the
offending class. I tried to stay as close to the actual code as possible.

public class EntryManager {

  private static EntryManager instance;
  private MapDBQuery, Boolean isMarkAllReadPossibleCache;

  private EntryManager(Context ctx) {
..
isMarkAllReadPossibleCache = new HashMapDBQuery, Boolean();
..
  }

  public static synchronized EntryManager getInstance(final Context context)
{
   if (instance == null)
   instance = new EntryManager(context.getApplicationContext());
   return instance;
   }

   void fireModelUpdated(final String atomId) {
..
isMarkAllReadPossibleCache.clear();
..
   }

  public boolean isMarkAllReadPossible(final DBQuery dbq) {
if (!isMarkAllReadPossibleCache.containsKey(dbq))
isMarkAllReadPossibleCache.put(dbq,
databaseHelper.isMarkAllReadPossible(dbq));

   return isMarkAllReadPossibleCache.get(dbq); !-- NPE is raised here
}
   ..
}

In the last line from above a NPE is thrown. So the instance variable
isMarkAllReadPossibleCache must be null, right? But I don't see where this
could happen. It's initialized in the constructor and never set to null
afterwards.

For completeness here is a stack trace:

java.lang.NullPointerException
at com.newsrob.EntryManager.isMarkAllReadPossible(EntryManager.java:1529)
at
com.newsrob.activities.AbstractNewsRobListActivity.shouldMarkAllReadButtonBeEnabled(AbstractNewsRobListActivity.java:327)
at
com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
at
com.newsrob.activities.AbstractNewsRobListActivity.access$2(AbstractNewsRobListActivity.java:215)
-- removed the private access modifier meanwhile
at
com.newsrob.activities.AbstractNewsRobListActivity$13.run(AbstractNewsRobListActivity.java:626)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)

Any ideas?

Cheers,
Mariano

-- 
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

Re: [android-developers] Need help with a Java issue

2010-06-22 Thread Mariano Kamp
Hey Toni.

Yes, I verified that this is the exact spot where the NPE occurs. More than
10 times ;) It would be possible though that the tag I used wasn't accurate,
but even then I wouldn't know which of the variables could be null and fail
in that way. The databaseHelper is also initialized in the constructor.

No, I didn't leave out the synchronization, but I think it wouldn't make any
difference as this would only affect if an item is in the Map, not if the
Map is instantiated/null. This should be concluded after the constructor is
left and the object is kicked into life, right?
Just because I am so unsure, I tried to call Map.get as well as Map.put with
null and interestingly enough it works. If I put some Object with a key of
null into the Map I get the same object back when I access the Map again
with null as the key. But that is actually not really relevant here – I
think – as the NPE happens right on the last line and not inside the Map
implementation, which would be the case if the Map would have an issue with
a null.

Thanks for helping me to think here ;)

Cheers,
Mariano

On Tue, Jun 22, 2010 at 12:08 PM, Toni Menzel t...@okidokiteam.com wrote:

 Hi Mariano,

 First of all, did you leave out synchronization for simplicity in this
 mail or is it not in place at all ?
 (assuming you do access EntityManager from multiple threads).

 Also, pls doublecheck that EntryManager.java:1529 is really at the
 spot you indicated (cannot verify with complete sources).
 Specifically i am unsure about databaseHelper. Its just accessed in
 you example, so could be null.

 At best give the full file so we can check.

 Toni

 On Tue, Jun 22, 2010 at 11:59 AM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Hey guys.
  This is not an Android issue per-se, but I am puzzled about a Java issue
 and
  want to pick your brains.
  I recently got a couple of bug reports with a NPE that I don't understand
  and can't reproduce myself. Here is an abbreviated representation of the
  offending class. I tried to stay as close to the actual code as possible.
  public class EntryManager {
private static EntryManager instance;
private MapDBQuery, Boolean isMarkAllReadPossibleCache;
private EntryManager(Context ctx) {
  ..
  isMarkAllReadPossibleCache = new HashMapDBQuery, Boolean();
  databaseHelper = new DB(ctx);
  ..

}
public static synchronized EntryManager getInstance(final Context
 context)
  {
 if (instance == null)
 instance = new EntryManager(context.getApplicationContext());
 return instance;
 }
 void fireModelUpdated(final String atomId) {
  ..
  isMarkAllReadPossibleCache.clear();
  ..
 }
public boolean isMarkAllReadPossible(final DBQuery dbq) {
  if (!isMarkAllReadPossibleCache.containsKey(dbq))
  isMarkAllReadPossibleCache.put(dbq,
  databaseHelper.isMarkAllReadPossible(dbq));
 return isMarkAllReadPossibleCache.get(dbq); !-- NPE is raised
 here
  }
 ..
  }
  In the last line from above a NPE is thrown. So the instance variable
  isMarkAllReadPossibleCache must be null, right? But I don't see where
 this
  could happen. It's initialized in the constructor and never set to null
  afterwards.
  For completeness here is a stack trace:
 
  java.lang.NullPointerException
  at com.newsrob.EntryManager.isMarkAllReadPossible(EntryManager.java:1529)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.shouldMarkAllReadButtonBeEnabled(AbstractNewsRobListActivity.java:327)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.updateButtons(AbstractNewsRobListActivity.java:236)
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity.access$2(AbstractNewsRobListActivity.java:215)
  -- removed the private access modifier meanwhile
  at
 
 com.newsrob.activities.AbstractNewsRobListActivity$13.run(AbstractNewsRobListActivity.java:626)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)
  Any ideas?
  Cheers,
  Mariano
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 Toni Menzel
 Independent Software Developer
 Professional

[android-developers] Process.setProcessGroup() Unknown error?

2010-06-14 Thread Mariano Kamp
Hi,

did anybody encounter the RuntimeException with the message Unknown error?

Cheers,
Mariano

java.lang.RuntimeException: Unknown error
at android.os.Process.setProcessGroup(Native Method)
at android.app.ActivityThread.handleChangeTopApp(ActivityThread.java:3663)
at android.app.ActivityThread.access$4100(ActivityThread.java:126)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2039)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4595)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)

http://www.netmite.com/android/mydroid/frameworks/base/core/jni/android_util_Binder.cpp

-- 
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

Re: [android-developers] Re: Slow Eclipse on OS X

2010-06-14 Thread Mariano Kamp
Ok then. I downloaded the 32 bit version first and it got better after I
re-installed Eclipse, this time the 64 bit version. But maybe I am imagining
things.

On Mon, Jun 14, 2010 at 8:07 AM, Al Sutton a...@funkyandroid.com wrote:

 Of Eclipse?, yup, I'm using the 64 bit Coca build. I don't know if
 there is a 64 bit ADT, I just use what I'm offered in the Eclipse
 Install Software dialog.

 As a side note; my Macbook Pro runs everything it can in 64 bit mode
 (inc. the kernel), which isn't a common configuration and so might be
 an influencing factor, but I wouldn't have thought it would have such
 a noticeable effect, and it certainly doesn't have a similar effect on
 anything else I use (J2EE, Amazon plugin, Subversion, ...)

 Al.

 On Jun 13, 8:33 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Do you guys use the 64 bit download?
 
 
 
  On Sun, Jun 13, 2010 at 6:12 PM, David Horn pga...@gmail.com wrote:
   Al,
 
   Exactly the same thing happens to me on OS X.  I've accepted that I
   need to restart Eclipse every so often to solve the problem.  It's
   particularly exacerbated if using the XML tools - for example, layout
   or editing the manifest file the friendly way.
 
   Dave.
 
   On Jun 13, 8:54 am, Al Sutton a...@funkyandroid.com wrote:
It's been a problem for a while, I opened a bug athttp://
   code.google.com/p/android/issues/detail?id=6183so you can put
a star on it if you want to vote it up.
 
My experience is that it seems to be down to the layout previewer,
 the
more I use it the faster performance degrades.
 
Al.
 
P.S. Before anyone suggests tweaks to my eclipse.ini, I already have
ms  max perm size at 256m, mx at 1024m. My machine is a 4GB box with
a flash SSD, so the problem isn't physical memory space or disk i/o.
 
On Jun 12, 10:22 pm, Bill Lumberg poiuytr...@gmail.com wrote:
 
 I am running Eclipse Galileo on an Intel Mac and after using it for
 a
 bit, it becomes very slow.  By slow I mean switching between tabs
 and
 scrolling through source becomes nearly unusable.  I have to close
 Eclipse and re-open it, and that usually only solves the problem
 for a
 short time.
 
 Has anyone else ran into this and discovered a way to fix it?
 
 Thank you.
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] Re: Process.setProcessGroup() Unknown error?

2010-06-14 Thread Mariano Kamp
I checked 20 error reports and 100% were from either the HTC Desire or the
HTC Incredible.

On Mon, Jun 14, 2010 at 9:29 AM, Mariano Kamp mariano.k...@gmail.com
wrote:

Hi,

did anybody encounter the RuntimeException with the message Unknown error?

Cheers,

Mariano

java.lang.RuntimeException: Unknown error
at android.os.Process.setProcessGroup(Native Method)
at android.app.ActivityThread.handleChangeTopApp(ActivityThread.java:3663)
at android.app.ActivityThread.access$4100(ActivityThread.java:126)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2039)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4595)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)

http://www.netmite.com/android/mydroid/frameworks/base/core/jni/android_util_Binder.cpp

-- 
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

[android-developers] Re: Process.setProcessGroup() Unknown error?

2010-06-14 Thread Mariano Kamp
Forget it. I think I have the issue. Too many open files.

Maybe of interest to others: I frequently saved a preference (current
article) in the preferences, but this took ages as a whole XML tree needs to
be created and written to flash. To speed things up I changed the
implementation to a randome access file where I kept the handle(?)
(java.io.File) around. I always closed the file after reading/writing, but
never closed the File handle. What's new to me is that this produces lots of
open files. I would have expected that this is not the case as I always
close the actual RandomAccessFile. I was wrong it seems.

To find out about the files you need to know the pid of your app's process
and then I ran this:

adb -s emulator-5556 shell ls -l /proc/1160/fd

Which then produces something like this:

lrwx-- root root  2010-06-14 20:09 0 - /dev/null
lrwx-- root root  2010-06-14 20:09 1 - /dev/null
lrwx-- root root  2010-06-14 20:09 2 - /dev/null
l-wx-- root root  2010-06-14 20:09 3 - /dev/log/main
l-wx-- root root  2010-06-14 20:09 4 - /dev/log/radio
l-wx-- root root  2010-06-14 20:09 5 - /dev/log/events
lr-x-- root root  2010-06-14 20:09 6 -
/system/framework/core.jar
lr-x-- root root  2010-06-14 20:09 7 -
/system/framework/ext.jar
lr-x-- root root  2010-06-14 20:09 8 -
/system/framework/framework.jar
lrwx-- root root  2010-06-14 20:09 9 - /dev/ashmem
lrwx-- root root  2010-06-14 20:09 10 - socket:[41904]
lr-x-- root root  2010-06-14 20:09 11 -
/system/framework/android.policy.jar
lr-x-- root root  2010-06-14 20:09 12 -
/system/framework/services.jar
lr-x-- root root  2010-06-14 20:09 13 -
/system/framework/framework.jar
lr-x-- root root  2010-06-14 20:09 14 -
/system/fonts/DroidSans.ttf
lr-x-- root root  2010-06-14 20:09 15 -
/system/framework/core.jar
lr-x-- root root  2010-06-14 20:09 16 - /dev/urandom
lr-x-- root root  2010-06-14 20:09 17 -
/system/framework/framework-res.apk
lr-x-- root root  2010-06-14 20:09 18 - pipe:[41905]
l-wx-- root root  2010-06-14 20:09 19 - pipe:[41905]
lrwx-- root root  2010-06-14 20:09 20 - socket:[41908]
lrwx-- root root  2010-06-14 20:09 21 - /dev/binder
lrwx-- root root  2010-06-14 20:09 22 - /dev/ashmem
lrwx-- root root  2010-06-14 20:09 23 - /dev/ashmem
lr-x-- root root  2010-06-14 20:09 24 -
/data/app/com.newsrob.apk
lr-x-- root root  2010-06-14 20:09 25 -
/data/app/com.newsrob.apk
lr-x-- root root  2010-06-14 20:09 26 -
/data/app/com.newsrob.apk
lrwx-- root root  2010-06-14 20:09 27 -
/data/data/com.newsrob/databases/newsrob.db
lrwx-- root root  2010-06-14 20:09 28 -
/system/fonts/DroidSansFallback.ttf
lrwx-- root root  2010-06-14 20:09 29 - /dev/ashmem
lrwx-- root root  2010-06-14 20:09 30 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 31 - /dev/ashmem
lrwx-- root root  2010-06-14 20:09 33 -
/data/data/com.newsrob/databases/webview.db
lr-x-- root root  2010-06-14 20:10 34 -
/system/fonts/DroidSans-Bold.ttf
lrwx-- root root  2010-06-14 20:10 35 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 36 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 37 -
/data/data/com.newsrob/databases/webviewCache.db
lrwx-- root root  2010-06-14 20:10 38 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 40 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 41 - /dev/ashmem
lrwx-- root root  2010-06-14 20:11 42 - /dev/ashmem
lrwx-- root root  2010-06-14 20:11 43 - /dev/ashmem
lrwx-- root root  2010-06-14 20:10 45 - /dev/ashmem

(The version with the bug had a couple of more lines pointing to my
currentArticle file).

Hope this helps somebody else also.

No idea why this only happened to Desire/Incredibles.

On Mon, Jun 14, 2010 at 6:37 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 I checked 20 error reports and 100% were from either the HTC Desire or the
 HTC Incredible.

 On Mon, Jun 14, 2010 at 9:29 AM, Mariano Kamp mariano.k...@gmail.com
 wrote:

 Hi,

 did anybody encounter the RuntimeException with the message Unknown
 error?

 Cheers,

 Mariano

 java.lang.RuntimeException: Unknown error
 at android.os.Process.setProcessGroup(Native Method)
 at android.app.ActivityThread.handleChangeTopApp(ActivityThread.java:3663

[android-developers] Re: Delivery Status Notification (Failure)

2010-06-14 Thread Mariano Kamp
Hi Keith.

Hmmh, yes, that's how I do it too. I include my actual code below that is
expressed differently, but the important part seems to be the same.

You can reproduce the issue every time? Maybe then it is just a coincidence
that it doesn't happen anymore to my users?! Or there is something else at
play?!

Cheers,
Mariano

Method setBuiltInZoomControlsMethod = null;
try {
setBuiltInZoomControlsMethod =
webSettings.getClass().getMethod(setBuiltInZoomControls,
new Class[] { boolean.class });
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
}

if (setBuiltInZoomControlsMethod != null) {
try {
setBuiltInZoomControlsMethod.invoke(webSettings, new
Object[] { getEntryManager()
.areHoveringZoomControlsEnabled() });
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
} else {
FrameLayout zoomControlContainer = (FrameLayout)
findViewById(R.id.browse_zoom);
zoomControlContainer.addView(webView.getZoomControls());
webView.getZoomControls().setVisibility(View.GONE);
}

Hi Mariano,

   Thanks for getting back to me!  I tried disabling zoom controls in
 my listview's webviews via:

 webView.getSettings().setBuiltInZoomControls(false);

 However I am still getting the issue.  Is there another way to
 disable?  Any help is much appreciated.

 Keith

 On Mon, Jun 14, 2010 at 1:47 PM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Hey Keith,
  I think it would be best to keep the discussion public, so that other may
  chip in / learn from it. If you agree, please cc: android-dev in your
  response.
  Anyway, no, unfortunately not really. This seems only to happen on the
  Incredible. What I am 99% sure of is that this is related to the hw
  accelerated zoom controls (a user found out through testing). In NewsRob
 I
  meanwhile disable them for the Incredible. No issues since then.
  Do you use WebView's built-in zoom controls at all?
  Cheers,
  Mariano
 
  On Mon, Jun 14, 2010 at 7:40 PM, KeithWrightbos 
 keithwright...@gmail.com
  wrote:
 
  Hi Mariano,
 
I created an android app that is also experiencing a SIGSEV for
  users only on the HTC Incredible.  I was wondering if you happened to
  find the cause of the issue you saw?  Mine occurs in an activity that
  has a list view whose cells consist of a remotely loaded image, some
  text, and a webview.  I believe the webview is causing the issue but
  have yet to look into it too deeply.  Below is the stack I'm getting.
 
  Thank you,
Keith
 
  Build fingerprint: 'verizon/inc/inc/inc:2.1-update1/ERE27/161494:user/
  release-keys'
  pid: 592, tid: 593  com.jnj.mocospace.android 
  signal 11 (SIGSEGV), fault addr 2f736f33
   r0 2f736f33 r1  r2 2f736f33 r3 
   r4 006f9f28 r5 2f736f2f r6  r7 4184bf5c
   r8 100ffc60 r9 4184bf54 10 100ffd88 fp 4184bf54
   ip ac13e62c sp 100ffc30 lr ac04a9b8 pc afb04524 cpsr 2010
  #00 pc 4524 /system/lib/libcutils.so
  #01 pc 0004a9b4 /system/lib/libskia.so
  #02 pc 0004aa60 /system/lib/libskia.so


-- 
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

Re: [android-developers] Re: Slow Eclipse on OS X

2010-06-13 Thread Mariano Kamp
Do you guys use the 64 bit download?

On Sun, Jun 13, 2010 at 6:12 PM, David Horn pga...@gmail.com wrote:

 Al,

 Exactly the same thing happens to me on OS X.  I've accepted that I
 need to restart Eclipse every so often to solve the problem.  It's
 particularly exacerbated if using the XML tools - for example, layout
 or editing the manifest file the friendly way.

 Dave.

 On Jun 13, 8:54 am, Al Sutton a...@funkyandroid.com wrote:
  It's been a problem for a while, I opened a bug athttp://
 code.google.com/p/android/issues/detail?id=6183so you can put
  a star on it if you want to vote it up.
 
  My experience is that it seems to be down to the layout previewer, the
  more I use it the faster performance degrades.
 
  Al.
 
  P.S. Before anyone suggests tweaks to my eclipse.ini, I already have
  ms  max perm size at 256m, mx at 1024m. My machine is a 4GB box with
  a flash SSD, so the problem isn't physical memory space or disk i/o.
 
  On Jun 12, 10:22 pm, Bill Lumberg poiuytr...@gmail.com wrote:
 
 
 
   I am running Eclipse Galileo on an Intel Mac and after using it for a
   bit, it becomes very slow.  By slow I mean switching between tabs and
   scrolling through source becomes nearly unusable.  I have to close
   Eclipse and re-open it, and that usually only solves the problem for a
   short time.
 
   Has anyone else ran into this and discovered a way to fix it?
 
   Thank you.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Re: Using a ListView and an Adapter: How to use notifyDataSetChanged()?

2010-06-11 Thread Mariano Kamp
Hey Streets,

thanks.

Actually I already run this on the UI thread.

Here is my code (from a ListActivity):

updateCursorRunnable = new Runnable() {
public void run() {
updateCursor();
refreshUI();
}
};

  Above you see the Runnable that later on will be executed on the UI
thread.

  Here are the implementations: (I didn't cut anything out this time, maybe
I making in error in the unimportant stuff. If you see something else that
needs improving, like the changing of cursors, let me know.).

   private boolean updateCursor() {
boolean cursorChanged = false;

if (dbQuery.hasChanged()) {
final Cursor oldCursor = listAdapter.getCursor();
if (oldCursor != null)
stopManagingCursor(oldCursor);

final Cursor cursor =
getEntryManager().getContentCursor(dbQuery);
startManagingCursor(cursor);
listAdapter.changeCursor(cursor);
// listAdapter.notifyDataSetChanged();
cursorChanged = true;

} else {
Timing t = null;
if (NewsRob.isDebuggingEnabled(this))
t = new Timing(ArticleListActivity::requery, this);
// listAdapter.notifyDataSetChanged(); doesn't work. use requery
// instead
listAdapter.getCursor().requery();   * -- That's what I
mean. Would prefer notifyDataSetChanged.*

if (t != null)
t.stop();
}
return cursorChanged;
}

void refreshUI() {
((BaseAdapter) getListAdapter()).notifyDataSetChanged();
updateButtons();
updateControlPanelTitle();
refreshProgressBar();
if (getListAdapter().getCount() == 0  !isTaskRoot())
finish();
}

And the Runnable is triggered like this:

 @Override
public void modelUpdated() {
Timing t = new Timing(modelUpdated(), this);
runOnUiThread(updateCursorRunnable);
t.stop();
}

  Any ideas?

Cheers,
Mariano

On Fri, Jun 11, 2010 at 4:21 PM, Streets Of Boston
flyingdutc...@gmail.comwrote:

 I don't know your code, but it looks like the notifiyDataSetChanged()
 (like many other methods that can update the UI) needs to be called on
 the main GUI thread.

 You need to get hold of a View or a Hander (that was created on the
 main GUI thread, e.g. in your onCreate()) and call 'post' on it:

 // the code is executed by your background thread
 ... do stuff ...
 ...
 // communicate that the list needs updating
 viewOrHandler.post(new Runnable() {
  public void run() {
myListAdapter.notifyDataSetChanged();
  }
 });
 ...


 On Jun 3, 2:55 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Hi.
 
  Just watched Google IO's World Of ListView presentation [1]. Awesome
  stuff. I think every Android dev should watch it.
 
  One gotcha for me was to use BaseAdapter.notifyDataSetChanged[2]. I
 checked
  code that I have written more than a year ago and found that I did try to
  use that, but commented it out with '// doesn't work' and I use requery()
  instead. That is of course much slower.
 
  I now tried to find out why I wrote that it didn't work and hoped that I
 am
  meanwhile so much wiser that it would be easier to understand the proper
 use
  of the API. So much for ambition:  The effect I see is that the list is
 not
  updated after I call notifyDataSetChanged(), but works with requery() and
 I
  am not so much wiser ;-(
 
  What could be the issue here? I use a ResourceCursorAdapter and only
  implemented the bindView() Method. This method is called when I call
  notifyDataSetChanged() on the RCAdapter. However the method is called
 with a
  cursor that contains the stale data.
 
  Now there was a second gotcha from the presentation that I couldn't
 really
  place. It was said that the data should be committed on the GUI thread
 too
  (before calling notifyDataSetChanged()). I couldn't place it then, but I
 now
  suspect that this may be the issue here. So the rule would be to do the
  commit() on the Cursor on the UI thread?
  I do the updates to the database using a Service. This Service runs in
 the
  background, sometimes the app is in the foreground at the same time, but
  most often not. So I don't see how I should commit something in a UI
 thread?
  Is this the issue here? There are two different Cursors and I could only
 use
  notifyDataSetChanged when it would be the same cursor, otherwise
 requery()
  is correct?
 
  Is that it? Any ideas?
 
  Is somebody going to write a book The Android SDK - The missing manual?
  ;-)
 
  Cheers,
  Mariano
 
  [1]
 http://code.google.com/events/io/2010/sessions/world-of-listview-andr...
  [2]
 http://developer.android.com/reference/android/widget/BaseAdapter.htm...()

 --
 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

[android-developers] Re: Using a ListView and an Adapter: How to use notifyDataSetChanged()?

2010-06-10 Thread Mariano Kamp
Anybody?
:-)

On Thursday, June 3, 2010, Mariano Kamp mariano.k...@gmail.com wrote:
 Hi.
 Just watched Google IO's World Of ListView presentation [1]. Awesome stuff. 
 I think every Android dev should watch it.
 One gotcha for me was to use BaseAdapter.notifyDataSetChanged[2]. I checked 
 code that I have written more than a year ago and found that I did try to use 
 that, but commented it out with '// doesn't work' and I use requery() 
 instead. That is of course much slower.

 I now tried to find out why I wrote that it didn't work and hoped that I am 
 meanwhile so much wiser that it would be easier to understand the proper use 
 of the API. So much for ambition:  The effect I see is that the list is not 
 updated after I call notifyDataSetChanged(), but works with requery() and I 
 am not so much wiser ;-(

 What could be the issue here? I use a ResourceCursorAdapter and only 
 implemented the bindView() Method. This method is called when I call 
 notifyDataSetChanged() on the RCAdapter. However the method is called with a 
 cursor that contains the stale data.

 Now there was a second gotcha from the presentation that I couldn't really 
 place. It was said that the data should be committed on the GUI thread too 
 (before calling notifyDataSetChanged()). I couldn't place it then, but I now 
 suspect that this may be the issue here. So the rule would be to do the 
 commit() on the Cursor on the UI thread?
 I do the updates to the database using a Service. This Service runs in the 
 background, sometimes the app is in the foreground at the same time, but most 
 often not. So I don't see how I should commit something in a UI thread? Is 
 this the issue here? There are two different Cursors and I could only use 
 notifyDataSetChanged when it would be the same cursor, otherwise requery() is 
 correct?

 Is that it? Any ideas?
 Is somebody going to write a book The Android SDK - The missing manual? ;-)
 Cheers,Mariano

 [1] http://code.google.com/events/io/2010/sessions/world-of-listview-android.html[2]
  
 http://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged()


-- 
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


[android-developers] Using a ListView and an Adapter: How to use notifyDataSetChanged()?

2010-06-03 Thread Mariano Kamp
Hi.

Just watched Google IO's World Of ListView presentation [1]. Awesome
stuff. I think every Android dev should watch it.

One gotcha for me was to use BaseAdapter.notifyDataSetChanged[2]. I checked
code that I have written more than a year ago and found that I did try to
use that, but commented it out with '// doesn't work' and I use requery()
instead. That is of course much slower.

I now tried to find out why I wrote that it didn't work and hoped that I am
meanwhile so much wiser that it would be easier to understand the proper use
of the API. So much for ambition:  The effect I see is that the list is not
updated after I call notifyDataSetChanged(), but works with requery() and I
am not so much wiser ;-(

What could be the issue here? I use a ResourceCursorAdapter and only
implemented the bindView() Method. This method is called when I call
notifyDataSetChanged() on the RCAdapter. However the method is called with a
cursor that contains the stale data.

Now there was a second gotcha from the presentation that I couldn't really
place. It was said that the data should be committed on the GUI thread too
(before calling notifyDataSetChanged()). I couldn't place it then, but I now
suspect that this may be the issue here. So the rule would be to do the
commit() on the Cursor on the UI thread?
I do the updates to the database using a Service. This Service runs in the
background, sometimes the app is in the foreground at the same time, but
most often not. So I don't see how I should commit something in a UI thread?
Is this the issue here? There are two different Cursors and I could only use
notifyDataSetChanged when it would be the same cursor, otherwise requery()
is correct?

Is that it? Any ideas?

Is somebody going to write a book The Android SDK - The missing manual?
;-)

Cheers,
Mariano

[1]
http://code.google.com/events/io/2010/sessions/world-of-listview-android.html
[2]
http://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged()

-- 
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

Re: [android-developers] App Widget Lifecycle?

2010-06-01 Thread Mariano Kamp
Not really. I meanwhile just stopped feeling that I was doing it wrong ;-)
It's probably meant to be used this way.

I now display my widget in an invalid state first and then configure it
afterwards.

On Sun, May 30, 2010 at 9:35 AM, Yuvi yuvidr...@gmail.com wrote:

 Hey,

 have you solved this problem? I am facing right now the exact same thing
 (that onEnabled() is called when the Configuration utility is launched, and
 not when the actual widget is placed on the home screen).


 Thanks!
 Yuvi

 --
 YuviDroid
 http://android.yuvalsharon.net

 On Sat, Feb 27, 2010 at 7:51 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hey guys,

   I am bit puzzled by an app widget's lifecyle.

   When I create a widget my own configuration activity is launched,
 some data is entered, I store this data some place and call finish on
 my config activity like this:

 Intent resultValue = new Intent();
 resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
 setResult(RESULT_OK, resultValue);
 finish();

 Now I would expect to see something like that in my log:

 I/System.out(  312):
 onReceive...=android.appwidget.action.APPWIDGET_ENABLED
 I/System.out(  312):
 onReceive...=android.appwidget.action.APPWIDGET_UPDATE

 But as a matter of fact those log entries from above are created when
 the configuration activity is *started*. Is that right? Am I doing
 something wrong here?
 Should I invent some artificial limbo/default state for the widget
 that can be displayed when it is in its configuration mode?

 Cheers,
 Mariano

 --

 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en





  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Android cursor lifetime

2010-06-01 Thread Mariano Kamp
The code you show doesn't contain the issue you describe as there is no code
that would use the cursor.

It seems strange that you close the database before reading from the
cursor.
The usual course of events is open the database, create the cursor, read
from the cursor, close the cursor, close the database.

Btw. In Java variable names start with a lower case letter.

On Sat, May 29, 2010 at 1:49 PM, Vikram vikram.bodiche...@gmail.com wrote:

 I have the following piece of code, which is behaving in a very
 strange manner.

 1. When I run this code, the Cursor always carries 0 rows.
 2. I know this sounds stupid, but when I debug the code, it carries
 all the rows in my table.
 3. Alternatively, when I do not close the database and run through it,
 it carries all the rows.

 Is this a timing issue of some sort? Has it anything to do with the
 cursor's lifetime? Will the cursor be invalid if I close the database
 and the openlitehelper? Why in that case do I get valid data if I
 debug through the code.

 //Open the database
 openForRead();

 StringBuilder query = new StringBuilder(SELECT );

 //Append the projection columns
 SQLiteQueryBuilder.appendColumns(query, projection);

 //Force append the _ID column
 SQLiteQueryBuilder.appendColumns(query, new String[]{,  +
 _IDColumnName +  AS  + BaseColumns._ID});

 //From tablename
 query.append(FROM  + tableName);

 //Query the database and return the cursor
 C = database.rawQuery(query.toString(), null);

 //Close the database
 close();

 return C;

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

[android-developers] AlertDialog's good looks for an Activity?

2010-05-31 Thread Mariano Kamp
I like the looks of the Alert Dialog and wonder if there is any official way
to use those looks (icon, title, divider, grey gradient background for the
button bar) in an Activity?

The Activity does the same thing as a dialog, and uses Theme.Dialog, but
must be an Activity.

Cheers,
Mariano

-- 
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

[android-developers] Easy way to find out the current activity in unit tests?

2010-05-27 Thread Mariano Kamp
Hi,

I want to test an activity that might be already finished() and the control
flow has moved on to another activity. Hence in a test I would like to make
sure first that I am still on the activity that I want to test.

Is there any way to find out what the current activity displayed is or if my
activity is currently displayed?

I know that I could work around it with overloading onResume/onPause to
track the activities state explicitly, but I was wondering if there is an
easier way to do it.

Cheers,

Mariano

-- 
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

[android-developers] Night Mode?

2010-05-27 Thread Mariano Kamp
Hey guys,

how does it work? I can see that I can query the
UiModeManagerhttp://developer.android.com/reference/android/app/UiModeManager.html
for
yes/no/auto, whereby auto means that it is set by time/luminance?! I
can then ask the
Configurationhttp://developer.android.com/reference/android/content/res/Configuration.html#UI_MODE_NIGHT_NOabout
the actual value.

Right so far?

How would a user change the night mode, e.g. enable auto. Shouldn't there
be a system wide setting? Is there a setting to tell the phone/emulator how
to find out if it is night? Can't seem to find any setting in that respect
(Display, Dock, ...).

Cheers,

Mariano

-- 
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

Re: [android-developers] Re: Multitouch / Pinch To Zoom in Android 2.2?

2010-05-21 Thread Mariano Kamp
No, that is not the case. Since 2.1 update 1 pinch to zoom works on the N1
(and Milestone), but only when this is set:
http://developer.android.com/intl/zh-TW/reference/android/webkit/WebSettings.html#setBuiltInZoomControls(boolean)

Looking at the code would not tell me what the API changes are. And as I
said I didn't find in the official documentation. So it likely isn't there
until I don't look in the right place.

On Fri, May 21, 2010 at 5:22 AM, Nerdrow troybe...@gmail.com wrote:

 There is no generic multitouch, you interpret MotionEvents and
 perform the zoom yourself.  Looks like they made this easier in 2.2 w/
 ScaleGestureDetector, which at a glance looks to be the same as the
 class in Gallery2.  You can read that code to see how its implemented.

 On May 20, 6:54 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Hi.
 
  In Android 2.1 update 1 multitouch was silently added. Unfortunately
  it is only available when also the zoom picker is **active**?! I am
  sure there are cases where that setting makes sense, but it was not
  possible to separately turn on one or the other.
  I thought they didn't want to change the API with with an update-1
  and would now surface the API in Android 2.2.
  At least my initial check didn't turn up anything in that respect though
 ;-(.
 
  Also I don't know if multi-touch pinch/zoom still works in Android
  2.2, because I don't know how to test it on the emulator. Does anybody
  know or has other insights to share?
 
  On a sidebar. Do I see this right? The developers get the new Android
  version before their users? Loving it! Thanks.
 
  Cheers,
  Mariano
 
  Btw. OT, but the first 45 minutes of the keynote totally rocked. Much
  better than the latest three Steve Notes combined.
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group athttp://
 groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] Multitouch / Pinch To Zoom in Android 2.2?

2010-05-20 Thread Mariano Kamp
Hi.

In Android 2.1 update 1 multitouch was silently added. Unfortunately
it is only available when also the zoom picker is **active**?! I am
sure there are cases where that setting makes sense, but it was not
possible to separately turn on one or the other.
I thought they didn't want to change the API with with an update-1
and would now surface the API in Android 2.2.
At least my initial check didn't turn up anything in that respect though ;-(.

Also I don't know if multi-touch pinch/zoom still works in Android
2.2, because I don't know how to test it on the emulator. Does anybody
know or has other insights to share?

On a sidebar. Do I see this right? The developers get the new Android
version before their users? Loving it! Thanks.

Cheers,
Mariano

Btw. OT, but the first 45 minutes of the keynote totally rocked. Much
better than the latest three Steve Notes combined.

-- 
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


[android-developers] NewsRob 3.9 Beta

2010-05-17 Thread Mariano Kamp
NewsRob 3.9: apk http://claudia-und-mariano.net/newsrob390.apk

- Images that are wider than the current screen are downsized proportionally
so that they fit. This happens for the feed view and the simplified web
view. It should work with different screen resolutions, magnifications and
orientations. However a change in one of the aforementioned parameters makes
it necessary to reload the content, which you can force with two taps on the
article header.
- Dark theme added for night time reading. (Pro)
  This does not apply to the web view, except for already downloaded
Simplified Web Pages. The background is a bit darker for the Web Pages and
not downloaded Simplified Web Pages too.
- Swipe gesture on the article list has been re-implemented by hand and
should be much more reliable now.
- Notification will be shown when a download is interrupted because the
reserved space is under run.
- Page downloads that take longer than 2 minutes are now interrupted
automatically.
- Hovering zoom controls are disabled on the HTC Incredible until further
notice (Mark L./Tejas, please test ;-)
- Now that Android 2.0 is on its way out (
http://developer.android.com/resources/dashboard/platform-versions.html) I
removed the workaround for an Android 2.0 bug. As a result the apk is now
60KB lighter. For people with Android 2.0 devices the icons will look a bit
fuzzy now - please upgrade.
- Unread Only is now the default sync type for new installs.
- NewsRob will not sync/download pages when background data is disabled.
- Release notes are launched in the browser ... which are non-existing at
the moment.
- Returning to an empty feed list will now close it, if it is not the root
task. This is now consistent to the other lists' behaviors.
- Major internal reworks. Everything could be broken ;-)

This version is compatible with the current version in the Market.
Hence if anything goes wrong: Hit Sync followed by Clear Cache and
uninstall the beta afterward. Then re-install the version from the Market.

Let me know what you think and if you hit any bumps ...

-- 
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

[android-developers] Re: NewsRob 3.9 Beta

2010-05-17 Thread Mariano Kamp
So sorry, I am an idiot. Wrong list.

Again, very sorry ;-

On Mon, May 17, 2010 at 8:25 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 NewsRob 3.9: apk http://claudia-und-mariano.net/newsrob390.apk

 - Images that are wider than the current screen are downsized
 proportionally so that they fit. This happens for the feed view and the
 simplified web view. It should work with different screen resolutions,
 magnifications and orientations. However a change in one of the
 aforementioned parameters makes it necessary to reload the content, which
 you can force with two taps on the article header.
 - Dark theme added for night time reading. (Pro)
   This does not apply to the web view, except for already downloaded
 Simplified Web Pages. The background is a bit darker for the Web Pages and
 not downloaded Simplified Web Pages too.
 - Swipe gesture on the article list has been re-implemented by hand and
 should be much more reliable now.
 - Notification will be shown when a download is interrupted because the
 reserved space is under run.
 - Page downloads that take longer than 2 minutes are now interrupted
 automatically.
 - Hovering zoom controls are disabled on the HTC Incredible until further
 notice (Mark L./Tejas, please test ;-)
 - Now that Android 2.0 is on its way out (
 http://developer.android.com/resources/dashboard/platform-versions.html) I
 removed the workaround for an Android 2.0 bug. As a result the apk is now
 60KB lighter. For people with Android 2.0 devices the icons will look a bit
 fuzzy now - please upgrade.
 - Unread Only is now the default sync type for new installs.
 - NewsRob will not sync/download pages when background data is disabled.
 - Release notes are launched in the browser ... which are non-existing at
 the moment.
 - Returning to an empty feed list will now close it, if it is not the root
 task. This is now consistent to the other lists' behaviors.
 - Major internal reworks. Everything could be broken ;-)

 This version is compatible with the current version in the Market.
 Hence if anything goes wrong: Hit Sync followed by Clear Cache and
 uninstall the beta afterward. Then re-install the version from the Market.

 Let me know what you think and if you hit any bumps ...


-- 
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

Re: [android-developers] Layout Issue: Status Bar Space Remains Empty || Status Bar Animation

2010-05-15 Thread Mariano Kamp
Meanwhile I've also seen this layout issue in the emulator.

On Wed, May 12, 2010 at 6:58 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Ok, I see. That also means that I can't sync my animation to the default
 hide animation from the status bar, right?

 Any idea what to do about the layout issue referred to as (1) above?


 On Wed, May 12, 2010 at 6:40 PM, Romain Guy romain...@android.com wrote:

 Applications do not have access to the status bar. It's controlled only by
 the system and lives in a different process and a different window.

 On Wed, May 12, 2010 at 5:09 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 (1)

 I have an issue with the following code:

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 WindowManager.LayoutParams.FLAG_FULLSCREEN);

 On my emulator this seems to work fine. The status bar disappears and the
 empty space is filled with the content view. However on my Nexus One this
 sometimes works and sometimes the empty space remains empty/black.

 Any idea why this happens?

 I tried to counteract this, but my naive approach wasn't fruitful:

 handler.postDelayed(new Runnable() {

   @Override
  public void run() {
  v.getRootView().invalidate();
  v.getRootView().requestLayout();
  v.getRootView().forceLayout();

  }
  }, 800);

 I tried those things from above separately, synchronously and delayed.


 (2)

  Also I wanted to check if I can remove the status bar's animation or tap
 into that with my own animation. To do that I tried to find the status bar.
 But using Activity.getWindow().getDecorView() and View.getRootView() both
 returned the same View, but it doesn't have the status bar as a child:

 [image: Screen shot 2010-05-12 at 2.02.44 PM.png]

 That's also what the status bar shows. My content starts with the NO_ID
 container, but above that there is no status bar.

 What's up with that? Is it hidden from ordinary apps? Could I still tap
 into its animation?

 Cheers,
 Mariano

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
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=enScreen shot 2010-05-12 at 2.02.44 PM.png

[android-developers] Layout Issue: Status Bar Space Remains Empty || Status Bar Animation

2010-05-12 Thread Mariano Kamp
(1)

I have an issue with the following code:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

On my emulator this seems to work fine. The status bar disappears and the
empty space is filled with the content view. However on my Nexus One this
sometimes works and sometimes the empty space remains empty/black.

Any idea why this happens?

I tried to counteract this, but my naive approach wasn't fruitful:

handler.postDelayed(new Runnable() {

 @Override
 public void run() {
 v.getRootView().invalidate();
 v.getRootView().requestLayout();
 v.getRootView().forceLayout();

 }
 }, 800);

I tried those things from above separately, synchronously and delayed.


(2)

Also I wanted to check if I can remove the status bar's animation or tap
into that with my own animation. To do that I tried to find the status bar.
But using Activity.getWindow().getDecorView() and View.getRootView() both
returned the same View, but it doesn't have the status bar as a child:

[image: Screen shot 2010-05-12 at 2.02.44 PM.png]

That's also what the status bar shows. My content starts with the NO_ID
container, but above that there is no status bar.

What's up with that? Is it hidden from ordinary apps? Could I still tap into
its animation?

Cheers,
Mariano

-- 
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=enScreen shot 2010-05-12 at 2.02.44 PM.png

Re: [android-developers] Layout Issue: Status Bar Space Remains Empty || Status Bar Animation

2010-05-12 Thread Mariano Kamp
Ok, I see. That also means that I can't sync my animation to the default
hide animation from the status bar, right?

Any idea what to do about the layout issue referred to as (1) above?

On Wed, May 12, 2010 at 6:40 PM, Romain Guy romain...@android.com wrote:

 Applications do not have access to the status bar. It's controlled only by
 the system and lives in a different process and a different window.

 On Wed, May 12, 2010 at 5:09 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 (1)

 I have an issue with the following code:

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
 WindowManager.LayoutParams.FLAG_FULLSCREEN);

 On my emulator this seems to work fine. The status bar disappears and the
 empty space is filled with the content view. However on my Nexus One this
 sometimes works and sometimes the empty space remains empty/black.

 Any idea why this happens?

 I tried to counteract this, but my naive approach wasn't fruitful:

 handler.postDelayed(new Runnable() {

   @Override
  public void run() {
  v.getRootView().invalidate();
  v.getRootView().requestLayout();
  v.getRootView().forceLayout();

  }
  }, 800);

 I tried those things from above separately, synchronously and delayed.


 (2)

  Also I wanted to check if I can remove the status bar's animation or tap
 into that with my own animation. To do that I tried to find the status bar.
 But using Activity.getWindow().getDecorView() and View.getRootView() both
 returned the same View, but it doesn't have the status bar as a child:

 [image: Screen shot 2010-05-12 at 2.02.44 PM.png]

 That's also what the status bar shows. My content starts with the NO_ID
 container, but above that there is no status bar.

 What's up with that? Is it hidden from ordinary apps? Could I still tap
 into its animation?

 Cheers,
 Mariano

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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=enScreen shot 2010-05-12 at 2.02.44 PM.png

Re: [android-developers] Re: On using themes?!

2010-05-11 Thread Mariano Kamp
Hi Dianne.

Thanks very much, almost there.

I understand the procedure, it would do what I want, but I run into an
exception:

D/NewsRobDefaultExceptionHandler( 1839): Caused by:
java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
D/NewsRobDefaultExceptionHandler( 1839): at
android.content.res.TypedArray.getColor(TypedArray.java:273)
D/NewsRobDefaultExceptionHandler( 1839): at
android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:647)
D/NewsRobDefaultExceptionHandler( 1839): at
android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
D/NewsRobDefaultExceptionHandler( 1839): at
android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
D/NewsRobDefaultExceptionHandler( 1839): at
android.content.res.Resources.loadDrawable(Resources.java:1690)

This happens when using it the way we described here in a drawable xml.
However to better understand the error I used it on other attributes and
when using it on the background attribute of a View it works. Maybe this
approach is incompatible with drawables that are expressed in xml?

Btw. Is there any way to get the actual #rgb string for a color from a
theme?

Cheers,
Mariano

On Tue, May 11, 2010 at 8:02 AM, Dianne Hackborn hack...@android.comwrote:

 You need to define an attribute for your value:

 attr name=myColor format=color /

 Then make a custom theme that supplies a value for it:

 style name=MyTheme parent=android:Theme
 item name=com.my.package:myColor#ff808080/item
 /style

  And now you can reference that value from other XML:

 shape xmlns:android=http://schemas.android.com/apk/res/android
 
 android:shape=rectangle
 gradient android:startColor=?com.my.package:myColor

 android:endColor=#66FF
 android:angle=270 /
 /shape


 Note that com.my.package is your manifest's package name.

 Also I just wrote this by hand so I won't guarantee it is completely right.
 :}

 On Mon, May 10, 2010 at 11:02 AM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hmmh, also no answer to this question on themes. Maybe the answer cannot
 be given with two lines? So let me explain what I would expect step by step
 and you stop me were I deviate from the Golden Path? I'll try yes/no
 questions.

 In the simplest terms I would expect that in every place I can specify a
 color in RGB (#) I could also specify a symbolic name instead. This
 should work like @color/xyz, but with one more level of indirection that
 lets me switch between themes, like dark and light.

 Is that possible?

 I would expect those themes to be applicable to (a) widgets, (b) drawables
 (see the mentioned example) and (c) when I need to style something myself
 like HTML. Are (a) - (c) possible?

 Furthermore I would expect that I could define style keys myself, but I
 got the impression that only keys from the android namespace can be used?
 That lead me to believe that you can't define abstract colors, but only
 styles for specific attributes used in the widgets' implementations.

 And again, if there is any meaningful documentation I would be happy to
 read it. Just send me the link or name of the book.


 On Sat, May 8, 2010 at 3:26 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hi,

 I have trouble 
 (examplehttp://groups.google.com/group/android-developers/browse_thread/thread/5b4ce3e49a1b63d2/)
 wrapping my head around styles/themes. Can somebody help me or point me to
 actual documentation?

 Let's say I have a drawable that I want to use as the background of a
 layout:

 shape xmlns:android=http://schemas.android.com/apk/res/android;
 android:shape=rectangle
 gradient android:startColor=#9F9FA4 android:endColor=#66FF
 android:angle=270 /
 /shape


 Now I want to have a dark and a light theme. Depending on the chosen theme 
 I want to have a different value for startColor and endColor. How do I do 
 that? I am aware of extending themes, but what do I put into the items? How 
 do I reference those new values then?


 Cheers,

 Mariano


  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 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

[android-developers] Re: On using themes?!

2010-05-10 Thread Mariano Kamp
Hmmh, also no answer to this question on themes. Maybe the answer cannot be
given with two lines? So let me explain what I would expect step by step and
you stop me were I deviate from the Golden Path? I'll try yes/no questions.

In the simplest terms I would expect that in every place I can specify a
color in RGB (#) I could also specify a symbolic name instead. This
should work like @color/xyz, but with one more level of indirection that
lets me switch between themes, like dark and light.

Is that possible?

I would expect those themes to be applicable to (a) widgets, (b) drawables
(see the mentioned example) and (c) when I need to style something myself
like HTML. Are (a) - (c) possible?

Furthermore I would expect that I could define style keys myself, but I got
the impression that only keys from the android namespace can be used? That
lead me to believe that you can't define abstract colors, but only styles
for specific attributes used in the widgets' implementations.

And again, if there is any meaningful documentation I would be happy to read
it. Just send me the link or name of the book.

On Sat, May 8, 2010 at 3:26 PM, Mariano Kamp mariano.k...@gmail.com wrote:

 Hi,

 I have trouble 
 (examplehttp://groups.google.com/group/android-developers/browse_thread/thread/5b4ce3e49a1b63d2/)
 wrapping my head around styles/themes. Can somebody help me or point me to
 actual documentation?

 Let's say I have a drawable that I want to use as the background of a
 layout:

 shape xmlns:android=http://schemas.android.com/apk/res/android;
 android:shape=rectangle
 gradient android:startColor=#9F9FA4 android:endColor=#66FF
 android:angle=270 /
 /shape


 Now I want to have a dark and a light theme. Depending on the chosen theme I 
 want to have a different value for startColor and endColor. How do I do that? 
 I am aware of extending themes, but what do I put into the items? How do I 
 reference those new values then?


 Cheers,

 Mariano



-- 
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

[android-developers] On using themes?!

2010-05-08 Thread Mariano Kamp
Hi,

I have trouble 
(examplehttp://groups.google.com/group/android-developers/browse_thread/thread/5b4ce3e49a1b63d2/)
wrapping my head around styles/themes. Can somebody help me or point me to
actual documentation?

Let's say I have a drawable that I want to use as the background of a
layout:

shape xmlns:android=http://schemas.android.com/apk/res/android;
android:shape=rectangle
gradient android:startColor=#9F9FA4 android:endColor=#66FF
android:angle=270 /
/shape


Now I want to have a dark and a light theme. Depending on the chosen
theme I want to have a different value for startColor and endColor.
How do I do that? I am aware of extending themes, but what do I put
into the items? How do I reference those new values then?


Cheers,

Mariano

-- 
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

Re: [android-developers] Re: How to debug BadTokenException?

2010-05-03 Thread Mariano Kamp
My main issue is to find out what is really causing the BadTokenException.
Any way how to find out which code initiated the message that caused the
BadTokenException or which activity was expected to be running.

On Sun, Dec 20, 2009 at 1:03 PM, Chander Pechetty cspeche...@gmail.comwrote:

 As an example take the case of Market App. It doesn't give any toast
 or progress when you leave the app. Once the user leaves the app for
 whatever reason, only a notification is given if the download fails/
 succeeds.
 Any progress dialogs you have when you leave the app should be
 dismissed/cleaned up in the onPause. Depending on what kind of app
 yours is, you can either show a notification (may be from the service
 once the Task is completed, after it attempts several retries in case
 of error) using the NotificationManager, or I would just cancel the
 Task if I was using a AsyncTask.

 I wouldn't want a toast or progress result/or a force close  show up
 when I receive a call, or trying to use some other app; those make
 sense only when I am looking at your app.



 On Dec 19, 10:38 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Thanks for your help here.
 
  I reas the bug report, but I am not quite sure what to make of it and
 what
  the solution is.
 
  In my case the user enters username/password and then I show a progress
  monitor. When the user backs out or goes to home then I still want to
  display the result, at least when an error occurred.
 
  How is this to be accomplished?
 
  Can I somehow find out beforehand if I will run in this error and then
 use
  some other mean, say a toast, to at least notify the user that not all is
  good?
 
  On Mon, Nov 23, 2009 at 8:01 AM, Chander Pechetty cspeche...@gmail.com
 wrote:
 
   There are currently few issues logged around this bug:
  http://code.google.com/p/android/issues/detail?id=3953
 
   I don't know your specific case, but was easy to fix in my case, when
   I made sure that the dialogs/views/adapters that were being created
   are with the right context/activity.
   Pressing a back button usually finishes the activity, so if you have
   created for discussion sake created an static ListAdapter and passed
   it (this), an activity instance,
 
this static adapter can no longer be used for showing dialogs etc.
   with the previous contexts. This behaviour gets complex depending on
   the launch modes/flags you set when starting an activity, and also
   whether you handle back button events.
 
   So token
   android.os.binderpr...@431d28f0 is not valid; is your activity
   running?  means your activity instance is no longer in History stack,
   but your are trying to use it somewhere.
   Since there is no knowing when your activity got finished and the
   sequence of steps that caused it, depending on different modes, you
   get sporadic reports.
 
   -Chander
 
   On Nov 22, 1:23 pm, Mariano Kamp mariano.k...@gmail.com wrote:
Hey,
 
  I sporadically get bug reports with a BadTokenException.
 
  As I don't see my app in the stacktrace I am wondering how to find
 the
cause of this? Any idea?
 
Cheers,
Mariano
 
-- Android Version: sdk=3, release=1.5, inc=eng.root.20090719.200906
-- Memory free: 1.01MB total: 4.01MB max: 16.00MB
-- Custom ROM: Stock Android
-- NewsRob Version: 3.2.9/329
-- Stacktrace:(1178)
android.view.WindowManager$BadTokenException: Unable to add window --
   token
android.os.binderpr...@431d28f0 is not valid; is your activity
 running?
at android.view.ViewRoot.setView(ViewRoot.java:425)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:392)
at
  
 android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2674)
at
  
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
at android.app.ActivityThread.access$1800(ActivityThread.java:112)
at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
 
  
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr

Re: [android-developers] Re: How to debug SIGSEV?

2010-05-01 Thread Mariano Kamp
Thanks Fadden.

I only got reports on the Incredible. I'll check if the users are able to
reproduce it consistently.

Cheers,
Mariano

On Sat, May 1, 2010 at 12:13 AM, fadden fad...@android.com wrote:

 On Apr 30, 1:22 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  I am wondering if there is any way to debug a SIGSEV? I have not much
  experience with those native crashs. This issue only seems to happen with
  the HTC Incredible and I would at least guess that my Java code cannot be
  the actual cause, but maybe there is something I can do to avoid
 triggering
  it?
 [...]
  04-30 15:33:23.514 D/dalvikvm( 1263): GC freed 10573 objects / 916872
 bytes
  in 64ms
  04-30 15:33:23.534 E/webcoreglue( 1263): The real object has been deleted
  04-30 15:33:23.634 I/DEBUG   (   57): *** *** *** *** *** *** *** *** ***
  *** *** *** *** *** *** ***
  04-30 15:33:23.634 I/DEBUG   (   57): Build fingerprint:
  'verizon/inc/inc/inc:2.1-update1/ERE27/161493:user/release-keys'
  04-30 15:33:23.634 I/DEBUG   (   57): pid: 1263, tid: 1264  
 com.newsrob
  

 Since it's not a Google build I can't decode the stack trace.  If you
 have an APK and series of steps that reproduces the problem reliably,
 post a bug on b.android.com with the APK attached.  If we can make it
 happen on one of our devices we can dig further.  If not, it may be
 specific to the Incredible and you will have to work with HTC.

 Based on the log message and the library list it looks like it could
 be a libskia (graphics library) problem.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

Re: [android-developers] Re: Extracting colors from Themes?

2010-04-30 Thread Mariano Kamp
Hey Nick,

that's the thing. It's not that easy.

Checkout what I wrote in my initial post:

item name=colorBackground@android:color/background_dark/item
item
name=textColorPrimary@android:color/primary_text_dark/item

They basically look the same right? And they are both public, right?
However so far I have only been able to pry the RGB values from the
framework's hands for the first, but not the second.
And I think it's my fault. It is not straight forward. I think you need to
possibly deal with drawables (hopefully not, as this would never give me rgb
values) and color state lists. That's the reason I was looking for
documentation and sample uses in codesearch.google.com, but to no avail.

Cheers,
Mariano

On Thu, Apr 29, 2010 at 9:11 PM, patbenatar patbena...@gmail.com wrote:

 Mariano-

 Well if the colors are publicly accessible you could access them
 directly [find out the color resource identifiers by digging through
 the source for the system theme/style xml files.. available in the Git
 repo], something like: @android:color/resourceid .. This will allow
 you to use the same colors a theme is using [providing those color
 resources are public.. I've never tried this].

 -Nick



 On Apr 29, 2:46 am, Mariano Kamp mariano.k...@gmail.com wrote:
  Hey Pat.
 
  Thanks for your chipping in.
 
  No, I could also hardcode the colors and that is what it seems I will
 have
  to do. In my particular case it won't make much difference at the moment.
  For now I just need two values and they correspond to the light and dark.
  But for the future my needs will grow and it is also not so much fun to
  maintain a shadow theme administration on the side.
 
  I would have preferred to be a model citizen on the Android platform and
 use
  the themes. Hardcoding might be the quickest solution, but would fail if
 I
  want to use platform properties that are overwritten by vendor themes.
  To give you an example. On a stock Android device you'll see an orange
  background behind a selected list item, on an HTC sense device it would
 be
  green instead.
 
  Also as themes look so central to me, I was kind of hoping that I just
  missed the relevant documentation and that somebody else would point me
 to
  RTFM ;-)
 
  Cheers
  Mariano
 
  On Tue, Apr 27, 2010 at 9:38 AM, patbenatar patbena...@gmail.com
 wrote:
 
  Do you need to be doing this programatically? You could always take a
  screenshot of your phone [either using DDMS on a non-rooted device or
  the PicMe app on a rooted device] and then grab the colors using
  Photoshop or any image editing software. Another option, again not
  programmatic, would be to download the Android source [or you can
  browse it online in the Git repo] and find the declarations for those
  colors.
 
  -Nick
 
  On Apr 26, 3:23 am, Mariano Kamp mariano.k...@gmail.com wrote:
 
 
 
 
 
   Hi,
 
   I want to use colors from a Theme to apply it to HTML my app is
 rendering.
  I
   am wondering if I can do that?
 
   I am looking to use colors like they are specified in themes.xml:
 
   item
   name=colorForeground@android:color/bright_foreground_dark/item
   ..
   item
 name=colorBackground@android:color/background_dark/item
   ..
   item
   name=textColorPrimary@android:color/primary_text_dark/item
   ..
 
   So it looks to me those are declared in the same way.
 
   When trying to access those values this way:
 
   TypedValue tv = new TypedValue();
   getTheme().resolveAttribute(android.R.attr.colorBackground, tv,
   true);
 
   System.out.println(tv.string= + tv.string);
   System.out.println(tv.coerced= + tv.coerceToString());
 
   int colorResourceId = getResources().getColor(tv.resourceId);
   System.out.println(colorResourceId= + colorResourceId);
 
   tv = new TypedValue();
   getTheme().resolveAttribute(android.R.attr.textColorPrimary,
 tv,
   true);
 
   System.out.println(tv.string= + tv.string);
   System.out.println(tv.coerced= + tv.coerceToString());
 
   colorResourceId = getResources().getColor(tv.resourceId);
   System.out.println(colorResourceId= + colorResourceId);
 
   I get this as a result:
 
   I/System.out( 1578): tv.string=null
   I/System.out( 1578): tv.coerced=#
   I/System.out( 1578): colorResourceId=-1
 
   I/System.out( 1578): tv.string=res/color/primary_text_light.xml
   I/System.out( 1578): tv.coerced=res/color/primary_text_light.xml
   I/System.out( 1578): colorResourceId=-16777216
 
   The results are different. The first one actually gives me the color
   #fff which would work for me, the second one only gives me an
 xml.
 
   Do I need to jump through a few more hoops here to resolve the actual
  color?
   Does my original intention work at all? Maybe it won't work, because
  colors
   could be arbitrary drawables?
 
   I didn't find any relevant documentation, but if you know any, just
 point
  me

Re: [android-developers] Re: Device Seeding Program for Top Android Market Developers

2010-04-30 Thread Mariano Kamp
The package is waiting for me at my home too, Frankfurt, Germany.

Thanks Google!

On Fri, Apr 30, 2010 at 3:00 PM, Vaervarsel vaervar...@gmail.com wrote:

 2010/4/30 Trygve trygv...@gmail.com

 @Vaervarsel:
 Did you get it delivered to the door by FedEx, or did you get it by
 Posten (local mail)?
 http://groups.google.com/group/android-developers?hl=en


 To the door by FedEx. Call FedEx Oslo and ask them to search for the
 package sent from Netherlands at 28. april.



 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] How to debug SIGSEV?

2010-04-30 Thread Mariano Kamp
Hi,

I am wondering if there is any way to debug a SIGSEV? I have not much
experience with those native crashs. This issue only seems to happen with
the HTC Incredible and I would at least guess that my Java code cannot be
the actual cause, but maybe there is something I can do to avoid triggering
it?

Where can I find more information? Is it possible to see which of my code
lines triggered it?

Cheers,
Mariano

04-30 15:33:23.329 I/ActivityManager(   77): Starting activity: Intent {
dat=newsrob://act?activity=com.newsrob.activities.ShowArticleActivityFILTER_LABEL=all%20articlesFILTER_FEED=10HIDE_READ_ARTICLES=trueSORT_ASC=false
flg=0x8 cmp=com.newsrob/.activities.ShowArticleActivity (has extras) }
04-30 15:33:23.404 D/MultiTouchDetector( 1263): MultiTouchDetector
v0.36,bAccelerate=true
04-30 15:33:23.514 D/dalvikvm( 1263): GC freed 10573 objects / 916872 bytes
in 64ms
04-30 15:33:23.534 E/webcoreglue( 1263): The real object has been deleted
04-30 15:33:23.634 I/DEBUG   (   57): *** *** *** *** *** *** *** *** ***
*** *** *** *** *** *** ***
04-30 15:33:23.634 I/DEBUG   (   57): Build fingerprint:
'verizon/inc/inc/inc:2.1-update1/ERE27/161493:user/release-keys'
04-30 15:33:23.634 I/DEBUG   (   57): pid: 1263, tid: 1264   com.newsrob

04-30 15:33:23.634 I/DEBUG   (   57): signal 11 (SIGSEGV), fault addr
0003
04-30 15:33:23.634 I/DEBUG   (   57):  r0 0003  r1   r2
0003  r3 4184bf90
04-30 15:33:23.634 I/DEBUG   (   57):  r4 0003  r5 0014a9f0  r6
  r7 4184bf5c
04-30 15:33:23.634 I/DEBUG   (   57):  r8 100ffcf8  r9 4184bf54  10
4184bf40  fp 00169e20
04-30 15:33:23.634 I/DEBUG   (   57):  ip ac13e62c  sp 100ffcb8  lr
ac04a340  pc afb04524  cpsr 2010
04-30 15:33:23.654 I/DEBUG   (   57):  #00  pc 4524
/system/lib/libcutils.so
04-30 15:33:23.654 I/DEBUG   (   57):  #01  pc 0004a33c
/system/lib/libskia.so
04-30 15:33:23.654 I/DEBUG   (   57):  #02  pc 0004a9a0
/system/lib/libskia.so
04-30 15:33:23.654 I/DEBUG   (   57):  #03  pc 0004aa60
/system/lib/libskia.so
04-30 15:33:23.654 I/DEBUG   (   57):  #04  pc 0004408e
/system/lib/libandroid_runtime.so
04-30 15:33:23.654 I/DEBUG   (   57):  #05  pc eef4
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #06  pc 00038c18
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #07  pc 00013bf8
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #08  pc 00019790
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #09  pc 00018c60
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #10  pc 0004f834
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #11  pc 0004f85c
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #12  pc 000453d6
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #13  pc 00045462
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #14  pc 000458ec
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #15  pc 00042cac
/system/lib/libdvm.so
04-30 15:33:23.654 I/DEBUG   (   57):  #16  pc fdf4
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57):  #17  pc f8c0
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57):
04-30 15:33:23.654 I/DEBUG   (   57): code around pc:
04-30 15:33:23.654 I/DEBUG   (   57): afb04514 e8bd4010 e12fff1e e92d4010
e1a02000
04-30 15:33:23.654 I/DEBUG   (   57): afb04524 e592 e3e03a0f e28fe004
e2401001
04-30 15:33:23.654 I/DEBUG   (   57): afb04534 e243f03f 3af9 e2810001
e8bd4010
04-30 15:33:23.654 I/DEBUG   (   57):
04-30 15:33:23.654 I/DEBUG   (   57): code around lr:
04-30 15:33:23.654 I/DEBUG   (   57): ac04a330 e354 08bd8070 e1a4
ebff7662
04-30 15:33:23.654 I/DEBUG   (   57): ac04a340 e351 0a02 e3a03000
e5853000
04-30 15:33:23.654 I/DEBUG   (   57): ac04a350 e8bd8070 e1a4 ebff85a5
e3a03000
04-30 15:33:23.654 I/DEBUG   (   57):
04-30 15:33:23.654 I/DEBUG   (   57): stack:
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc78  afe3db80
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc7c  afe0f190
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc80  afe3db80
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc84  afe0f190
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc88  
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc8c  afe0f0a8
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc90  afe3db80
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc94  afe0f190
/system/lib/libc.so
04-30 15:33:23.654 I/DEBUG   (   57): 100ffc98  afe3db80
04-30 15:33:23.674 I/DEBUG   (   57): 100ffc9c  afe0f190
/system/lib/libc.so
04-30 15:33:23.674 I/DEBUG   (   57): 100ffca0  
04-30 15:33:23.674 I/DEBUG   (   57): 100ffca4  afe0f0a8
/system/lib/libc.so
04-30 15:33:23.674 I/DEBUG   (   57): 100ffca8  0001
04-30 15:33:23.674 I/DEBUG   (   57): 100ffcac 

Re: [android-developers] Re: Extracting colors from Themes?

2010-04-29 Thread Mariano Kamp
Hey Pat.

Thanks for your chipping in.

No, I could also hardcode the colors and that is what it seems I will have
to do. In my particular case it won't make much difference at the moment.
For now I just need two values and they correspond to the light and dark.
But for the future my needs will grow and it is also not so much fun to
maintain a shadow theme administration on the side.

I would have preferred to be a model citizen on the Android platform and use
the themes. Hardcoding might be the quickest solution, but would fail if I
want to use platform properties that are overwritten by vendor themes.
To give you an example. On a stock Android device you'll see an orange
background behind a selected list item, on an HTC sense device it would be
green instead.

Also as themes look so central to me, I was kind of hoping that I just
missed the relevant documentation and that somebody else would point me to
RTFM ;-)

Cheers
Mariano

On Tue, Apr 27, 2010 at 9:38 AM, patbenatar patbena...@gmail.com wrote:

Do you need to be doing this programatically? You could always take a
screenshot of your phone [either using DDMS on a non-rooted device or
the PicMe app on a rooted device] and then grab the colors using
Photoshop or any image editing software. Another option, again not
programmatic, would be to download the Android source [or you can
browse it online in the Git repo] and find the declarations for those
colors.

-Nick


On Apr 26, 3:23 am, Mariano Kamp mariano.k...@gmail.com wrote:
 Hi,

 I want to use colors from a Theme to apply it to HTML my app is rendering.
I
 am wondering if I can do that?

 I am looking to use colors like they are specified in themes.xml:

 item
 name=colorForeground@android:color/bright_foreground_dark/item
 ..
 item name=colorBackground@android:color/background_dark/item
 ..
 item
 name=textColorPrimary@android:color/primary_text_dark/item
 ..

 So it looks to me those are declared in the same way.

 When trying to access those values this way:

 TypedValue tv = new TypedValue();
 getTheme().resolveAttribute(android.R.attr.colorBackground, tv,
 true);

 System.out.println(tv.string= + tv.string);
 System.out.println(tv.coerced= + tv.coerceToString());

 int colorResourceId = getResources().getColor(tv.resourceId);
 System.out.println(colorResourceId= + colorResourceId);

 tv = new TypedValue();
 getTheme().resolveAttribute(android.R.attr.textColorPrimary, tv,
 true);

 System.out.println(tv.string= + tv.string);
 System.out.println(tv.coerced= + tv.coerceToString());

 colorResourceId = getResources().getColor(tv.resourceId);
 System.out.println(colorResourceId= + colorResourceId);

 I get this as a result:

 I/System.out( 1578): tv.string=null
 I/System.out( 1578): tv.coerced=#
 I/System.out( 1578): colorResourceId=-1

 I/System.out( 1578): tv.string=res/color/primary_text_light.xml
 I/System.out( 1578): tv.coerced=res/color/primary_text_light.xml
 I/System.out( 1578): colorResourceId=-16777216

 The results are different. The first one actually gives me the color
 #fff which would work for me, the second one only gives me an xml.

 Do I need to jump through a few more hoops here to resolve the actual
color?
 Does my original intention work at all? Maybe it won't work, because
colors
 could be arbitrary drawables?

 I didn't find any relevant documentation, but if you know any, just point
me
 there please.

 Btw. I also tried obtainStyledAttributes(), but this had basically the
same
 issues.

 Cheers,
 Mariano


 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group athttp://
groups.google.com/group/android-developers?hl=en

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
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

Re: [android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-29 Thread Mariano Kamp
Now we have this great article:
http://android-developers.blogspot.com/2010/04/multitasking-android-way.html

Services can further negotiate this behavior by requesting they be
considered foreground. This places the service in a please don't kill
state, but requires that it include a notification to the user about it
actively running. This is useful for services such as background music
playback or car navigation, which the user is actively aware of; when you're
playing music and using the browser, you can always see the music-playing
glyph in the status bar. Android won't try to kill these services, but as a
trade-off, ensures the user knows about them and is able to explicitly stop
them when desired.

But like in the API documentation it doesn't mention that the thread/process
gets a prio boost when running with the foreground flag.

On Tue, Apr 13, 2010 at 6:42 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Ok, I'll explain in detail. There are two issues in this story: (a)
 killability of the service (b) execution prio of the service

 In the good old days I just
 used  Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST) in my
 service and things went wonderfully. My sync service ran and took as much
 CPU was available, but the foreground app got all it needed too.

 In rare cases my service was shot down, but as my service could deal with
 that it was more a matter of efficiency than of data loss, so it was ok.

 Progressively over time this happened more frequently though. With
 information from you that we discussed on this list the story looked to me
 like this: It became en vogue for many popular services to call
 setForeground(). That lead to my services being shot down much more
 frequently, to the point where it became really painful because my service
 sometimes didn't even last for two seconds.

 At the time I understood from what you said that I should consider calling
 setForeground() and that you will make it no-op in a future release and at
 the same time introduce a new API to replace the old one with the addition
 that a notification needs to be shown, so that the user sees what's going on
 and can punish apps that misuse this feature.

 Now it took some time for me to get to the new API, because I need to
 implement a useful notification first. To make the new notification useful I
 rewrote my progress reporting, introduced remote views etc. to show the sync
 phases and their progress in the notification. I also let the user set if
 s/he wants to see the notification and get the added stability or not.

 The old setForeground() only had an effect on the killability of the
 process, but not on the scheduling priority. The priority I was then able to
 set independently to low as I don't want to slow down the foreground app in
 recognizing gestures or other stuff in the foreground that needs low
 latency.

 With the advent of startForeground() this doesn't work anymore, because
 signaling in the foreground, killability and scheduling priority seem to
 have been rolled into one.

 It would be great if those things could be independently controlled like it
 was possible before. And maybe it still is today? Process.setThreadPrio()
 doesn't do the trick anymore though.

 Don't get me wrong it is ok, when my activities sometimes get killed. If
 there were API for that I would also let the OS know when I would prefer not
 to (startCriticalSection()) and when it is cool to kill my activities.

 As we are on the topic. It is not so cool to be just shot down. I would
 prefer to get a signal that I am about to be shut down and get some time to
 finish what I am doing in a grace period and then clean up (and save my
 state). This would even be ok when this trigger would come earlier than the
 OS actually absolutely needs to do it.

 Ok, now back to your question. Let me give you two examples. One is not so
 much of a problem today, I just try to explain what kind of uses I see, the
 other one is what this thread is about.

 (a) I store articles' metadata in a sqlite database in the phone memory and
 the actual content (html, css, images) on the sd card.

 As part of the sync some articles are removed. So I run over all articles
 that are eligible for removal in the database. If I would get a signal to
 clean up as outlined above I would break before I start deleting a new
 article.

 But back to what is implemented today. For each article I have to remove
 the database record and the files on the sd card. The former is very fast,
 the latter is slow.

 It can happen that my process is suddenly killed in the middle of the
 removal of an article. Hence I first removed the assets on the sd card, then
 the database record. This way in the next sync I can clean up the rest and
 only have the issue that between syncs (or restarts) some assets are missing
 and articles are displayed with errors.

 It would be *nicer* if I could invoke startCriticalSection() for the
 removal of each article

[android-developers] Extracting colors from Themes?

2010-04-26 Thread Mariano Kamp
Hi,

I want to use colors from a Theme to apply it to HTML my app is rendering. I
am wondering if I can do that?

I am looking to use colors like they are specified in themes.xml:

item
name=colorForeground@android:color/bright_foreground_dark/item
..
item name=colorBackground@android:color/background_dark/item
..
item
name=textColorPrimary@android:color/primary_text_dark/item
..

So it looks to me those are declared in the same way.

When trying to access those values this way:

TypedValue tv = new TypedValue();
getTheme().resolveAttribute(android.R.attr.colorBackground, tv,
true);

System.out.println(tv.string= + tv.string);
System.out.println(tv.coerced= + tv.coerceToString());

int colorResourceId = getResources().getColor(tv.resourceId);
System.out.println(colorResourceId= + colorResourceId);

tv = new TypedValue();
getTheme().resolveAttribute(android.R.attr.textColorPrimary, tv,
true);

System.out.println(tv.string= + tv.string);
System.out.println(tv.coerced= + tv.coerceToString());

colorResourceId = getResources().getColor(tv.resourceId);
System.out.println(colorResourceId= + colorResourceId);

I get this as a result:

I/System.out( 1578): tv.string=null
I/System.out( 1578): tv.coerced=#
I/System.out( 1578): colorResourceId=-1

I/System.out( 1578): tv.string=res/color/primary_text_light.xml
I/System.out( 1578): tv.coerced=res/color/primary_text_light.xml
I/System.out( 1578): colorResourceId=-16777216

The results are different. The first one actually gives me the color
#fff which would work for me, the second one only gives me an xml.

Do I need to jump through a few more hoops here to resolve the actual color?
Does my original intention work at all? Maybe it won't work, because colors
could be arbitrary drawables?

I didn't find any relevant documentation, but if you know any, just point me
there please.

Btw. I also tried obtainStyledAttributes(), but this had basically the same
issues.

Cheers,
Mariano

-- 
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

[android-developers] How to use WebView in Offline mode? Can I dynamically revoke permissions?

2010-04-20 Thread Mariano Kamp
Hi,

I am want to use JavaScript to process some HTML pages in the background.

WebView seems to be a great basis to do this. There is one issue though. I
don't want to display the web page and its images/stylesheets right away, so
it is a waste of bandwidth when the stylesheets and images are downloaded. I
am wondering how to tell WebView not to do that.

I tried WebSettings.setLoadsImagesAutomatically(false), but this still loads
the stylesheets. WebView.setNetworkAvailable(false) is more an information
for WebView than a switch. Overriding
WebViewClient.shouldOverrideUrlLoading(..) didn't work either.

Any idea how to do this?

One thing that works is not giving the app the required Internet permission.
Unfortunately it is not that simple, because at other times I want to
display the processed pages and then it should download the
images/stylesheets ;-( But still is there some way that I can use this
permission thing? Can I dynamically revoke the permission? For a single
thread or process?

Cheers,

Mariano

-- 
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

Re: [android-developers] How to use WebView in Offline mode? Can I dynamically revoke permissions?

2010-04-20 Thread Mariano Kamp

  There is one issue though.
  I don't want to display the web page and its images/stylesheets right
  away, so it is a waste of bandwidth when the stylesheets and images are
  downloaded. I am wondering how to tell WebView not to do that.



 Try setCacheMode(WebSettings.LOAD_CACHE_ONLY) on the WebSettings object,
 which you get from getSettings() on the WebView.


Sounds good. I will try that.

-- 
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

Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-14 Thread Mariano Kamp
I had a look into it and this approach doesn't work for me.

When using the SQLiteOpenHelper you cannot pass in this flag.

I tried to work around the SQLiteOpenHelper first, but then it delegates to
the context, which itself uses private API and now have to copy/patch at
least four classes. I also found a reference to private API (FileUtils) that
uses some obscure modes that I don't want to touch as I don't really
understand them.
I fear to take a problem that a couple of hundred users of my app have to a
problem that will affect every user ;)

But thanks for your hint anyway.


On Mon, Apr 12, 2010 at 10:39 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Skink,

 awesome. That sounds fantastic. I will try that.

 Cheers,
 Mariano


 On Mon, Apr 12, 2010 at 7:45 PM, skink psk...@gmail.com wrote:



 On Apr 9, 2:36 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  *bump*
 
  On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.com
 wrote:
 
 
 
   Hi,
 
   recently I very often get error reports from users that upgrade their
 OS.
   This includes at least 1.5, 1.6, 2.1 and custom ROMs.
 
   Anybody else seeing these? Any idea what to do about it?
 
   Cheers,
   Mariano
 

 i had similar problem too, i solved it by adding flag
 SQLiteDatabase.NO_LOCALIZED_COLLATORS when calling
 SQLiteDatabase.openDatabase

 hth
 pskink

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.




-- 
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

Re: [android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-13 Thread Mariano Kamp
 example: The Android download service. What I am writing
here is just from observations as user, I haven't looked at the API or the
code. (And I might be totally wrong, because I tried a couple of times to
download a video using the download service  and it never completed).

Anyway, some http servers allow retries, some don't, so for the later it
would be very unfortunate if the download process gets killed after 50 MB of
a 100MB file, because the download service would need to re-download the
50MBs after a restart again.

Now the download service sports a notification, so it may use the new API,
but that would clearly be wrong as it also boosts the scheduling prio which
is totally the wrong thing to do here as the download doesn't need low
latency at all. I just think it would not be a practical problem, because
downloads tend to be I/O bound almost 100% of the time. But I still hope you
see the picture I am trying to convey here?

Cheers,

Mariano

On Tue, Apr 13, 2010 at 1:05 AM, Dianne Hackborn hack...@android.com
wrote:

Why do you want to use startForeground()?  What is it giving you?  If you
want your code to run in the background, it is probably not what you want.

On Mon, Apr 12, 2010 at 2:04 PM, Mariano Kamp mariano.k...@gmail.com
wrote:

1) CPU is not a problem per se. My process can happily be starved of CPU,
but as it needs to do xml parsing it does task the CPU albeit at it's lowest
prio.

2) As I said I rely on an external API that doesn't understand incremental
updates.

Anyway, I think there is no good solution and the usefulness of this thread
is nearing zero now, so I will stop before I waste anymore of everybody's
time. Thanks so far.

On Mon, Apr 12, 2010 at 10:58 PM, Mark Murphy mmur...@commonsware.com
wrote:

 Mariano Kamp wrote:

 Quoting myself:

 And you have done so wonderfully.

 What is it your trying to say though?

 That it is ok to raise the priority when I don't want my process to be
 killed.

I'm saying what Ms. Hackborn confirmed in her reply to my post --
startForeground() elevates the service's process to the foreground
priority class. The not-too-unreasonable assumption the SDK makes is
that something that is supposed to be in the foreground is supposed to
be in the foreground. I mean, foreground is in the method's name.
There's no question the documentation could be stronger, though.

That being said, your choices are:

1. Continue using startForeground() and either live with the complaints
or modify your service to be less CPU-intensive, or

2. Stop using startForeground() and modify your architecture to better
support the service being shut down

Since Android applications have to support their services being shut
down (via task killers, the Services screen in Settings, etc.), I would
think #2 would be the better answer, but that's your call.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in NYC: 4-6 June 2010: http://guruloft.com

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.

  --

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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 

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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
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

Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-12 Thread Mariano Kamp
Now a user was nice enough to run some commands for me. It seems that the
database is there and is not corrupt:

# ls -l /data/data/com.newsrob/databases
ls -l /data/data/com.newsrob/databases

-rw-rw app_108  app_108 16384 2010-04-11 13:12 webview.db
-rw-rw app_108  app_108  6144 2010-04-11 13:12 webviewCache.db
-rw-rw app_108  app_108277504 2010-04-11 16:38 newsrob.db

And with sqlite3 from the command line:

select count(*) from entries;
51

On Sat, Apr 10, 2010 at 9:10 AM, Mariano Kamp mariano.k...@gmail.com
wrote:

Yes, that worked for me too. Actually re-installing the apps on the users'
phones alone was enough.

But this is just dealing with the symptoms and would've liked to know why
the OS updates break apps and if there are any counter measures the
developer can do?

And also meanwhile I got more than 50 of those issues (for a 65.000 active
installs app) and it really takes away from my time to work on my app.

As it seems that the Android OS developers don't chimp with enlightenment in
here I will automate the workaround then and let the user know that this
issue was caused by the OS updated and he should re-install my app and
potentially others.

On Sat, Apr 10, 2010 at 7:25 AM, Walter androidremotecont...@gmail.com
wrote:

Some users of my apps also reported same issue, also same exception in
the log.

What you can do is:

Uninstall your app, power off, power on. if that doesn't work and the
phone is rooted,  ask the user to clean the app cache, and not install
app on SDCard.

That resolved all these kind of open database and file corruption
issues.

Walter

On Apr 9, 12:46 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Mariano Kamp wrote:
   I could ask the people with custom ROMs to check if the db-file is
still
   there.

  Or add your own exception handler for this, do some experiments, and
  then send the results to yourself via whatever mechanism you're using to
  get the stack trace.

 That's a good idea, but it will take some time to deploy. As I haven't
 gotten any other feedback I will still do that then.

  FWIW, I have not run into this problem as an end user.

 No, me neither.

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.

-- 
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

[android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-12 Thread Mariano Kamp
*bump*

It seems that the implementation of startForeground() delegates to this
code:

 public void setServiceForeground(ComponentName className, IBinder token,
1781 #127f1bc903f2e1c4_l1781int id, Notification
notification, boolean removeNotification) throws RemoteException {
1782 #127f1bc903f2e1c4_l1782 Parcel data = Parcel.obtain();
1783 #127f1bc903f2e1c4_l1783 Parcel reply = Parcel.obtain();
1784 #127f1bc903f2e1c4_l1784
data.writeInterfaceToken(IActivityManager.descriptor);
1785 #127f1bc903f2e1c4_l1785
ComponentName.writeToParcel(className, data);
1786 #127f1bc903f2e1c4_l1786 data.writeStrongBinder(token);
1787 #127f1bc903f2e1c4_l1787 data.writeInt(id);
1788 #127f1bc903f2e1c4_l1788 if (notification != null) {
1789 #127f1bc903f2e1c4_l1789 data.writeInt(1);
1790 #127f1bc903f2e1c4_l1790notification.writeToParcel(data, 0);
1791 #127f1bc903f2e1c4_l1791 } else {
1792 #127f1bc903f2e1c4_l1792 data.writeInt(0);
1793 #127f1bc903f2e1c4_l1793 }
1794 #127f1bc903f2e1c4_l1794data.writeInt(removeNotification ? 1 : 0);
1795 #127f1bc903f2e1c4_l1795
mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
1796 #127f1bc903f2e1c4_l1796 reply.readException();
1797 #127f1bc903f2e1c4_l1797 data.recycle();
1798 #127f1bc903f2e1c4_l1798 reply.recycle();
1799 #127f1bc903f2e1c4_l1799 }


Which isn't all that more helpful ;-( I don't see that it messes with
priorities either. But then I also don't see the actual implementation of
making this foreground/background service more unkillable. It seems just to
be the IPC code.

Any ideas?


On Thu, Apr 8, 2010 at 6:40 PM, Mariano Kamp mariano.k...@gmail.com wrote:

 Hi.

 I updated my app to use the new startForeground() method of Service. Now
 beta testers are complaining about the foreground app going slow. Is that a
 coincidence or does startForeground() mess with the thread's prio or does
 anything else but what is written below?

 Just as an additional information the background activity does some
 syncing, reports the progress to the notification using remote views and as
 it is not latency dependent I use (and did that before already)
 this: Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);

 Should I use another Priority? And if it makes any difference, how does
 that play with Android 1.5 devices?

 Cheers,
 Mariano

 http://developer.android.com/reference/android/app/Service.html#startForeground(int,
 android.app.Notification)http://developer.android.com/reference/android/app/Service.html#startForeground(int,+android.app.Notification)

 Make this service run in the foreground, supplying the ongoing notification
 to be shown to the user while in this state. By default services are
 background, meaning that if the system needs to kill them to reclaim more
 memory (such as to display a large page in a web browser), they can be
 killed without too much harm. You can set this flag if killing your service
 would be disruptive to the user, such as if your service is performing
 background music playback, so the user would notice if their music stopped
 playing.

-- 
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

Re: [android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-12 Thread Mariano Kamp
My point is that the documentation says nothing at all about raising the
execution prio, but you say now that it does, right?
What the documentation says is that startForground() helps that the process
doesn't get killed and that's what I was after, because it is a costly
process wasting bandwidth to be killed in a part that I cannot resume
without starting over.

On Mon, Apr 12, 2010 at 9:26 PM, Dianne Hackborn hack...@android.comwrote:

 Yep startForeround() does what it says -- tells the system it should treat
 your service as if it is in foreground, something the user is aware of.  A
 typical example is background music playback, which needs to get as much
 CPU as it needs in order to avoid a bad user experience.

 Generally, if you want your threads to run in the background, that would
 imply to me that your service is not one that wants to run in the foreground
 so should not be requesting to do so.


 On Mon, Apr 12, 2010 at 10:51 AM, Mark Murphy mmur...@commonsware.comwrote:

 Mariano Kamp wrote:
  Is that a coincidence or does startForeground() mess
  with the thread's prio or does anything else but what is written
 below?

 Quoting myself:

 ...but a persistent concern for game developers on Android is the
 impacts that external forces have on their frame rates. For example, a
 year ago, the big concern was garbage collection going on in other
 processes -- garbage collection takes CPU time, even if that work is
 being done in a totally separate Linux process from the game itself.

 To counteract this, the core Android team made some improvements in
 Android 1.6, relegating all background processing to a class that is
 capped in terms of CPU utilization, leveraging some Linux process and
 thread control frameworks. Garbage collection in those background
 processes will no longer hog the CPU. Hence, games can run with minimal
 interference...so long as background processing stays in the background.

 (from

 http://www.androidguys.com/2010/03/16/code-pollution-background-foreground/
 )

 I suspect that startForeground() means the service will run with
 foreground priority, rather than residing in the background process class.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://twitter.com/commonsguy

 Android Training in NYC: 30 April-2 May 2010: http://guruloft.com

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-12 Thread Mariano Kamp
Skink,

awesome. That sounds fantastic. I will try that.

Cheers,
Mariano

On Mon, Apr 12, 2010 at 7:45 PM, skink psk...@gmail.com wrote:



 On Apr 9, 2:36 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  *bump*
 
  On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.com
 wrote:
 
 
 
   Hi,
 
   recently I very often get error reports from users that upgrade their
 OS.
   This includes at least 1.5, 1.6, 2.1 and custom ROMs.
 
   Anybody else seeing these? Any idea what to do about it?
 
   Cheers,
   Mariano
 

 i had similar problem too, i solved it by adding flag
 SQLiteDatabase.NO_LOCALIZED_COLLATORS when calling
 SQLiteDatabase.openDatabase

 hth
 pskink

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.


-- 
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

Re: [android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-12 Thread Mariano Kamp


 Quoting myself:

And you have done so wonderfully.

What is it your trying to say though?

That it is ok to raise the priority when I don't want my process to be
killed.

-- 
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

To unsubscribe, reply using remove me as the subject.


Re: [android-developers] Re: Service.startForeground() messes with scheduling?

2010-04-12 Thread Mariano Kamp
1) CPU is not a problem per se. My process can happily be starved of CPU,
but as it needs to do xml parsing it does task the CPU albeit at it's lowest
prio.
2) As I said I rely on an external API that doesn't understand incremental
updates.

Anyway, I think there is no good solution and the usefulness of this thread
is nearing zero now, so I will stop before I waste anymore of everybody's
time. Thanks so far.

On Mon, Apr 12, 2010 at 10:58 PM, Mark Murphy mmur...@commonsware.comwrote:

 Mariano Kamp wrote:
 
  Quoting myself:
 
  And you have done so wonderfully.
 
  What is it your trying to say though?
 
  That it is ok to raise the priority when I don't want my process to be
  killed.

 I'm saying what Ms. Hackborn confirmed in her reply to my post --
 startForeground() elevates the service's process to the foreground
 priority class. The not-too-unreasonable assumption the SDK makes is
 that something that is supposed to be in the foreground is supposed to
 be in the foreground. I mean, foreground is in the method's name.
 There's no question the documentation could be stronger, though.

 That being said, your choices are:

 1. Continue using startForeground() and either live with the complaints
 or modify your service to be less CPU-intensive, or

 2. Stop using startForeground() and modify your architecture to better
 support the service being shut down

 Since Android applications have to support their services being shut
 down (via task killers, the Services screen in Settings, etc.), I would
 think #2 would be the better answer, but that's your call.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://twitter.com/commonsguy

 Android Training in NYC: 4-6 June 2010: http://guruloft.com

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.


-- 
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

Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-10 Thread Mariano Kamp
Yes, that worked for me too. Actually re-installing the apps on the users'
phones alone was enough.

But this is just dealing with the symptoms and would've liked to know why
the OS updates break apps and if there are any counter measures the
developer can do?

And also meanwhile I got more than 50 of those issues (for a 65.000 active
installs app) and it really takes away from my time to work on my app.

As it seems that the Android OS developers don't chimp with enlightenment in
here I will automate the workaround then and let the user know that this
issue was caused by the OS updated and he should re-install my app and
potentially others.

On Sat, Apr 10, 2010 at 7:25 AM, Walter androidremotecont...@gmail.comwrote:

 Some users of my apps also reported same issue, also same exception in
 the log.

 What you can do is:

 Uninstall your app, power off, power on. if that doesn't work and the
 phone is rooted,  ask the user to clean the app cache, and not install
 app on SDCard.

 That resolved all these kind of open database and file corruption
 issues.

 Walter


 On Apr 9, 12:46 pm, Mariano Kamp mariano.k...@gmail.com wrote:
   Mariano Kamp wrote:
I could ask the people with custom ROMs to check if the db-file is
 still
there.
 
   Or add your own exception handler for this, do some experiments, and
   then send the results to yourself via whatever mechanism you're using
 to
   get the stack trace.
 
  That's a good idea, but it will take some time to deploy. As I haven't
  gotten any other feedback I will still do that then.
 
   FWIW, I have not run into this problem as an end user.
 
  No, me neither.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.


-- 
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

[android-developers] Re: unable to open database file after OS upgrade

2010-04-09 Thread Mariano Kamp
*bump*

On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hi,

 recently I very often get error reports from users that upgrade their OS.
 This includes at least 1.5, 1.6, 2.1 and custom ROMs.

 Anybody else seeing these? Any idea what to do about it?

 Cheers,
 Mariano

 One example:

 -- Time: Fri Mar 26 11:36:41 PDT 2010
 -- Android Version: sdk=4, release=1.6, inc=21415
 -- Memory free: 0.53MB total: 3.01MB max: 16.00MB
 -- Custom ROM: Stock Android
 -- Device: dream
 -- Model: T-Mobile G1
 -- Stacktrace:(2135)
 java.lang.RuntimeException: Unable to get provider
 com.newsrob.AssetContentProvider: android.database
 .sqlite.SQLiteException: unable to open database file
 at android.app.ActivityThread.installProvider(ActivityThread.java:4112)
 at
 android.app.ActivityThread.installContentProviders(ActivityThread.java:3908)
 at
 android.app.ActivityThread.handleBindApplication(ActivityThread.java:3867)
 at android.app.ActivityThread.access$2800(ActivityThread.java:116)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:123)
 at android.app.ActivityThread.main(ActivityThread.java:4203)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:521)
 at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
 at dalvik.system.NativeStart.main(Native Method)
 Caused by: android.database.sqlite.SQLiteException: unable to open
 database file
 at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
 at android.database.sqlite.SQLiteDatabase.init(SQLiteDatabase.java:1584)
 at android.database
 .sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
 at android.database
 .sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
 at android.database
 .sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
 at
 android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
 at
 android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
 at android.database
 .sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
 at com.newsrob.DB.init(DB.java:194)
 at com.newsrob.EntryManager.init(EntryManager.java:203)
 at com.newsrob.EntryManager.getInstance(EntryManager.java:822)
 at com.newsrob.AssetContentProvider.onCreate(AssetContentProvider.java:42)
 at android.content.ContentProvider.attachInfo(ContentProvider.java:697)
 at android.app.ActivityThread.installProvider(ActivityThread.java:4109)
 ... 12 more


-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Hard to describe ... How to quickly scan through all rows?! How to pass a cursor between two activities?!

2010-04-09 Thread Mariano Kamp
Hi,

  I have an app that has a list view of messages and a detail view. If you
click on a message in the list view the detail view is opened for the
message in the row you clicked on.
In the detail view you also can go back and forth to other messages. So I
pass in the position of the row the user clicked on and the criteria I need
to rebuild the cursor like I did for the list. Then I use
Cursor.moveToPosition() to get to the selected row.

  So far so good. There is only one issue, when an import is running in the
background that inserts new (or deletes aged) messages then between the time
of the click and the time the detail view queries the database again it
maybe that the position is not valid anymore.

  Any idea how to deal with that?

  I tried to pass in a key instead and then go through all rows until I find
the one that has the same key, but this takes a real long time and doesn't
seem feasable at all. But maybe I am doing it wrong. It looks something like
this:

while (contentCursor.moveToNext()) {
   if (42 == contentCursor.getLong(0))
  break;
}

  Any better way to do that in general?

  I could try what happens when I pass in the position also and start from
there. Usually that should work and when it doesn't then I could scan all
messages?! The problem is, scanning all say 1,000 articles may take more
than 5 seconds on a G1.

Cheers,
Mariano

-- 
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

To unsubscribe, reply using remove me as the subject.


Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-09 Thread Mariano Kamp
I haven't been able to reproduce it on my own phones. Also the users that
reported it told me that this happens to other apps on their phones too. At
least the other apps force close, whatever the actual reason is.

I could ask the people with custom ROMs to check if the db-file is still
there.

So you never had this issue with one of your apps?

On Fri, Apr 9, 2010 at 6:39 PM, Mark Murphy mmur...@commonsware.com wrote:

 Mariano Kamp wrote:
  *bump*

 What have you done to gather more info? For example, is the issue that
 the database is deleted, or that the database exists but somehow the
 permissions are messed up?

  On Fri, Apr 2, 2010 at 12:53 PM, Mariano Kamp mariano.k...@gmail.com
  mailto:mariano.k...@gmail.com wrote:
 
  Hi,
 
  recently I very often get error reports from users that upgrade
  their OS. This includes at least 1.5, 1.6, 2.1 and custom ROMs.
 
  Anybody else seeing these? Any idea what to do about it?
 
  Cheers,
  Mariano
 
  One example:
 
  -- Time: Fri Mar 26 11:36:41 PDT 2010
  -- Android Version: sdk=4, release=1.6, inc=21415
  -- Memory free: 0.53MB total: 3.01MB max: 16.00MB
  -- Custom ROM: Stock Android
  -- Device: dream
  -- Model: T-Mobile G1
  -- Stacktrace:(2135)
  java.lang.RuntimeException: Unable to get provider
  com.newsrob.AssetContentProvider:
  android.database.sqlite.SQLiteException: unable to open database file
  at
 android.app.ActivityThread.installProvider(ActivityThread.java:4112)
  at
 
 android.app.ActivityThread.installContentProviders(ActivityThread.java:3908)
  at
 
 android.app.ActivityThread.handleBindApplication(ActivityThread.java:3867)
  at android.app.ActivityThread.access$2800(ActivityThread.java:116)
  at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4203)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by:
  android.database.sqlite.SQLiteException: unable to open database file
  at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
  at
 
 android.database.sqlite.SQLiteDatabase.init(SQLiteDatabase.java:1584)
  at
 
 android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
  at
 
 android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
  at
 
 android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
  at
 
 android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
  at
 
 android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
  at
 
 android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
  at com.newsrob.DB.init(DB.java:194)
  at com.newsrob.EntryManager.init(EntryManager.java:203)
  at com.newsrob.EntryManager.getInstance(EntryManager.java:822)
  at
 
 com.newsrob.AssetContentProvider.onCreate(AssetContentProvider.java:42)
  at
 android.content.ContentProvider.attachInfo(ContentProvider.java:697)
  at
 android.app.ActivityThread.installProvider(ActivityThread.java:4109)
  ... 12 more
 
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en


 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.4 Available!

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 To unsubscribe, reply using remove me as the subject.


-- 
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

Re: [android-developers] Re: unable to open database file after OS upgrade

2010-04-09 Thread Mariano Kamp

 Mariano Kamp wrote:
  I could ask the people with custom ROMs to check if the db-file is still
  there.

 Or add your own exception handler for this, do some experiments, and
 then send the results to yourself via whatever mechanism you're using to
 get the stack trace.

That's a good idea, but it will take some time to deploy. As I haven't
gotten any other feedback I will still do that then.



 FWIW, I have not run into this problem as an end user.

No, me neither.

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Service.startForeground() messes with scheduling?

2010-04-08 Thread Mariano Kamp
Hi.

I updated my app to use the new startForeground() method of Service. Now
beta testers are complaining about the foreground app going slow. Is that a
coincidence or does startForeground() mess with the thread's prio or does
anything else but what is written below?

Just as an additional information the background activity does some syncing,
reports the progress to the notification using remote views and as it is not
latency dependent I use (and did that before already)
this: Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);

Should I use another Priority? And if it makes any difference, how does that
play with Android 1.5 devices?

Cheers,
Mariano

http://developer.android.com/reference/android/app/Service.html#startForeground(int,
android.app.Notification)

Make this service run in the foreground, supplying the ongoing notification
to be shown to the user while in this state. By default services are
background, meaning that if the system needs to kill them to reclaim more
memory (such as to display a large page in a web browser), they can be
killed without too much harm. You can set this flag if killing your service
would be disruptive to the user, such as if your service is performing
background music playback, so the user would notice if their music stopped
playing.

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Non-stretchable background images

2010-04-05 Thread Mariano Kamp
Hi,

I want to generate background drawables for buttons and I am wondering if
there is any way to specify that the button can stretch, e.g. when using
fill_parent, but the image in it should not stretch? I want to use the extra
space for the touch area, but not have the icons on it look all different
and stretched beyond recognition.

So I am basically looking for something like that:
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

But of course it should work with Buttons.

I know I could use nine patchs, but I have more than 20 icons and even if my
ADD would allow me to do this tedious task once for every 20 images for
every resolution I don't think I would ever change the icons afterwards
which can't be the solution.

Cheers,
Mariano

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] unable to open database file after OS upgrade

2010-04-02 Thread Mariano Kamp
Hi,

recently I very often get error reports from users that upgrade their OS.
This includes at least 1.5, 1.6, 2.1 and custom ROMs.

Anybody else seeing these? Any idea what to do about it?

Cheers,
Mariano

One example:

-- Time: Fri Mar 26 11:36:41 PDT 2010
-- Android Version: sdk=4, release=1.6, inc=21415
-- Memory free: 0.53MB total: 3.01MB max: 16.00MB
-- Custom ROM: Stock Android
-- Device: dream
-- Model: T-Mobile G1
-- Stacktrace:(2135)
java.lang.RuntimeException: Unable to get provider
com.newsrob.AssetContentProvider: android.database.sqlite.SQLiteException:
unable to open database file
at android.app.ActivityThread.installProvider(ActivityThread.java:4112)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:3908)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:3867)
at android.app.ActivityThread.access$2800(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: unable to open database
file
at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
at android.database.sqlite.SQLiteDatabase.init(SQLiteDatabase.java:1584)
at android.database
.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
at android.database
.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
at android.database
.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
at
android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
at android.database
.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
at com.newsrob.DB.init(DB.java:194)
at com.newsrob.EntryManager.init(EntryManager.java:203)
at com.newsrob.EntryManager.getInstance(EntryManager.java:822)
at com.newsrob.AssetContentProvider.onCreate(AssetContentProvider.java:42)
at android.content.ContentProvider.attachInfo(ContentProvider.java:697)
at android.app.ActivityThread.installProvider(ActivityThread.java:4109)
... 12 more

-- 
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

To unsubscribe, reply using remove me as the subject.


[android-developers] Proper way to update remote views in notifications?

2010-03-21 Thread Mariano Kamp
Hi,

when using the new Service.startForeground() method how do you do
updates to remote widgets? What is the right way? Updating the remote
views doesn't seem to work. Should I notify again with the same ID
instead?

I didn't see any documentation on that:
http://developer.android.com/intl/zh-CN/guide/topics/ui/notifiers/notifications.html
and 
http://developer.android.com/intl/zh-CN/reference/android/app/Service.html#startForeground(int,
android.app.Notification)

Cheers,
Mariano

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


Re: [android-developers] Proper way to update remote views in notifications?

2010-03-21 Thread Mariano Kamp
Sorry. I meant to say remote views like in the subject ;-)

I currently update the remote views to which I kept a reference and then
notify again with the same Id.
That seems to work, but I would like to know if this is the right way to do
it.

Written on a mobile device

On Mar 21, 2010 12:58 PM, Mark Murphy mmur...@commonsware.com wrote:

Mariano Kamp wrote:
 when using the new Service.startForeground() method how do you do
 updates to...
Those two concepts are not strictly tied, AFAIK. A Service would update
the app widget the same way regardless of whether or not it called
startForeground().

BTW, I don't know what a remote widget is. I am just assuming you are
referring to home screen app widgets.

To update an app widget, a Service gets an AppWidgetManager and RemoteViews:

ComponentName me=new ComponentName(this, AppWidget.class);
RemoteViews updateViews=new RemoteViews(apt.tutorial,
   R.layout.widget);
AppWidgetManager mgr=AppWidgetManager.getInstance(this);

then populates the RemoteViews and has the manager post those changes to
the home screen via mgr.updateAppWidget(me, updateViews).

You can see this used here:

http://github.com/commonsguy/cw-andtutorials/tree/master/36-AdvAppWidget/

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to android-developers+
unsubscribegooglegroups.com or reply to this email with the words REMOVE
ME as the subject.

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] PendingIntents in Notifications

2010-03-21 Thread Mariano Kamp
I would like to show a notification that displays the progress of an
ongoing operation, but at the same time the remote view should contain
a cancel button to stop the ongoing operation.

I have to specify a contentIntent that is launched when clicking on
the notification: If I don't specify that I get something along those
lines:

E/ActivityManager(   62): Activity Manager Crash
E/ActivityManager(   62): java.lang.IllegalArgumentException:
contentIntent required: pkg=com.newsrob id=999
notification=Notification(vibrate=null,sound=null,defaults=0x0)
E/ActivityManager(   62):   at
com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:635)
E/ActivityManager(   62):   at
com.android.server.NotificationManagerService.enqueueNotification(NotificationManagerService.java:610)
E/ActivityManager(   62):   at
com.android.server.am.ServiceRecord.postNotification(ServiceRecord.java:256)
E/ActivityManager(   62):   at
com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:10971)
E/ActivityManager(   62):   at
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:596)
E/ActivityManager(   62):   at
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1539)
E/ActivityManager(   62):   at 
android.os.Binder.execTransact(Binder.java:287)
E/ActivityManager(   62):   at dalvik.system.NativeStart.run(Native Method)

For the cancel button I set another intent:

Intent cancelSyncIntent = new Intent(com.newsrob.CANCEL_SYNC);
contentView.setOnClickPendingIntent(R.id.cancel_sync,
PendingIntent.getBroadcast(context, 0,
cancelSyncIntent, 0));

But this never works. I always get the content intent when the button
is clicked. It looks like I cannot use buttons in remote views of
notifications?!

I could probably display a text:  Press to cancel operation ,
but that seems very heavy handed.

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-developers] android:layout_marginRight?

2010-03-17 Thread Mariano Kamp
Hi,

  I have a small text view (see below) that should span the complete width,
except for a margin left and right. No matter what I specify for
marginRight, it always gets added to the left side, i.e. the margin left
grows and the text view is flush to the right side though.

  Am I doing something wrong here?

Cheers,
Mariano

?xml version=1.0 encoding=utf-8?
TextView
xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/status_text
 android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_gravity=center_horizontal|bottom
 android:layout_marginLeft=3dp
android:layout_marginRight=13dp
android:layout_marginTop=3dp
android:layout_marginBottom=3dp

android:textColor=#fff
android:gravity=center
android:background=@drawable/status_background

android:visibility=gone/

-- 
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

Re: [android-developers] android:layout_marginRight?

2010-03-17 Thread Mariano Kamp
You're right. Thanks. It works now.

?xml version=1.0 encoding=utf-8?
TextView
xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/status_text
 android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_gravity=bottom
 android:layout_margin=3dp

android:textColor=#fff
android:background=@drawable/status_background

android:visibility=gone/

On Wed, Mar 17, 2010 at 8:43 PM, Romain Guy romain...@android.com wrote:

 Why are you using width=fill_parent and gravity=center_horizontal? It
 doesn't make sense.

 On Wed, Mar 17, 2010 at 12:12 PM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Hi,
I have a small text view (see below) that should span the complete
 width,
  except for a margin left and right. No matter what I specify for
  marginRight, it always gets added to the left side, i.e. the margin left
  grows and the text view is flush to the right side though.
Am I doing something wrong here?
  Cheers,
  Mariano
  ?xml version=1.0 encoding=utf-8?
  TextView
  xmlns:android=http://schemas.android.com/apk/res/android;
  android:id=@+id/status_text
  android:layout_width=fill_parent
  android:layout_height=wrap_content
  android:layout_gravity=center_horizontal|bottom
  android:layout_marginLeft=3dp
  android:layout_marginRight=13dp
  android:layout_marginTop=3dp
  android:layout_marginBottom=3dp
  android:textColor=#fff
  android:gravity=center
  android:background=@drawable/status_background
  android:visibility=gone/
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

[android-developers] Trouble understanding launching intents

2010-03-16 Thread Mariano Kamp
Hi,

I have an hypothetical app that has two activities: A (List), B
(Details). A can be launched and can itself launch B. I also have a
widget that can also launch B via the use of an PendingIntent.
Activity B looks at the Intent's extras ie1 and ie2 when created and
shows different data then.

The behavior I would like to see is A launches B. When I press HOME
and then go to a widget that itself launches B then the existing B
should be replaced by the new B with different extras (ie1 and ie2).
The new B should replace the existing B.

Also what I am seeing is when I go back HOME after seeing B that was
launched with ie1=x and then launch B from the widget again with
ie1=y I still get to see the old B with ie1=x.

It doesn't really matter what configuration/approach I am using now as
I am willing to completely change it. But for illustration purposes
I'd like to share a couple of things that I use or used.

I put all extras additionally into the data uri as parameters, because
it seems that the extras alone are not taken into account when
comparing Intents.

I thought from reading the documentation that launching with
category=Intent.CATEGORY_LAUNCHER and
flags=Intent.FLAG_ACTIVITY_CLEAR_TOP should do what I expected, but it
doesn't.

In the declaration of A and B I set clearTaskOnLaunch=true.

Anything special to take into account when launching those intents
from a PendingActivity associated with a remote view?

I found it interesting that when launching out of this context the
flags always contained Intent.FLAG_ACTIVITY_NEW_TASK (0x1), even
though *I* didn't set it. Instead I set CLEAR_TOP (0x04).

Another thing that I would like to know is how could I
configure/program it that a launch of B from the widget completely
clears the task's stack, basically like clearTaskOnLaunch, but when
firing an intent.

With all of this what I really like to avoid is that Gmail-like
BACK-orgy, where I sometimes have to press BACK five to eight times to
reach the home screen. This seems to be the same problem. Opening
Gmail from the launcher, from shortcuts and from the new-mail
notification does that.

Any ideas?

-- 
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


Re: [android-developers] Application losing SharedPreferences and Sqlite database on Droid

2010-03-16 Thread Mariano Kamp
I get lots of these (database disk image is malformed). Also unable
to open database file, error code 14: unable to open database file,
database or disk is full and many more.

I can't put my finger on what the issue is though.

unable to open database file is my current favorite. It seems to
happen more frequently after the user upgraded his or her OS, this
happens with custom ROMs, but also with official updates.

It would be fantastic if the OS would provide a crash reporter that
sends those issues to a central place, so that Google's Android
developers can see the numbers of what causes trouble and either fix
the issues or educate the developers.

On Sat, Mar 13, 2010 at 10:21 PM, Yuvi yuvidr...@gmail.com wrote:

 Hi,

 the database issue happened on my phone (HTC Hero, 1.5), with my app. I also 
 wrote to this mailing group (Corrupted Database 
 (SQLiteDatabaseCorruptException: database disk image is malformed)), but got 
 no replies :(

 I hope someone has some news about that.


 Yuvi

 --
 YuviDroid
 http://android.yuvalsharon.net

 On Sat, Mar 13, 2010 at 10:16 PM, Matt (preinvent) m...@preinvent.com wrote:

 I've had several reports (and experienced it once myself) of users of
 my app experiencing loss of all application data - both
 SharedPreferences and the SQLite database.  There's nothing in my code
 that could do this so there must be something going on at a lower
 level.  I've only had reports from Droid users so it's more than
 likely confined to that phone, although that doesn't mean it doesn't
 happen on other phones.

 Has anyone experienced this before? I've seen threads in here
 regarding loss of just SharedPreferences, but a database as well?

 Thanks,

 Matt

 --
 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



 --
 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

-- 
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


Re: [android-developers] Re: Device Seeding Program for Top Android Market Developers

2010-03-06 Thread Mariano Kamp
What kind of confirmation is that? Is that the first mail or a confirmation
after you went to their website?

I am asking, because I haven't got any email even though I have an app in
the Market that would qualify. Should I start to worry or are the first
mails sent out incrementally?

On Sat, Mar 6, 2010 at 1:10 PM, Thomas Riley tomrile...@googlemail.comwrote:

 I also have the confirmation email.
 It says they will arrive in 2-4 weeks, but can it really be so slow?
 Or is that use an over estimate?

 On Mar 6, 10:51 am, Rootko roo...@gmail.com wrote:
  Just got mine confirmation email, but unfortunately they removed
  leading zero in my zip code, so I've responded to change it. Hopefully
  this won't be a problem and I'll enjoy my Nexus One soon (I'm in EU).
 
  Hooray, thanks Google!

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] AccountManager.getAuthToken() problem with more than one app

2010-03-04 Thread Mariano Kamp
This whole Auth 2.0 thing is a total mess. Did you test it on Android 2.0.1
devices? It didn't crash for you there? Can you support hosted accounts?

I think I will give up on this until Google documents how to use their
implementation (the Google one, not the Android framework). There is just
already too much time sunk here.

Anyway, regarding your actual issue, did the Auth mechanism ask you twice to
allow access to the selected account? I am not quite sure how it determines
the caller, but maybe it might not be the calling app, but the certificate
it was signed with that makes the difference. Did you use the same
certificate to sign both apps?

On Thu, Mar 4, 2010 at 9:35 PM, ubikdroid markst3v...@googlemail.comwrote:

 I think I might have found an issue with using AccountManager in
 Android 2.x devices. I have 2 apps in the market that use Google
 Reader: Reader Widget Pro and Reader Widget Free. I was updating them
 both to use AccountManager and the new authentication method. I
 noticed that on my Nexus One when one application (say the Free one)
 obtained a token using AccountManager.getAuthToken() with the service
 set to reader the other app (say the Pro one) was unable to obtain a
 token afterwards. Even using AccountManager.invalidateAuthToken() in
 the first app did not work. Sample code:

 AccountManagerFutureBundle accFut =
 accountManager.getAuthToken(acct, reader, false, null, null);
 try {
if(accFut != null  accFut.getResult() != null){
Bundle bundle = accFut.getResult();
authToken = bundle.getString(authtoken); // This key is no
 longer
 in the bundle for the 2nd app
Log.e(TAG, accFut null);
}
 } catch (OperationCanceledException e) {
e.printStackTrace();
 } catch (AuthenticatorException e) {
e.printStackTrace();
 } catch (IOException e) {
e.printStackTrace();
 }

 I don't know if this is supposed to happen. It could mean big problems
 if several apps are trying to get auth tokens for the same service on
 the same phone. One application could prevent others from working. I
 will stick to the old GoogleLoginServiceBlockingHelper method in my
 apps for now. Anyone else noticed this issue?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

[android-developers] Need help with Remote Views. Not updating anymore after the first update?

2010-02-28 Thread Mariano Kamp
I have remote views that are updated during their configuration. So far so good.

When later on the state they should monitor changes I want to update
them again and I use the same code to alter the remote views, but
nothing happens. When looking at the remote views in the debugger I
can see that the remote views' mAction instance var does accumulate
all my changes (setTextViewText etc.), but the actual widgets don't
change.

Any idea what might be wrong or where I can look at? I know it is
probably something stupid, but I don't see it and it's not for a lack
of trying.

I tried loads of different approaches, but here is the current code:

firing the update:

AppWidgetManager awm = AppWidgetManager.getInstance(ctx);
int[] appWidgetIds = awm.getAppWidgetIds(new ComponentName(ctx,
UnreadWidgetProvider.class));
for (int appWidgetId : appWidgetIds) {
System.out.println(EM.awm.updateWidget  appWidgetId= + appWidgetId);
awm.updateAppWidget(appWidgetId,
UnreadWidgetProvider.buildUpdate(ctx, appWidgetId));
}

create the remote views:

public static RemoteViews buildUpdate(Context context, int appWidgetId) {
System.out.println(buildUpdate appWidgetId= + appWidgetId);

EntryManager entryManager = EntryManager.getInstance(context);
WidgetPreferences wp = entryManager.getWidgetPreferences(appWidgetId);
RemoteViews updateViews = new RemoteViews(context.getPackageName(),
R.layout.unread_widget);

if (wp == null) {
System.out.println(In configuration. Nothing stored yet for
appWidgetId= + appWidgetId);
return updateViews;
}

System.out.println(using dbq= + wp.getDBQuery() +  appWidgetId= +
appWidgetId);

int count = getCount(entryManager, wp.getDBQuery());

System.out.println(count= + count);
System.out.println(label= + wp.getLabel());
updateViews.setViewVisibility(R.id.unread_count, count  0 ?
View.VISIBLE : View.INVISIBLE);
updateViews.setTextViewText(R.id.unread_count, String.valueOf(count));

System.out.println(wp.getLabel()= + wp.getLabel() + !);

// updateViews.setViewVisibility(R.id.label, wp.getLabel() !=
// null ? View.VISIBLE : View.INVISIBLE);
updateViews.setViewVisibility(R.id.label, View.VISIBLE);
if (wp.getLabel() != null)
updateViews.setTextViewText(R.id.label, wp.getLabel());

Intent intent = new Intent(context, ArticleListActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, 
intent, 0);

updateViews.setOnClickPendingIntent(R.id.unread_count, pendingIntent);
System.out.println(After setOnClickPendingIntent);

return updateViews;
}

-- 
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



Re: [android-developers] Re: Android, send me logs! - code library for detecting force-close and sending logs

2010-02-28 Thread Mariano Kamp
 What's nice about Apple's approach here is that developers
 don't have to do anything... it's a good way of improving the code
 quality for *all* apps. I was pretty surprised and happy when it
 came online a month or two ago because it confirmed that what
 was crashing across our user base were known issues. Most of
 the battle is getting *any* information about how the app is
 behaving in the field, so the auto-crash reports are really nice.

 I don't think there's an inherent conflict with Android's openness.
 The crashes are anonymized, and developers and users do chose
 to go through the Android Market -- which unlike Apple isn't the
 only way to get apps.
And it would give feedback to the Android developers what kinds of
bugs appear, because their users (the devs) don't seem to grasp the
API or because there are bugs in the system that they would have
consider minor until they see how often they really occur.

-- 
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


[android-developers] Re: Widget does not render on wvga854 ?

2010-02-27 Thread Mariano Kamp
Did you find a solution to your issue? I think I am seeing weird
behavior with widgets too, but not constrained to a single skin.

I usually don't see updates on the emulator, except sometime. I always
see the updates on the devices I test with.

On Dec 31 2009, 3:14 am, Chopcsu st...@kilsby.com.au wrote:
 Also i have found that rotating the screen causes the update to become
 visible.

 In my app I start the update service , setwidgetto loading then do
 some http, when it comes back from http this is where it can not
 update thewidgetanymore. (calls update but change does not get
 reflected on the screen)

 On Dec 31, 1:11 pm, Chopcsu st...@kilsby.com.au wrote:



  Ive had a similar problem where updateAppWidget does not cause an
  update.

  For me it is usually only the first time you install on theemulator
  (think most 2.0 versions do this, not 1.5, 1.6 does i think)

  if you restart theemulator(without deleting installedwidget) the
  upate will work.

  I have not been able to find out if this is anemulatorissue or
  android issue.

  I have not found a code solution to this yet either.

  On Dec 29, 7:51 pm, Guy guy.ta...@gmail.com wrote:

   forgot to mention: this code works on all otheremulatorskins.

   On Dec 28, 9:37 pm, Guy guy.ta...@gmail.com wrote:

Hi All,
I've written a simplewidgetapplication based on the wikitionary
code.

When run on an wvga854emulator, thewidgetview does *not* update
after a call to:

      // Build thewidgetupdate for today
      RemoteViews updateViews = buildUpdate(this);

      // Push update for thiswidgetto the home screen
      ComponentName thisWidget = new ComponentName(this,
HebCalWidget.class);
      AppWidgetManager manager = AppWidgetManager.getInstance(this);
      manager.updateAppWidget(thisWidget, updateViews);

The code seems to be executed (i've checked through the debugger), and
no exceptions are thrown,
still, the AppWidget view does not seem to be updated.

Any ideas?

-- 
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


Re: [android-developers] Re: Widget does not render on wvga854 ?

2010-02-27 Thread Mariano Kamp
Oh and I forgot to mention that in the emulator the debugger doesn't seem to
work anymore since I use widgets. But this might be not related and maybe my
emulator just has some defect?

On Sat, Feb 27, 2010 at 5:01 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Did you find a solution to your issue? I think I am seeing weird
 behavior with widgets too, but not constrained to a single skin.

 I usually don't see updates on the emulator, except sometime. I always
 see the updates on the devices I test with.

 On Dec 31 2009, 3:14 am, Chopcsu st...@kilsby.com.au wrote:
  Also i have found that rotating the screen causes the update to become
  visible.
 
  In my app I start the update service , setwidgetto loading then do
  some http, when it comes back from http this is where it can not
  update thewidgetanymore. (calls update but change does not get
  reflected on the screen)
 
  On Dec 31, 1:11 pm, Chopcsu st...@kilsby.com.au wrote:
 
 
 
   Ive had a similar problem where updateAppWidget does not cause an
   update.
 
   For me it is usually only the first time you install on theemulator
   (think most 2.0 versions do this, not 1.5, 1.6 does i think)
 
   if you restart theemulator(without deleting installedwidget) the
   upate will work.
 
   I have not been able to find out if this is anemulatorissue or
   android issue.
 
   I have not found a code solution to this yet either.
 
   On Dec 29, 7:51 pm, Guy guy.ta...@gmail.com wrote:
 
forgot to mention: this code works on all otheremulatorskins.
 
On Dec 28, 9:37 pm, Guy guy.ta...@gmail.com wrote:
 
 Hi All,
 I've written a simplewidgetapplication based on the wikitionary
 code.
 
 When run on an wvga854emulator, thewidgetview does *not* update
 after a call to:
 
   // Build thewidgetupdate for today
   RemoteViews updateViews = buildUpdate(this);
 
   // Push update for thiswidgetto the home screen
   ComponentName thisWidget = new ComponentName(this,
 HebCalWidget.class);
   AppWidgetManager manager =
 AppWidgetManager.getInstance(this);
   manager.updateAppWidget(thisWidget, updateViews);
 
 The code seems to be executed (i've checked through the debugger),
 and
 no exceptions are thrown,
 still, the AppWidget view does not seem to be updated.
 
 Any ideas?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] App Widget Lifecycle?

2010-02-27 Thread Mariano Kamp
Hey guys,

  I am bit puzzled by an app widget's lifecyle.

  When I create a widget my own configuration activity is launched,
some data is entered, I store this data some place and call finish on
my config activity like this:

Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
setResult(RESULT_OK, resultValue);
finish();

Now I would expect to see something like that in my log:

I/System.out(  312): onReceive...=android.appwidget.action.APPWIDGET_ENABLED
I/System.out(  312): onReceive...=android.appwidget.action.APPWIDGET_UPDATE

But as a matter of fact those log entries from above are created when
the configuration activity is *started*. Is that right? Am I doing
something wrong here?
Should I invent some artificial limbo/default state for the widget
that can be displayed when it is in its configuration mode?

Cheers,
Mariano

-- 
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


Re: [android-developers] A Widget that looks like a launcher icon?

2010-02-23 Thread Mariano Kamp
Thanks guys.

The thing is, it shouldn't look like a widget, but like an active shortcut
with a badge representing the unread count. My shortcuts to labels in Gmail
have the drawback that I always have to open them to see what's in them.

It would be great if there were a way to use common functionality to meet
the look of the particular platform, but I understand there isn't such a
functionality at the moment.

On Mon, Feb 22, 2010 at 11:01 PM, Romain Guy romain...@android.com wrote:

 Widgets should look like widgets, not like shortcuts. The main reason
 is that there is absolutely NO guarantee about what a shortcut will
 look like. Other devices (especially ones with custom system UIs like
 MOTOBLUR or HTC Sense) might have a different look and feel. Or in the
 next update of Android we might change the way shortcuts are
 presented.

 On Mon, Feb 22, 2010 at 1:40 PM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Hi,
  I would like to write a widget that emulates the look of an application
  launcher shortcut. In particular I want the white font label on a black,
  semi-transparent background. As it should look the same as the launcher
  shortcut I wouldn't like too much to imitate the actual look, but to
  re-use/copy it. Any idea where I can get that?
  I checked the launcher app and found application-boxed.xml, but it
 doesn't
  seem to do what I want and I am probably way off anyway.
  Any ideas?
  Btw. I know that this is like a shortcut, but on a shortcut I cannot
 render
  the number of unread items.
  Cheers,
  Mariano
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

Re: [android-developers] A Widget that looks like a launcher icon?

2010-02-23 Thread Mariano Kamp
Sure, that was my original idea. I should have mentioned the 1x1 size.
The Gmail thing was just an example and I was talking about the actual GMail
shortcuts. They don't show the unread count so you have to click them to
know what's in them.

In my case it would be shortcuts to Google Reader labels/feeds etc.

I am currently trying to make those 1x1 widgets look like shortcuts, but
then I read what you guys wrote and see that my efforts are to be futile
given that there are other look and feels.
Still I have an app icon, a label and an unread count. Everything I tried
looks strangely out of place as it lives with all the other shortcuts on
the same home screen.

On Tue, Feb 23, 2010 at 9:06 PM, Romain Guy romain...@android.com wrote:

 Why not make a 1x1 widget with a Gmail like icon? It would be close
 enough to a shortcut :)

 On Tue, Feb 23, 2010 at 11:50 AM, Mariano Kamp mariano.k...@gmail.com
 wrote:
  Thanks guys.
  The thing is, it shouldn't look like a widget, but like an active
 shortcut
  with a badge representing the unread count. My shortcuts to labels in
 Gmail
  have the drawback that I always have to open them to see what's in them.
  It would be great if there were a way to use common functionality to meet
  the look of the particular platform, but I understand there isn't such a
  functionality at the moment.
 
  On Mon, Feb 22, 2010 at 11:01 PM, Romain Guy romain...@android.com
 wrote:
 
  Widgets should look like widgets, not like shortcuts. The main reason
  is that there is absolutely NO guarantee about what a shortcut will
  look like. Other devices (especially ones with custom system UIs like
  MOTOBLUR or HTC Sense) might have a different look and feel. Or in the
  next update of Android we might change the way shortcuts are
  presented.
 
  On Mon, Feb 22, 2010 at 1:40 PM, Mariano Kamp mariano.k...@gmail.com
  wrote:
   Hi,
   I would like to write a widget that emulates the look of an
 application
   launcher shortcut. In particular I want the white font label on a
 black,
   semi-transparent background. As it should look the same as the
 launcher
   shortcut I wouldn't like too much to imitate the actual look, but to
   re-use/copy it. Any idea where I can get that?
   I checked the launcher app and found application-boxed.xml, but it
   doesn't
   seem to do what I want and I am probably way off anyway.
   Any ideas?
   Btw. I know that this is like a shortcut, but on a shortcut I cannot
   render
   the number of unread items.
   Cheers,
   Mariano
  
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
   For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en
 
 
 
  --
  Romain Guy
  Android framework engineer
  romain...@android.com
 
  Note: please don't send private questions to me, as I don't have time
  to provide private support.  All such questions should be posted on
  public forums, where I and others can see and answer them
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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

[android-developers] A Widget that looks like a launcher icon?

2010-02-22 Thread Mariano Kamp
Hi,

I would like to write a widget that emulates the look of an application
launcher shortcut. In particular I want the white font label on a black,
semi-transparent background. As it should look the same as the launcher
shortcut I wouldn't like too much to imitate the actual look, but to
re-use/copy it. Any idea where I can get that?

I checked the launcher app and found application-boxed.xml, but it doesn't
seem to do what I want and I am probably way off anyway.

Any ideas?

Btw. I know that this is like a shortcut, but on a shortcut I cannot render
the number of unread items.

Cheers,
Mariano

-- 
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

[android-developers] Issue with Android 2.0 Account API / getAuthTokenLabel() results in Resources$NotFoundException: String resource ID #0x0

2010-02-16 Thread Mariano Kamp
Hi,

  using the new Account API to access Google accounts I have code that works
with Android 2.1, but breaks with Android 2.0.1.

W/ResourceType(16375): No package identifier when getting name for resource
number 0x
E/JavaBinder(16375): *** Uncaught remote exception!  (Exceptions are not yet
supported across processes.)
E/JavaBinder(16375): android.content.res.Resources$NotFoundException: String
resource ID #0x0
E/JavaBinder(16375):  at
android.content.res.Resources.getText(Resources.java:200)
E/JavaBinder(16375):  at
android.content.res.Resources.getString(Resources.java:253)
E/JavaBinder(16375):  at android.content.Context.getString(Context.java:149)
E/JavaBinder(16375):  at
com.google.android.googleapps.GoogleLoginService$AccountAuthenticatorImpl.getAuthTokenLabel(GoogleLoginService.java:586)
E/JavaBinder(16375):  at
android.accounts.AbstractAccountAuthenticator$Transport.getAuthTokenLabel(AbstractAccountAuthenticator.java:155)
E/JavaBinder(16375):  at
android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:123)
E/JavaBinder(16375):  at android.os.Binder.execTransact(Binder.java:287)
E/JavaBinder(16375):  at dalvik.system.NativeStart.run(Native Method)

  I don't think the code helps, but before you ask:

accountManager.getAuthToken(selectedAccount, ah, null, myActivity,
new AccountManagerCallbackBundle() {

public void run(android.accounts.AccountManagerFutureBundle f) {
try {
// Don't even get
here on an Android 2.0.1 device
String authToken = f.getResult().getString(AccountManager.KEY_AUTHTOKEN);

 doCoolAndExcitingStuffOnAnAndroid2Dot1Device(authToken);
 }
}, handler);


  In the same spirit: I did not run it on the emulator, because the API is
not there, not even when I create an emulator with the Google API.

  I don't see the source code for
com.google.android.googleapps.GoogleLoginService, so I can't check that.

Cheers,
Mariano

-- 
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

[android-developers] Android 2.0.1 / SDK Level 6 or 7 or what?

2010-02-05 Thread Mariano Kamp
I see changed behavior in WebView on 2.0.1 devices, so I just read up
(however little there was - very quick read) on
WebSettings.getDefaultZoom(). It says Level 7. I checked the 2.0.1 SDK and
it returns Level 6. However when checking for the method getDefaultZoom()
with reflection, yay, it is there. That also explains the changed behavior.

Am I missing something here or is this the right approach? Should I check
for the existence of methods to find out what version I am dealing with?
What happens when an existing behavior changes without adding new methods,
like WebView did between 1.6 and 2.0? What is the level information in the
API docs good for?

-- 
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

[android-developers] WebView: How to find out that is scrolled?

2010-01-31 Thread Mariano Kamp
I would like to be notified when the user scrolled in the WebView.

Besides WebView.setScrollChanged() being protected this looks like the right
method. Unfortunately it doesn't seem to care for user induced scrolling,
e.g. scrolling with the keyboard.

Any idea?

Cheers,
Mariano

-- 
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

[android-developers] Re: How to narrow down PACKAGE_REPLACED, PACKAGE_ADDED?

2010-01-29 Thread Mariano Kamp
Anyone? ;)

On Wed, Jan 27, 2010 at 9:27 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hey,

 I need to listen to the above mentioned actions/events. I am actually only
 interested in two packages. Now with the current declaration in my manifest
 my app's process is started every time any app is installed or replaced:

 receiver
 android:name=com.newsrob.PackageChangedReceiver
  intent-filter
 action
 android:name=android.intent.action.PACKAGE_REPLACED /
  action
 android:name=android.intent.action.PACKAGE_ADDED /
  data
 android:scheme=package /
 /intent-filter
  /receiver

 I currently do the filtering in my code, but is there a way to do this
 declaratively too?

 Cheers,
 Mariano



-- 
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

[android-developers] Re: How to find GoogleLoginServiceConstants.FEATURE_LEGACY_HOSTED_OR_GOOGLE?

2010-01-28 Thread Mariano Kamp
*bump* ;-)

On Fri, Jan 22, 2010 at 12:32 PM, Mariano Kamp mariano.k...@gmail.comwrote:

 Hi,

 I am trying to use the new Account API to get rid of my homegrown
 authentication against Google. The recently introduced Account API seems to
 do the trick, only it is totally undocumented about the use with Google as
 provider.

 Now that the Android 2.1 sources are out I checked if the official apps
 meanwhile use the new API - and they do - Yay! Unfortunately they still
 access non-sdk code. So to replicate its functionality I would need to know
 what 
 com.google.android.googlelogin.GoogleLoginServiceConstantsFEATURE_LEGACY_HOSTED_OR_GOOGLE
 contains.

 I get a ClassNotFoundException when I try to load the class with
 Class.forName(). I tried this on an Android 2.1 emulator with the Google API
 and on an 2.0 Droid.

 How do I get my hands on this class?


-- 
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

[android-developers] How to narrow down PACKAGE_REPLACED, PACKAGE_ADDED?

2010-01-27 Thread Mariano Kamp
Hey,

I need to listen to the above mentioned actions/events. I am actually only
interested in two packages. Now with the current declaration in my manifest
my app's process is started every time any app is installed or replaced:

receiver
android:name=com.newsrob.PackageChangedReceiver
intent-filter
action
android:name=android.intent.action.PACKAGE_REPLACED /
action
android:name=android.intent.action.PACKAGE_ADDED /
data
android:scheme=package /
/intent-filter
/receiver

I currently do the filtering in my code, but is there a way to do this
declaratively too?

Cheers,
Mariano

-- 
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

[android-developers] How to find GoogleLoginServiceConstants.FEATURE_LEGACY_HOSTED_OR_GOOGLE?

2010-01-22 Thread Mariano Kamp
Hi,

I am trying to use the new Account API to get rid of my homegrown
authentication against Google. The recently introduced Account API seems to
do the trick, only it is totally undocumented about the use with Google as
provider.

Now that the Android 2.1 sources are out I checked if the official apps
meanwhile use the new API - and they do - Yay! Unfortunately they still
access non-sdk code. So to replicate its functionality I would need to know
what 
com.google.android.googlelogin.GoogleLoginServiceConstantsFEATURE_LEGACY_HOSTED_OR_GOOGLE
contains.

I get a ClassNotFoundException when I try to load the class with
Class.forName(). I tried this on an Android 2.1 emulator with the Google API
and on an 2.0 Droid.

How do I get my hands on this class?

-- 
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

[android-developers] Where can the user select different font-sizes?

2010-01-21 Thread Mariano Kamp
Hi,

  I have requests to offer different font sizes in my app, in particular
offer bigger sizes for people with less than perfect vision.

  Now, I could my own preferences and mechanism for that, but I think that
the font-size is more user/phone-specific than app-specific. So what is the
proper way to deal with that?

  I found a setting for font-sizes in the spare parts app, but besides being
in spare parts only, the setting didn't stick.

  I also found this configuration setting:
http://developer.android.com/reference/android/content/res/Configuration.html#fontScaleBut
where can the user set this font scale?

Cheers,
Mariano
-- 
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

[android-developers] Best practice for dealing with assets on different dpi devices?

2010-01-21 Thread Mariano Kamp
My app provides some images in its asset directory. Is there any right way
to deal with different resolutions? There doesn't seem to be an asset-hdpi
directory ;-) Some of those images are buttons and I would appreciate if
they are of the same relative size.
-- 
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

[android-developers] Initialization Order? ContentProvider vs. Application

2010-01-15 Thread Mariano Kamp
Sometimes less than 1 promille of the database upgrades of my app fail. This
in itself would be annoying, but what is worse that I don't get to know
about it .. usually.

I installed an exception handler in my Application, but it seems that the
ContentProvider get initialized before the Application and the
ContentProvider needs the db upgrade that subsequently fails and gets not
reported, because the Application has not been initialized yet.

Any idea if there is a fixed order in which what is started?
-- 
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

[android-developers] VerifyError issue with Android 1.5 devices

2010-01-14 Thread Mariano Kamp
I got an error message from a user that runs Android 1.5. The error reported
os a java.lang.VerifyError and it seems to be based on the method
setBuildInZoomControls missing. The thing is that this method should be
there on an Android 1.5 device and my app's manifest specifies the minimum
sdk level as 3.

uses-sdk
android:minSdkVersion=3
android:targetSdkVersion=4/uses-sdk

The documentation for that method says that it is available on level 3:
http://developer.android.com/reference/android/webkit/WebSettings.html#setBuiltInZoomControls(boolean)

So why do I get this error message?

Cheers,
Mariano

Short Excerpt:

01-13 12:08:13.548 I/ActivityManager(   55): Starting activity: Intent {
comp={com.newsrob/com.newsrob.activities.ShowArticleActivity} (has extras) }
*01-13 12:08:13.738 E/dalvikvm(  407): Could not find method
android.webkit.WebSettings.setBuiltInZoomControls, referenced from method
com.newsrob.activities.ShowArticleActivity.createWebView*
01-13 12:08:13.738 W/dalvikvm(  407): VFY: unable to resolve virtual method
248: Landroid/webkit/WebSettings;.setBuiltInZoomControls (Z)V
01-13 12:08:13.738 W/dalvikvm(  407): VFY:  rejecting opcode 0x6e at 0x004c
01-13 12:08:13.738 W/dalvikvm(  407): VFY:  rejected
Lcom/newsrob/activities/ShowArticleActivity;.createWebView
(Landroid/view/View;)V
01-13 12:08:13.738 W/dalvikvm(  407): Verifier rejected class
Lcom/newsrob/activities/ShowArticleActivity;
01-13 12:08:13.768 W/dalvikvm(  407): Class init failed in newInstance call
(Lcom/newsrob/activities/ShowArticleActivity;)
01-13 12:08:13.768 D/AndroidRuntime(  407): Shutting down VM
01-13 12:08:13.768 W/dalvikvm(  407): threadid=3: thread exiting with
uncaught exception (group=0x4000fe70)
01-13 12:08:13.948 E/NewsRob (  407): Caught the following exception:
*01-13 12:08:13.948 E/NewsRob (  407): java.lang.VerifyError:
com.newsrob.activities.ShowArticleActivity*

Longer Excerpt:

01-13 12:08:06.988 D/com.newsrob.AssetContentProvider(  407): onCreate()
01-13 12:08:07.498 D/com.newsrob.storage.SdCardStorageAdapter(  407):
setupMedium status=mounted mounted false-true, read-only false-false,
shared false - false.
01-13 12:08:07.528 D/NewsRob (  407): NewsRob.onCreate()
01-13 12:08:07.528 D/NewsRobDefaultExceptionHandler(  407): Default
Exception
handler=com.android.internal.os.runtimeinit$uncaughthand...@43680648
01-13 12:08:07.588 W/NewsRob (  407): No debug properties loaded.
01-13 12:08:08.348 W/IInputConnectionWrapper(  101): showStatusIcon on
inactive InputConnection
01-13 12:08:08.448 I/ActivityManager(   55): Displayed activity
com.newsrob/.DashboardListActivity: 2653 ms
01-13 12:08:09.758 I/ActivityManager(   55): Starting activity: Intent {
comp={com.newsrob/com.newsrob.activities.FeedListActivity} (has extras) }
01-13 12:08:10.488 I/ActivityManager(   55): Displayed activity
com.newsrob/.activities.FeedListActivity: 729 ms
01-13 12:08:11.258 I/ActivityManager(   55): Starting activity: Intent {
comp={com.newsrob/com.newsrob.activities.ArticleListActivity} (has extras) }
01-13 12:08:11.848 D/dalvikvm(   55): GC freed 15105 objects / 728320 bytes
in 303ms
01-13 12:08:12.168 D/dalvikvm(  407): GC freed 3444 objects / 199360 bytes
in 123ms
01-13 12:08:12.928 I/ActivityManager(   55): Displayed activity
com.newsrob/.activities.ArticleListActivity: 1665 ms
01-13 12:08:13.548 I/ActivityManager(   55): Starting activity: Intent {
comp={com.newsrob/com.newsrob.activities.ShowArticleActivity} (has extras) }
01-13 12:08:13.738 E/dalvikvm(  407): Could not find method
android.webkit.WebSettings.setBuiltInZoomControls, referenced from method
com.newsrob.activities.ShowArticleActivity.createWebView
01-13 12:08:13.738 W/dalvikvm(  407): VFY: unable to resolve virtual method
248: Landroid/webkit/WebSettings;.setBuiltInZoomControls (Z)V
01-13 12:08:13.738 W/dalvikvm(  407): VFY:  rejecting opcode 0x6e at 0x004c
01-13 12:08:13.738 W/dalvikvm(  407): VFY:  rejected
Lcom/newsrob/activities/ShowArticleActivity;.createWebView
(Landroid/view/View;)V
01-13 12:08:13.738 W/dalvikvm(  407): Verifier rejected class
Lcom/newsrob/activities/ShowArticleActivity;
01-13 12:08:13.768 W/dalvikvm(  407): Class init failed in newInstance call
(Lcom/newsrob/activities/ShowArticleActivity;)
01-13 12:08:13.768 D/AndroidRuntime(  407): Shutting down VM
01-13 12:08:13.768 W/dalvikvm(  407): threadid=3: thread exiting with
uncaught exception (group=0x4000fe70)
01-13 12:08:13.948 E/NewsRob (  407): Caught the following exception:
01-13 12:08:13.948 E/NewsRob (  407): java.lang.VerifyError:
com.newsrob.activities.ShowArticleActivity
01-13 12:08:13.948 E/NewsRob (  407): at
java.lang.Class.newInstanceImpl(Native Method)
01-13 12:08:13.948 E/NewsRob (  407): at
java.lang.Class.newInstance(Class.java:1472)
01-13 12:08:13.948 E/NewsRob (  407): at
android.app.Instrumentation.newActivity(Instrumentation.java:1097)
01-13 12:08:13.948 E/NewsRob (  407): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2183)
01-13 12:08:13.948 

Re: [android-developers] VerifyError issue with Android 1.5 devices

2010-01-14 Thread Mariano Kamp
On Thu, Jan 14, 2010 at 5:31 PM, TreKing treking...@gmail.com wrote:

 I ran into an issue with the Motorola Cliq maps implementation (on 1.5)
 that wasn't happening on other phones because that device's particular build
 didn't have the correct implementation of the MyLocationOverlay class.


Ah, I see. That would make sense. Then I will revert back my code to use
reflection again and put the zoom controls in the GUI myself if the method
is not there.


 Do you know which device specifically? Sounds like another one of those
 awesome device-specific issues. If you know which device, do a search and
 see if it's a known issue with it.


Yes, I do. At least about the one user that sent the report:

01-13 12:08:17.068 D/NewsRobDefaultExceptionHandler(  407): -- Android
Version: sdk=3, release=1.5, inc=138607
01-13 12:08:17.068 D/NewsRobDefaultExceptionHandler(  407): -- Custom ROM:
Stock Android
01-13 12:08:17.068 D/NewsRobDefaultExceptionHandler(  407): -- Device:
sapphire
01-13 12:08:17.068 D/NewsRobDefaultExceptionHandler(  407): -- Model: HTC
Magic

Two more users reported in the Market comments it would force close on their
Heroes. Might be the same issue, but it is strange that they didn't send the
automatic bug report then.

I 
googledhttp://www.google.com/search?hl=enq=HTC+%2BMagic+%2BsetBuiltInZoomControls+-map+-mapViewaq=foq=aqi=it,
but didn't find anything, except my post and reports about the Map's
setBuiltInZoomControls method missing.
I'll do the reflection thing from above and hope that I find an affected
user that can try it out.

Love your app BTW =)

Awesome. Thanks for letting me know.
It looks like (see above) you have to suffer through another bugfix update
though ;-)
-- 
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

Re: [android-developers] Re: PACKAGE_ADDED, PACKAGE_REMOVED and PACKAGE_REPLACED...

2010-01-11 Thread Mariano Kamp
*bump* ;-)

On Thu, Nov 19, 2009 at 12:19 AM, sdphil phil.pellouch...@gmail.com wrote:

 how do you do that?

 I tried:

 receiver android:name=com.test.MyApp.UpdateReceiver
intent-filter
action android:name=android.intent.action.PACKAGE_ADDED/
action android:name=android.intent.action.PACKAGE_REMOVED/
action android:name=android.intent.action.PACKAGE_REPLACED/
 
 data android:scheme=package android:path=com.test.MyApp/
/intent-filter
 /receiver

 And a bunch of variations of android:path, but I couldn't get it to
 only notify me when it was my app.

 tia.

 On Nov 18, 12:58 pm, Dianne Hackborn hack...@android.com wrote:
  Please register for only your specific package name, not every package,
 so
  your app doesn't get launched every time another app is installed or
  uninstalled.
 
 
 
  On Wed, Nov 18, 2009 at 12:21 PM, sdphil phil.pellouch...@gmail.com
 wrote:
   oh, okay, so I added this line to my manifest --
 
  data android:scheme=package/
 
   and it seemed to work.  I get a removed followed by a replaced.  as is
   documented here:
 
  http://developer.android.com/intl/fr/guide/appendix/faq/framework.html
 
   now I just gotta figure out how to remove/replace the app widget when
   i get this...  anyone??
 
   On Nov 18, 12:13 pm, sdphil phil.pellouch...@gmail.com wrote:
when I re-install an application, i get PACKAGE_REMOVED followed by
PACKAGE_ADDED.
 
I never see PACKAGE_REPLACED.  any ideas why?  And actually, I never
see any of the PACKAGE_* actions except in LogCast -- I cannot get my
broadcast receiver to get the events.
 
i'm doing this in the emulator using adb --
 
adb install -r MyApp.apk
 
My Android manifest has these lines in it:
 
application...
...
...
receiver
 android:name=com.test.MyApp.UpdateReceiver
intent-filter
action
   android:name=android.intent.action.PACKAGE_ADDED/
action
   android:name=android.intent.action.PACKAGE_REMOVED/
action
   android:name=android.intent.action.PACKAGE_REPLACED/
/intent-filter
/receiver
...
...
/application
 
And my UpdateReceiver.java looks like this:
 
package com.test.MyApp;
 
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
 
public class UpdateReceiver extends BroadcastReceiver {
 
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
System.err.println(action:  + action);
}
 
}
 
tia.
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see
 and
  answer them.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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

  1   2   3   4   >