[android-developers] Eclipse ADT Support Going Forward

2014-12-09 Thread authorwjf
Now that Android Studio has reached the 1.0 landmark will future versions 
of the build tools, support libs, and ADT images continue to be released 
for both ADT and AS in tandem or can we expect to start seeing Android 
Studio only packages and features?  It would be awesome if someone from the 
Android build tools team could chime in.  I am all for Android Studio but 
support a lot of client apps and need to be able to give them valid reasons 
why they should allow me to take hours from their maintenance allocations 
to update the projects to the new build tools.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: Dynamically changing the language at runtime

2012-08-22 Thread authorwjf
Related to this same question, if it is not supported to change the locale 
outside of the built-in OS configurations, how can I request a language 
specific soft keyboard on-the-fly?  I don't necessarily need code, just a 
push in the right direction.

-- 
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: Dynamically changing the language at runtime

2012-08-21 Thread authorwjf


 I know this is a pretty old thread, but I'm curious if it is still the 
 contention of the team at Google that changing the language at runtime is a 
 bad idea?  If so, what are my alternatives?  I am doing a kisosk 
 application for a corporate customer so I can't fire the intent to bring up 
 the OS config menu.  I did a similar product on an embedded Windows 
 (shudder) system a few years ago and we basically just implemented our own 
 getString(prompt_id, sel_lang) call along with a structure of flat files to 
 represent the different languages supported.  I suppose the same approach 
 is doable on Android but I'm curious if there is something already there 
 that I could/should be doing.  Thanks! 

-- 
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: ICS Listview Selector

2011-12-29 Thread authorwjf
One solution I've come across is not to use: item
android:drawable=@android:color/transparent / for the default state
but rather a solid color such as white.  This effectively fixes the
demo code, however it still causes issues in my production environment
because the background of the listview itself is a custom graphic and
thus I wanted it to show through.

-- 
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] ICS Listview Selector

2011-12-28 Thread authorwjf
Howdy UI Gurus!

I am having an issue with a custom list selector.  I tried to whittle
the code down to a very small subset that runs independently of my
project in hopes someone more familiar with the UI framework than I
could assist.  Basically, I have a custom selector I have been using
for listviews in my application.  It has 2 states, a gray gradient,
and everything else.  In the case of everything else, I want the view
to be transparent.  It worked fine and still does on the majority of
platforms, however on ICS devices after the user touches and releases
an item in the list there is an animation of an orange bar that fades
in and away.  I don't want this--but I'm not sure how to get rid of
it.  Are there new states now (or behavior?) in later versions of the
OS?  I'm not sure.  Here is the code that demonstrates the issue on
the emulator.  It works as I'd like on Gingerbread devices, but not on
ICS.  I don't know about Honeycomb.  Thanks in advance to anyone who
posts a reply.

Cheers!

main.xml
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical
android:background=#ff
ListView
android:id=@+id/android:list
android:layout_width=fill_parent
android:layout_height=wrap_content
android:dividerHeight=1dip
android:layout_gravity=center
android:background=@android:color/transparent
android:cacheColorHint=#
android:layout_margin=8dip
android:gravity=center
android:focusable=false/
/LinearLayout

list_item.xml
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=wrap_content
android:padding=6dip
android:focusable=false
android:background=@layout/my_list
   TextView
android:id=@+id/label
android:layout_height=wrap_content
android:layout_width=fill_parent
android:textSize=16sp
android:textColor=#00ff00
android:padding=2dip/
/LinearLayout

my_list.xml
selector xmlns:android=http://schemas.android.com/apk/res/
android
item   android:state_pressed=true
android:drawable=@drawable/pressed /
item   android:state_focused=true
android:drawable=@drawable/pressed /
item   android:state_selected=true
android:drawable=@drawable/pressed /
item   android:drawable=@android:color/transparent /
/selector

pressed.xml
?xml version=1.0 encoding=utf-8?
shape xmlns:android=http://schemas.android.com/apk/res/android;
gradient
android:startColor=#3A3C39
android:endColor=#181818
android:angle=270/
corners android:radius=0dp /
/shape

Main.java
package com.authorwjf.grobble;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class Main extends ListActivity {

   private String[] mFruits = {apple, orange, bannana, pear,
kiwi, grapes, strawberry};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setListAdapter(new ArrayAdapterString(this,
R.layout.list_item, R.id.label, mFruits));
}
}

-- 
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] Reusing Views in Custom Adapter

2011-11-29 Thread authorwjf
Hi Android Framework Gurus!

I am hoping someone out there can answer a question for me about re-
using views in my adapters.  My understanding, is that for performance
reasons this is something I should always always always do.  Yet in my
experience, doing so always results in the view, whether a grid or
list, going wonky once I get very many children in the view.  I
suspect, I'm just doing something flat out wrong.  So I put together a
simple straight-forward project to demonstrate both how I attempt to
re-use the views in a grid view, and how it goes bonkers if you add a
few hundred entries and scroll the list.  I've tested on both the
cupcake emulator as well as my gingerbread device with the same
results.

Thanks in advance to anyone who takes the time to respond!

==Layouts==
main.xml
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical 
TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Reuse Views Demo /
GridView
android:id=@+id/gridview
android:layout_width=fill_parent
android:layout_height=fill_parent
android:padding=5dp
android:verticalSpacing=5dp
android:horizontalSpacing=10dp
android:numColumns=auto_fit
android:columnWidth=60dp
android:stretchMode=columnWidth
android:gravity=center_horizontal/
/LinearLayout

grid_item.xml
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
   android:id=@+id/GridItem
   android:layout_width=fill_parent
   android:layout_height=wrap_content
   android:orientation=vertical
   android:gravity=center_horizontal
   TextView android:id=@+id/grid_item_text
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:gravity=center_horizontal
  android:layout_marginBottom=4dip/
/LinearLayout

==source==
Main.java
package com.authorwjf.reuseviews;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;

public class Main extends Activity {

private CustomAdapter mAdapter;
private ArrayListString mItems = new ArrayListString();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
for (int i = 0; i200; i++) {
mItems.add(Integer.toString(i));
}
mAdapter = new CustomAdapter(this, mItems);
GridView g = (GridView) findViewById(R.id.gridview);
g.setAdapter(mAdapter);
}
}

CustomAdapter.java
package com.authorwjf.reuseviews;
import java.util.ArrayList;
import com.authorwjf.reuseviews.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CustomAdapter extends BaseAdapter {

private Context mContext;
private ArrayListString mItems;

public CustomAdapter(Context c, ArrayListString items) {
mContext = c;
mItems = items;
}

@Override
public int getCount() {
return mItems.size();
}

@Override
public Object getItem(int position) {
return mItems.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v = convertView;
if (v == null) {
 LayoutInflater li = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 v = li.inflate(R.layout.grid_item, null);
 TextView tv = (TextView)v.findViewById(R.id.grid_item_text);
 tv.setText(Item #+mItems.get(position));
}
return v;
}

}




-- 
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: Reusing Views in Custom Adapter

2011-11-29 Thread authorwjf
You've hit the problem exactly YuvieDroid.  Boy do I feel dumb.  I
thought if the view was being re-used then the layout items on that
view were preserved as well.  Moving the bracket on the if statement
fixed the issue immediately.  Thanks!

On Nov 29, 1:44 pm, YuviDroid yuvidr...@gmail.com wrote:
 You should always set the whole content of the layout in getView(). When
 v is not null right now you are returning that view without setting your
 text.
 Something like this:

 public View getView(int position, View convertView, ViewGroup parent) {
                View v = convertView;
                if (v == null) {
                         LayoutInflater li = (LayoutInflater)
 mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                 v = li.inflate(R.layout.grid_item, null);
                }

                 TextView tv = (TextView)v.findViewById(R.id.grid_item_text);
                 tv.setText(Item #+mItems.get(position));

                return v;









 }
 On Tue, Nov 29, 2011 at 5:17 PM, Kumar Bibek coomar@gmail.com wrote:
  What exactly is the problem. Bonkers doesn't really tell us much.

  On Nov 29, 8:12 pm, authorwjf wfran...@softlayer.com wrote:
   Hi Android Framework Gurus!

   I am hoping someone out there can answer a question for me about re-
   using views in my adapters.  My understanding, is that for performance
   reasons this is something I should always always always do.  Yet in my
   experience, doing so always results in the view, whether a grid or
   list, going wonky once I get very many children in the view.  I
   suspect, I'm just doing something flat out wrong.  So I put together a
   simple straight-forward project to demonstrate both how I attempt to
   re-use the views in a grid view, and how it goes bonkers if you add a
   few hundred entries and scroll the list.  I've tested on both the
   cupcake emulator as well as my gingerbread device with the same
   results.

   Thanks in advance to anyone who takes the time to respond!

   ==Layouts==
   main.xml
   ?xml version=1.0 encoding=utf-8?
   LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android
       android:layout_width=fill_parent
       android:layout_height=fill_parent
       android:orientation=vertical 
       TextView
           android:layout_width=fill_parent
           android:layout_height=wrap_content
           android:text=Reuse Views Demo /
       GridView
                   android:id=@+id/gridview
                   android:layout_width=fill_parent
                   android:layout_height=fill_parent
           android:padding=5dp
               android:verticalSpacing=5dp
               android:horizontalSpacing=10dp
               android:numColumns=auto_fit
               android:columnWidth=60dp
               android:stretchMode=columnWidth
               android:gravity=center_horizontal/
   /LinearLayout

   grid_item.xml
   LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android
      android:id=@+id/GridItem
      android:layout_width=fill_parent
      android:layout_height=wrap_content
      android:orientation=vertical
      android:gravity=center_horizontal
      TextView android:id=@+id/grid_item_text
         android:layout_width=wrap_content
         android:layout_height=wrap_content
         android:gravity=center_horizontal
         android:layout_marginBottom=4dip/
   /LinearLayout

   ==source==
   Main.java
   package com.authorwjf.reuseviews;

   import java.util.ArrayList;

   import android.app.Activity;
   import android.os.Bundle;
   import android.widget.GridView;

   public class Main extends Activity {

           private CustomAdapter mAdapter;
           private ArrayListString mItems = new ArrayListString();

       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.main);
           for (int i = 0; i200; i++) {
                   mItems.add(Integer.toString(i));
           }
           mAdapter = new CustomAdapter(this, mItems);
           GridView g = (GridView) findViewById(R.id.gridview);
           g.setAdapter(mAdapter);
       }

   }

   CustomAdapter.java
   package com.authorwjf.reuseviews;
   import java.util.ArrayList;
   import com.authorwjf.reuseviews.R;
   import android.content.Context;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.ViewGroup;
   import android.widget.BaseAdapter;
   import android.widget.TextView;

   public class CustomAdapter extends BaseAdapter {

           private Context mContext;
           private ArrayListString mItems;

       public CustomAdapter(Context c, ArrayListString items) {
           mContext = c;
           mItems = items;
       }

           @Override
           public int getCount() {
                   return mItems.size();
           }

           @Override
           public Object getItem(int position

[android-developers] using java decimal formatter outside USA

2011-08-30 Thread authorwjf
Hello All,

I am running into an issue with some of my European users.  To
demonstrate the issue I isolated the following three lines of code:

float gb = 0;
DecimalFormat dfm = new DecimalFormat( #,###,###,##0.0 );
float mTotalRamInstalled = (float) new
Float(dfm.format(gb)).floatValue();

I am trying to get 0.0 as my output (in this case--its actually part
of a function where gb is passed in).

When I set the emulator language to English (USA) it works fine.  But
several other countries, for example Deutsch (Schweiz), the
application blows up with  number format exception.  Can anyone give
me some pointers as to what is happening and how I should be handling
this as obviously I am doing it wrong.

Thanks!

-- 
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: using java decimal formatter outside USA

2011-08-30 Thread authorwjf
Thanks for pointing me in the right direction!  I knew I had to be
doing something wrong :)

-- 
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: using java decimal formatter outside USA

2011-08-30 Thread authorwjf
just for completeness

float gb = 0;
NumberFormat dfm = new DecimalFormat.getInstance();
dfm.setMaximumFractionDigits(1);
dfm.setMinimumFractionDigits(1);
float mTotalRamInstalled = (float) new
Float(dfm.format(gb)).floatValue();

-- 
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] JRE and class loader on an Android device.

2011-08-26 Thread authorwjf
Hello,

I have a question concerning how classes are loaded at runtime and I
am hoping someone out there has the inside scoop.  Basically I am
supporting an app that has a significant following.  The app parses
JSON responses from a web server.  A handful of users are getting a
JSON parse error.  The common thread is these users all seem to have a
particular model of phone.

With the help of a couple very committed users, I was able to get a
lot of app level network logging.  What I see is the following
element as part of a larger JSON response giving me trouble:

virtualGuests:[]

The response is loaded into a JSON array like this:

JSONArray guests = result.getJSONArray(virtualGuests);

where result is a JSON object that contains among other things the
empty virtual guest array.

The problem appears to be that on 99% of the phones where my app runs,
guests is returned as an empty JSON array, but on a handful of phones,
guests comes back NULL.  I've even went so far as to re-inject the
recorded network stream into the program and the same input appears
to produce different output in the case of an HTC Desire.

The best I could figure is that perhaps the JAR file on this device
that handles the JSON manipulation (I'm importing org.json.JSONArray),
is different on the devices where the user seems to encounter this
problem.  That said, I'm not even all that familiar with how the
import works in JAVA, and how similar the JRE process is on Android to
the desktop environment.

I believe I can work around this issue now that I know where the
problem is manifesting.  But I'd appreciate if someone out there can
explain to me better how classes I import into my app get resolved at
runtime so I am confident this is my issue and might give me some idea
of what I may need to look out for in the future if I continue parsing
JSON in this manner.

Thanks in advance to anyone who takes the time to respond!

-- 
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: A little help with layout params in code.

2011-07-26 Thread authorwjf
No responses so either my question stumped everyone or it was too
obvious for anyone to bother :)  Either way I finally got it to work
so if it saves anyone else 4 days of pouring over documentation here
is the code.

if (v.getId()==R.id.add_row) {
mRowCount++;
TableLayout table =
(TableLayout)findViewById(R.id.the_table);
TableRow row = new TableRow(this);
TextView tv1 = new TextView(this);
TextView tv2 = new TextView(this);
ImageView iv = new ImageView(this);
tv1.setText(Table row
#+Integer.toString(mRowCount));
tv1.setGravity(Gravity.LEFT);
TableRow.LayoutParams trp = new
TableRow.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT,Gravity.LEFT);
row.addView(tv1, trp);
iv.setImageResource(R.drawable.divider);
row.addView(iv, trp);
tv2.setText(Add more text here.);
row.addView(tv2, trp);
table.addView(row);
}

-- 
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: Issue with Android Menu

2011-07-26 Thread authorwjf
You need a lower case o when you declare public boolean
onOptionsItemSelected(MenuItem item){ .  Java is case sensitive and
using an uppercase letter as you are doing now creates a new method
that while valid is not actually hooked to the OS menu framework.
Cheers!

-- 
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: A little help with layout params in code.

2011-07-25 Thread authorwjf
Does anybody out there have experience formatting table row contents,
(not comments), in code?

-- 
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] A little help with layout params in code.

2011-07-24 Thread authorwjf
Hi All,

I am hoping someone out there can give me an idea what I am doing
wrong.  I wanted to create a table dynamically in my application,
which I did, but also I wanted to be able to set some of the layout
parameters, specifically the gravity and layout_gravity for a couple
text views and one image view.

I thought it would be pretty straight forward and tried the following
code:


  if (v.getId()==R.id.add_row) {
mRowCount++;
TableLayout table = 
(TableLayout)findViewById(R.id.the_table);
TableRow row = new TableRow(this);
TextView tv1 = new TextView(this);
TextView tv2 = new TextView(this);
ImageView iv = new ImageView(this);
tv1.setText(Table row #+Integer.toString(mRowCount));
tv1.setGravity(Gravity.LEFT);
//The following line causes my textview to
disappear
tv1.setLayoutParams(new
LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.LEFT));
row.addView(tv1);
iv.setImageResource(R.drawable.divider);
//And the line after this one does the same to
my imageview
iv.setLayoutParams(new
FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.CENTER));
row.addView(iv);
tv2.setText(Add more text here.);
row.addView(tv2);
table.addView(row);
}

Unfortunately I've been unable to get this to work.  The problem is
that whenever I assign the layout parameters to either my text view or
my image view, that view seems to not get added to my table row, or if
it does, its not at all visible.  Does anybody out there have
experience formatting table row comments in code?  I'd sure appreciate
being pointed in the right direction.

Thanks!

-- 
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: Eclipse - Android - can't connect my device to Eclipse

2011-07-15 Thread authorwjf
And don't forget to turn on USB debugging on your phone under
application settings.

-- 
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: Soft Keyboard appears when entering on an Activity

2011-07-05 Thread authorwjf
I had similar issues and with some testing found that adding:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
as the last line of my onCreate() in each class that extends Activity
did the trick.  Like you the issue with the soft keyboard popping up
did not seem to affect every phone in my test arsenal but adding the
line above has worked as a universal fix without any unwanted side
affects that I'm aware of.

-- 
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: Soft Keyboard appears when entering on an Activity

2011-07-05 Thread authorwjf
I encountered a similar problem and found with some testing that
adding:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
as the last line of the onCreate() for each class that extends
Activity did the trick.  P.S. I apologize in advance if this post
shows up twice.  My browser died last time when I hit submit :)

-- 
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 do you deal with skins clashing with your UI?

2011-06-01 Thread authorwjf
If you want to use the spinner theme and insure its integrity why not
package that theme with your application?  Just move a copy to your /
res folder, rename it, and reference your local version.

-- 
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: UI Framework Bug?

2011-05-13 Thread authorwjf
For anyone encountering similar problems Kostya was correct in both of
his suggestions.  Using the built-in progress bar works, or if you
need a custom animated icon you can modify the getView method as in my
sample as so:

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
   View v = convertView;
  if (v == null) {
LayoutInflater vi =
(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list_view_row, null);
  }
  TextView label = (TextView) v.findViewById(R.id.label);
  ImageView spinner = (ImageView) v.findViewById(R.id.spinner);
  MyContainer item = (MyContainer) items.get(position);
  Animation spinnerAnimation =
AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
  label.setText(item.getText());
  spinner.clearAnimation();
  spinner.setVisibility(View.INVISIBLE);
  if (item.isLoading()) {
 label.setText(***+item.getText()+***);
 spinner.setVisibility(View.VISIBLE);
 spinner.startAnimation(spinnerAnimation);
  }
  return v;
}

Thanks again to everyone out there who gave me a hand with this.  The
community support around Android is awesome.

-- 
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] UI Framework Bug?

2011-05-12 Thread authorwjf
Hello Android UI Gurus,

I have been struggling for a few days now with an annoying UI issue.
I've whittled the project down to nothing but a small demonstration of
the problem.  I admit I'm pretty new to Android UI work, but at the
same time I'm an experienced, qualified engineer and I just can't seem
to figure this out.  I was hoping to get some feedback from some of
you out there who are more familiar with the internals and
idiosyncrasies  of the platform.  Any help would be greatly
appreciated!

The desired behavior:
I have a list view.  Each list view row consists of a text element,
and a hidden image.  When an item is selected from the list, I'd like
to make the image visible, and, start an animation on it.  Pretty
standard stuff here, we're talking basically about a loading
spinner.

The problem:
After selecting 2 or sometimes 3 items in the list, I see spinners
become visible and start animating for rows which were never
selected.  The two things that lead me to believe this is a bug with
the platform are:

A) Putting in a break point I can clearly see that the underlying data
source from the list does not have the isSpinning property set for
the items that begin animating in a seemingly random manner.

and

B) The only code that makes the image visible and begins the animation
for that row is inside of my custom data adapter.  Before it can start
the animation it changes the text field in that row as well.  The text
fields are not changed in the rows where my spinners seem to appear of
their own accord.

The code:
As I said when I started this post I've removed everything from the
project except the relevant UI code.  Here is what I have.

/res/layout
main.xml=
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent 
TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello/
ListView
android:id=@+id/android:list
android:layout_width=fill_parent
android:layout_height=fill_parent
android:cacheColorHint=#
android:background=@android:color/transparent
android:dividerHeight=1dip/
/LinearLayout

list_view_row.xml=
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=?android:attr/listPreferredItemHeight
android:padding=6dip
LinearLayout
android:layout_width=fill_parent
android:layout_height=wrap_content
android:orientation=horizontal
TextView
android:id=@+id/label
android:textSize=11sp
android:padding=2dip
android:gravity=center_vertical|center
android:layout_gravity=center_vertical|center
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textColor=#ff/
ImageView
android:id=@+id/spinner
android:padding=2dip
android:src=@drawable/loading
android:layout_width=wrap_content
android:layout_height=wrap_content/
/LinearLayout
/LinearLayout

/res/anim
rotate.xml=
?xml version=1.0 encoding=UTF-8?
rotate
xmlns:android=http://schemas.android.com/apk/res/android;
android:fromDegrees=0
android:toDegrees=360
android:pivotX=50%
android:pivotY=50%
android:repeatCount=infinite
android:interpolator=@android:anim/linear_interpolator
android:duration=1900 /

/res/drawable
spinner.png

/src
MyContainer.java=
public class MyContainer {
private String mText = ;
private Boolean mLoading = false;

public void setText(String mText) {
this.mText = mText;
}
public String getText() {
return mText;
}
public void setIsLoading(Boolean mLoading) {
this.mLoading = mLoading;
}
public Boolean isLoading() {
return mLoading;
}
}

CustomAdapter.java=
public class CustomAdapter extends ArrayAdapterMyContainer {

private ArrayListMyContainer items;
private Context c = null;

public CustomAdapter(Context context, int textViewResourceId,
ArrayListMyContainer items) {
   super(context, textViewResourceId, items);
   this.items = items;
   this.c = context;
   }

@Override
public View getView(int position, View convertView, ViewGroup
parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi =
(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list_view_row, null);
}

[android-developers] Re: UI Framework Bug?

2011-05-12 Thread authorwjf
I'm also including a few pics to illustrate the issue in case my text
isn't entirely clear.

[IMG]http://i53.tinypic.com/339oemx.png[/IMG]

(http://tinypic.com/r/339oemx/7)

[IMG]http://i53.tinypic.com/2qjhevo.png[/IMG]

(http://tinypic.com/r/2qjhevo/7)

[IMG]http://i56.tinypic.com/2s1agsp.png[/IMG]

(http://tinypic.com/r/2s1agsp/7)

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
Thanks, Yahel.  I will give your suggestion a try this morning.

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
Yahel's post got me to thinking.  I modified the getView method of my
data adapter to look like this:


@Override
public View getView(int position, View convertView, ViewGroup parent)
{
   LayoutInflater vi =
(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   View v = vi.inflate(R.layout.list_view_row, null);
   TextView label = (TextView) v.findViewById(R.id.label);
   ImageView spinner = (ImageView) v.findViewById(R.id.spinner);
   MyContainer item = (MyContainer) items.get(position);
   label.setText(item.getText());
   spinner.setVisibility(View.INVISIBLE);
   if (item.isLoading()) {
  label.setText(***+item.getText()+***);
  spinner = (ImageView)v.findViewById(R.id.spinner);
  spinner.setVisibility(View.VISIBLE);
  Animation spinnerAnimation =
AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
  spinner.startAnimation(spinnerAnimation);
   }
   return v;
}


And the problem seems resolved!  Great news for me.  Though I wonder
if any of you can comment as to the performance hit / impact I might
expect to take reloading the view from the layout every single time
the adapter refreshes?  I'm not experiencing any issues with the demo
program, but the lists in my actual application can get rather long
and include several lines of text for each row.

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
I am curious what you mean by make sure you have the states of the
views set up correctly.  In my original implementation, I was using
the convertView in the manner I thought was correct.  i.e.

View v = convertView;
if (v == null) {
   LayoutInflater vi =
(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   v = vi.inflate(R.layout.list_view_row, null);
}

Assuming this is what you meant, I don't get what view states I was
failing to set up that resulted in my seemingly random spinner
appearing in the list.  I had a text view and an image view for each
row, and in each case, I set the text view and image view to the
correct value for what I wanted to display.


TextView label = (TextView) v.findViewById(R.id.label);
ImageView spinner = (ImageView) v.findViewById(R.id.spinner);
MyContainer item = (MyContainer) items.get(position);
if (item.isLoading()) {
   label.setText(***+item.getText()+***);
   spinner = (ImageView)v.findViewById(R.id.spinner);
   spinner.setVisibility(View.VISIBLE);
   Animation spinnerAnimation =
AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
   spinner.startAnimation(spinnerAnimation);
} else {
   label.setText(item.getText());
   spinner.setVisibility(View.INVISIBLE);
}
return v;

The row in my list adversely affected, was never the one where I saw
this code being invoked.  What is it I should have done to my view v
before returning?  Thanks in advance for your response.  While I am
not seeing any issue yet re-inflating each time, I'd also like to do
this the way the framework intended if I can.

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
Yet the view that gets affected, is not the one being passed into the
function.  Meaning I get the callback to update say row 3, and row 3
updates correctly, but the image in row 7 might change as well.  Not
the text in row 7 though, and the only code that updated the image
view first updates the text view.  And its not always row 7, it might
be some other row or rows or none.  Commenting out these 2 lines:

Animation spinnerAnimation =
AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
spinner.startAnimation(spinnerAnimation);

corrects the weird fragment image appearing on a random list view row,
yet, I also obviously lose my animation.  I believe there has to be
something hanging around or getting reused by the framework to
optimize the image resource utilization but it doesn't appear to be
working correctly.

This image does a good job of showing the behavior I'm experiencing.

http://tinypic.com/view.php?pic=2s1agsps=7

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
BTW--I think it is interesting that I can show and hide the loading
image/icon correctly, its only when I enable the animation that things
start going wonky on rows other than the view I'm trying to affect.

-- 
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: UI Framework Bug?

2011-05-12 Thread authorwjf
Both of those are great suggestion Kostya.  Thank you.  I will give
both approaches a try and see what happens.

On May 12, 3:52 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 It probably means you need to clear the animation when there is none.

 However:

 There is already a built-in class, ProgressBar, that can show the
 standard progress wheel', and it works well with setVisbiblity, leaving
 no artifacts. Perhaps you could just use that? An added benefit is that
 you'll get vendor-specific customizations automatically.

 -- Kostya

 13.05.2011 0:43, authorwjf пишет:









  Yet the view that gets affected, is not the one being passed into the
  function.  Meaning I get the callback to update say row 3, and row 3
  updates correctly, but the image in row 7 might change as well.  Not
  the text in row 7 though, and the only code that updated the image
  view first updates the text view.  And its not always row 7, it might
  be some other row or rows or none.  Commenting out these 2 lines:

  Animation spinnerAnimation =
  AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
  spinner.startAnimation(spinnerAnimation);

  corrects the weird fragment image appearing on a random list view row,
  yet, I also obviously lose my animation.  I believe there has to be
  something hanging around or getting reused by the framework to
  optimize the image resource utilization but it doesn't appear to be
  working correctly.

  This image does a good job of showing the behavior I'm experiencing.

 http://tinypic.com/view.php?pic=2s1agsps=7

 --
 Kostya Vasilyev --http://kmansoft.wordpress.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.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Custom Menu Layout

2011-04-06 Thread authorwjf
Hi All,

This is less of a question and more just a heads up.  I spent a lot of
time looking through this forum and others trying to find a technique
for creating custom menus.  Specifically I wanted something that
looked similar to the default menus in Gingerbread in my app
regardless of which version of the Android OS was installed on the
phone.

It took me a while of piecing together information from a number of
posts and tutorials but I finally got something workable and so am
sharing the source code.  If you find yourself looking for a way to
create your own menu layouts and styles, here is my solution:
http://www.codeproject.com/KB/android/AndroidMenusMyWay.aspx.  There
is plenty of room for improvement I realize but hopefully the code
will help save some of my fellow devs some time.

Regards,
authorwjf

-- 
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: rotating a bitmap

2011-03-16 Thread authorwjf
Thanks for the suggestions Nicholas  Marcin.  I hope to get a chance
to give them both a try tomorrow night.  I especially like not having
the overhead of creating the second bitmap.  I didn't realize that was
an option.  I should have explored the canvas object more closely.

-- 
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] rotating a bitmap

2011-03-15 Thread authorwjf
Howdy Android Gurus!

I am hoping someone out there who is an expert in GFX (or at least not
a n00b like me), can give me some words of wisdom.  In my onDraw
callback I am presently displaying a simple bitmap, its just 48x48
pixels.  I load it up early on like this:

// during initialization i load the origial BitMap (48 x 48) and a
paint brush
Bitmap mBitmap =
BitmapFactory.decodeResource(getResources(),R.drawable.my_image);
Paint p = new Paint();

then in my onDraw I splat it to the canvas:

// c is my canvas object
// in my main onDraw loop i display my bitmap
c.drawBitmap(mBitmap,0,0,p);

So far so good.  Later though, I wish to rotate the image.  I try to
create a new image based upon the original and draw it using the
canvas object:

// mRotation = some value between 15 and 345
Matrix m = new Matrix();
m.setRotate(mRotation, (float)(mBitmap.getWidth()/2), (float)
(mBitmap.getHeight()/2));
Bitmap b = Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(),
mBitmap.getHeight(), m, true);
c.drawBitmap(b,0,0,p);

The issue is the image quality seems to degrade greatly in the rotated
images, and its really tough to get the image to rotate in place
despite the image being square and me specifying the center as the
pivot point.  I am sure this is just me not knowing what I am doing
but any help anyone could offer would be appreciated.

I did go through several tutorials online but they all seem to end up
putting the image in a stationary imageview / layout and are not using
the canvas to draw the resulting bitmap.  The image itself is nothing
fancy, and only a couple colors.  Maybe this is not the right approach
at all?  I realize its not the most efficient approach but my
application is not exactly giving the CPU a work out and drawing the
bitmap using the canvas inside the onDraw works well with the rest of
my application architecture.

Thanks in advance to anyone who has some advice for me.

Regards!

-- 
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: Virtual keypad is hiding data elements of the screen.

2010-11-23 Thread authorwjf
Add:

android:windowSoftInputMode=adjustResize

to your manifest for each activity that is giving you problems.

-- 
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: New ADT available.

2010-10-13 Thread authorwjf
My conclusion is that 0.9.9 is not ready for prime time; I recommend
everyone to avoid it.

Well said, String.  I second that.  Short of re-installing I found no
way to get the environment operational after the update.  Though at
least I am up and running again.

-- 
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: New ADT available.

2010-10-06 Thread authorwjf
I too have ran into this same issue.  I literally selected update from
the Eclipse (3.5.1) menu and allowed the IDE to download and install
the ADT 0.9.9 update and poof my development environment was FUBAR.  I
appreciate the work that goes into patches and updates but all of that
takes a back seat when the installation process itself breaks the
user's environment.

As I suggested in my note to the author most of us supporting this
platform are busy developers with more going on than just Android.  I
can't afford to lose a day because the installer for a minor update
blew up my development environment.  Its just not acceptable and
neither is the answer reinstall your dev environment, though that is
what I've ultimately had to do.

I'm really impressed with how far Android has come in such a short
time.  Both the OS and the development tools.  But I have to say its
times like this that I can appreciate Apple and Microsoft's model
(shudder).  Not that they don't ever break things with releases, we
all do.  But when something goes wrong using Visual Studio for example
there is a very defined process for getting a resolution.

It seems to me someone at Google should have tried to duplicate this
issue and posted the status of that testing and hopefully provided the
community a work around.  Even if that work around is to pull the ADT
update until a fix is in place to prevent other users from
accidentally rendering their environment inoperable.  Everyone who is
reporting the problem seems to have the same set up.  The key seems to
be users who went from 0.9.7 to 0.9.9 without installing 0.9.8.

Can we get some feedback from Google as to whether this testing has
been done yet and whether the testing yielded the same results?  And
how those of us who are at 0.9.7 on a machine update to 0.9.9 without
doing a complete reinstall?  Any help is appreciated.  I hate to think
I will have to reinstall the dev environment on my other two
machines.  Or I guess I could just not update the ADT on them.  But I
suspect following that route, I'll just compound the issue when there
is an ADT update I really can't live without.

Anybody got any thoughts?  Thanks!

-- 
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: Using Eclipse - can it get faster?

2010-09-20 Thread authorwjf
Have you tried increasing some of the memory allocations for Eclipse
up front in your ini file?  It maybe sounds counter intuitive but
giving Eclipse a little more memory will save some of the disk
swapping and I/O is where the real slow down is for any desktop
application in my experience.


Basic memory management configuration

-Xms512m  -- minimum memory size for pile and heap
-Xmx1024m -- maximum memory size for pile and heap
-XX:MaxPermSize=512m -- maximum memory size for storing permanent JVM
objects. Read more about this statement on the Eclipse website.

-- 
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: Debugging on a real device

2010-09-17 Thread authorwjf
John,

Don't fret this is a very common issue using Motrola's droid USB
driver under Windows.  It doesn't seem there are any plans to fix it.
In this thread I step someone through manually helping Windows along.
It suspect it will get you up and running.

http://groups.google.com/group/android-developers/browse_thread/thread/3571170253b99d0/92c8a626e08e2574?lnk=gstq=authorwjf#92c8a626e08e2574

-- 
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: Droid 2 ADB Issue

2010-09-01 Thread authorwjf
http://groups.google.com/group/android-developers/browse_thread/thread/3571170253b99d0/92c8a626e08e2574


On Aug 30, 1:11 pm, Jon Cook j...@jonsinfinity.com wrote:
 Has anyone had any problems with you're Droid 2 to ADB? Things were
 great on the Droid 1. I updated all of the Motorola drivers and so
 forth but no luck with ADB. Any thoughts?

-- 
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: Developing Android REST Client Applications

2010-09-01 Thread authorwjf
In its most basic format, calling a rest service is simply doing an
HTTP call.  For example:


public void callSomeApi() throws Exception
{
DefaultHttpClient httpclient = new DefaultHttpClient();

httpclient.getCredentialsProvider().setCredentials(
new AuthScope(api.service.domain.com, 443),
new UsernamePasswordCredentials(username,
password));

HttpGet httpget = new HttpGet(https://api.service.domain.com/
rest/entry_point);

ResponseHandlerString responseHandler = new
BasicResponseHandler();
String responseBody = httpclient.execute(httpget,
responseHandler);

//REST APIs typically return JSON or XML
JSONArray response = new JSONArray(responseBody);

int items = response.length();

ListView list = new ListView(this);

for (int i = 0; i  items; i++) {
ListItem item = new ListItem();
item.label =
response.getJSONObject(0).getString(item_you_were_looking_for);


}

httpclient.getConnectionManager().shutdown();

}

 This is a pretty bare-bones HTTP example, and if suffers from two
problems.  The first is it's not very robust.
 This you can get around if you are semi-competent by adding error
handling and whatever else.  The second,
 is that on the android platform these sorts of long running I/O
operations need to happen on their own thread.
 That's fine and dandy so long as nothing interrupts the thread, like
an orientation change or an incoming call,
 but we all know that is exactly what happens on a phone.

 For me a workable solution was to create a service in the start up
activity of my application.  So when someone
 starts my app, the onCreate method first starts the backgroundIO
service, and then starts the first
 UI activity.

   /**
 * This is the standard Android on create method that gets called
when the activity initialized.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Start up background I/O service
Intent svc = new Intent(this, BackGroundIO.class);
startService(svc);
//Start up first UI
Intent i = new Intent(this, MyFirstUI.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivityForResult(i, 1);
}

 So now the question is what is BackGroundIO, and how does it interact
with the UI?  In my case the background i/o
 class was simply a serialized request queue with static members for
adding / getting requests.  In other words the class
 had a couple members for adding requests, retrieving them, and
clearing any pending I/O.

 public class BackGroundIO extends Service{

private static Thread mWorker = null;

public static long addToQue(ApiRequest request) {
//mechanism for adding requests
//ApiRequest is some custom class that defines all the
elements you need to make your api calls
//Probably username, password, entrypoint, and a UI runnable
or handler for signaling on completion
//return a unique request identifier to the UI
}

public static ApiRequestResult getResult(long identifier) throws
RequestNotFoundException, RequestStillPendingException {
//mechanism for returning a result from memory or file
//return the ApiRequestResult for some unique identifier if
found
//if it came from disk don't forget to delete it from the file
}

public static void clearQue() {
//mechanism for clearing any and pending requests
//usually called on shutdown
}

@Override
public IBinder onBind(Intent arg0) {
// Not using IPC so just return empty
return null;
}

@Override
public void onCreate() {
super.onCreate();
mWorker = new Thread() {
public void run() {
while (true) { //this is my main looper
//Is there a pending request?
//Yes
// 1 CallSomeApi function shown above.
// 2 Remove the request from the queue of
pending requests
// Is the UI Activity who made this request
still around?
// YES
//   1 Signal the UI the result is ready
// NO
//   1 Save the result to disk and let a UI
retrieve it later when he wants / can.
//No
//Sleep for a short bit
}
};
mWorker.start();
}
}
}

As you can see this is again overly simplified and I'm typing it in a
text editor so there may be a syntax issue
here and there as well.  But hopefully you get the idea and this helps
you 

[android-developers] Re: How to make the eclipse to recognize my mobile phone?

2010-08-26 Thread authorwjf
See this thread.

http://groups.google.com/group/android-developers/browse_thread/thread/3571170253b99d0/cf5ff7cdbec6e42d?lnk=gstq=authorwjf#cf5ff7cdbec6e42d

Might help.

On Aug 26, 7:31 am, Lidia G lidyp...@yahoo.com wrote:
 Hello guys,

 I am testing my android application and i want to run from eclipse using as 
 external device Android phone. I know that it is possible to connect a mobile 
 to PC by cable and that's all, the eclipse identifies the external device 
 (the phone) as one of open emulators.
 But, it is not working now?
 How to make the eclipse to recognize my mobile phone?

 I would appreciate any advice.
 Lidy

-- 
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: connected Motorola Droid not recognized by adb

2010-08-19 Thread authorwjf
Like you I had similar problems getting my Motroloa DROID to show up
as a device in Android Device Chooser dialog under Eclipse. I am
running the 32-bit version of Windows 7. I found a number of forums
that tried to address this issue, but no one seemed exactly sure what
was happening, and a number of the sites suggested re-installing
Windows.

It just so happens that prior to doing Android development I wrote
device drivers for Windows. So I am at a bit of an advantage here. USB
drivers can be touchy, but you shouldn't have to re-install your OS
and the idea of a driver boost app from a third party makes me
shudder. More than likely what is happening is the OS has associated
your DROID with the generic driver that comes with the Windows Android
SDK.

You can verify this by bringing up the Windows Device Manager. If in
your root node you see, ANDROID PHONE instead of ADB INTERFACE, this
post should solve your problem. Obviously, if you have not already
gone out to the Motorola website and downloaded the 32 or 64 bit
drivers for the DROID, this needs to be your first step.

After you run the MSI you downloaded from Motorola, reboot your
machine, bring up your old friend the device manager again, and
reconnect your DROID. As mentioned in other posts on this thread, you
need to have the USB debugging turned on from the DROID's application
menu.

Expand the ANDROID PHONE node, right click, and choose UPDATE DRIVER
SOFTWARE. You will be presented with two options, the one you want is
BROWSE MY COMPUTER FOR DRIVER SOFTWARE. When the next dialog comes up,
select LET ME PICK FROM A LIST OF DEVICE DRIVERS ON MY COMPUTER.

As long as you have the SHOW COMPATIBLE HARDWARE box checked, you
should see a couple options. Ideally, you are looking for MOT
COMPOSITE ADB INTERFACE. However, in some cases only ANDROID COMPOSITE
ADB INTERFACE shows up. This *should* work as well. The one thing you
don't want is the generic ANDROID ADB INTERFACE, which seems to be the
default (thus the problem to begin with).

Click NEXT and the driver will install. Its possible at this point (in
fact likely), Windows will force you to do a reboot. Once that is
complete you should be good to go. Hope this was helpful!

-- 
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] keyboard textfield selected color

2010-06-15 Thread authorwjf
Howdy,

I am sure there is an easy answer for this but I've yet to find it.
Our application requires us to change out a number of the system 9.png
images (okay, actually our marketing dept is requiring as I'm fine
with the orange).  Anyhow, I've been successful in getting most
buttons to change by modifying a local copy of the 9.png images that
ship with the sdk and creating new selectors.  I've got edittext
boxes, radio buttons, etc. all using our color scheme for
highlighting.

The issue I can't seem to find a solution for is the edit box that
comes up when the phone is in landscape orientation and the user taps
an editable field that results in the softkeyboard displaying.  There
is an image in the sdk resources called keyboard_textfield_selected.
9.png, which I am sure I need to pull into my local drawables and
modify.  The problem is, I don't know how to specify to the
softkeyboard to use this image.

I assume its just a selector, but how do I point the keyboard to it?
Maybe through some clever usage of IME for the original textbox that
invokes the softkeyboard?  Anybody out there have any ideas?

Thanks!

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