[android-beginners] Questions for the group regarding URL Launchers

2010-06-24 Thread AfMob
I have long had my WAP pages built and had my URL launchers built by
an outsourced group in India. I now have a requirement to update
my .apk files to 2.2 as well as build 6 additional .apk files that are
made up of 6 completely different URL launchers to other WAP sites. I
have successfully set up my Java and SDK environment

My questions are:
   -  What is the best recommendation the group can suggest as a
starting point?
   -  How do I open the .apk file in my eclipse environment to make
the changes necessary?

The Android Market says the following when I attempt to upload my .apk
file:
[quote]
Market does not accept apks signed with the debug certificate. Create
a new certificate that is valid for at least 50 years.
Market requires that the certificate used to sign the apk be valid
until at least October 22, 2033. Create a new certificate.
Market requires the minSdkVersion to be set to a positive 32-bit
integer in AndroidManifest.xml.
[/quote]

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] problem with httpclient and self signed certificates

2010-06-24 Thread Mikey
Just an off the top of my head, but do you have a self-signed certificate?

BTW, I got your first email - double posting really isn't necessary

On 24 Jun 2010, at 22:38, jackace wrote:

> Hi,
> 
> I am sure this has been discussed in this group, but I couldn't find
> that thread, so bear with it, or if possible merge it with the
> original.
> 
> I am using httpclient for my android app and I have a local site which
> has a few https pages. Since default httpclient doesnot allow self-
> signed certificates I am using  "EasySSLFactory" and
> "EasyX509TrustManager", which are mentioned in httpclient
> documentation.
> 
> 
> client = new DefaultHttpClient();
> client.getConnectionManager().getSchemeRegistry().register(new
> Scheme("https", new EasySSLSocketFactory(), 443));
> 
> 
> The problem is if I use this SSLFactory in my android app, I am
> getting correct response from my site's https pages, but I get "SSL
> handshake failure: I/O error during system call, Unknown error: 0" for
> sites such as "gmail.com", "ymail.com". If I don't use
> "EasySSLSocketFactory" I get response from these sites but get
> exception for my site.
> 
> The funny thing is that this page fetch code works fine as a
> standalone java application.
> 
> What could be the problem. Please help me with this.
> 
> Thanks and Regards
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> 
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
> 
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] problem with httpclient and self signed certificates

2010-06-24 Thread jackace
Hi,

I am sure this has been discussed in this group, but I couldn't find
that thread, so bear with it, or if possible merge it with the
original.

I am using httpclient for my android app and I have a local site which
has a few https pages. Since default httpclient doesnot allow self-
signed certificates I am using  "EasySSLFactory" and
"EasyX509TrustManager", which are mentioned in httpclient
documentation.


client = new DefaultHttpClient();
client.getConnectionManager().getSchemeRegistry().register(new
Scheme("https", new EasySSLSocketFactory(), 443));


The problem is if I use this SSLFactory in my android app, I am
getting correct response from my site's https pages, but I get "SSL
handshake failure: I/O error during system call, Unknown error: 0" for
sites such as "gmail.com", "ymail.com". If I don't use
"EasySSLSocketFactory" I get response from these sites but get
exception for my site.

The funny thing is that this page fetch code works fine as a
standalone java application.

What could be the problem. Please help me with this.

Thanks and Regards

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] problem with httpclient and self signed certificates

2010-06-24 Thread jackace
Hi,

I think this has been discussed earlier but I could find the thread so
posting new.

I am using httpclient for my android app and I have a local site which
has a few https pages. Since default httpclient doesnot allow self-
signed certificates I am using  "EasySSLFactory" and
"EasyX509TrustManager", which are mentioned in httpclient
documentation.


client = new DefaultHttpClient();
client.getConnectionManager().getSchemeRegistry().register(new
Scheme("https", new EasySSLSocketFactory(), 443));


The problem is if I use this SSLFactory in my android app, I am
getting correct response from my site's https pages, but I get "SSL
handshake failure: I/O error during system call, Unknown error: 0" for
sites such as "gmail.com", "ymail.com". If I don't use
"EasySSLSocketFactory" I get response from these sites but get
exception for my site.

The funny thing is that this page fetch code works fine as a
standalone java application.

What could be the problem. Please help me with this.

Thanks and Regards
Deepak Garg

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Adding a button which opens another screen

2010-06-24 Thread Justin Anderson
When you click the button, launch a new activity with startActivity().  That
method takes an Intent through which you can pass data to the activity you
are calling.

When you do it this way, pressing the back button automatically has the
effect you want by virtue of how the Android OS works.

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Thu, Jun 24, 2010 at 10:04 AM, Justin  wrote:

> I have written a app, and I have pictures which are stored in the /
> drawable directory.  My app makes a sliding gallery across the top,
> (id gallery1) and as you select the picture in the gallery it load
> the
> picture bigger underneath, (id image1). These a layed out in a XML
> file.  There is a button below the image (image1) which is called (id
> mybutton).
> I want it when a image comes up, when the button is pressed it loads
> the same image on a XML layout file, in which the picture is full
> screen, the ID of the XML file image is (id bigpic), and then from
> there to beable to press the back button to go back to the gallery
> screen.  Can anyone help?
>
>
> My Whole Code is:
>
>
>
> ***­
> **
> public class PicViews extends Activity
> {
>//---the images to display---
>Integer[] imageIDs = {
>R.drawable.pic01,
>R.drawable.pic02,
>R.drawable.pic03,
>R.drawable.pic04,
>R.drawable.pic05
>
>
>};
>
>
>@Override
>public void onCreate(Bundle savedInstanceState)
>{
>super.onCreate(savedInstanceState);
>setContentView(R.layout.displayview);
>
>
>Gallery gallery = (Gallery) findViewById(R.id.gallery1);
>
>
>gallery.setAdapter(new ImageAdapter(this));
>gallery.setOnItemClickListener(new OnItemClickListener()
>{
> public void onItemClick(AdapterView parent,
>View v, int position, long id)
>{
>//---display the images selected---
>ImageView imageView = (ImageView)
> findViewById(R.id.image1);
>
>
> imageView.setImageResource(imageIDs[position]);
>}
>});
>}
>
>
>public class ImageAdapter extends BaseAdapter
>{
>private Context context;
>private int itemBackground;
>
>
>public ImageAdapter(Context c)
>{
>context = c;
>//---setting the style---
>TypedArray a =
> obtainStyledAttributes(R.styleable.Gallery1);
>itemBackground = a.getResourceId(
>R.styleable.Gallery1_android_galleryItemBackground,
> 0);
>a.recycle();
>}
>
>
>//---returns the number of images---
>public int getCount() {
>return imageIDs.length;
>}
>
>
>//---returns the ID of an item---
>public Object getItem(int position) {
>return position;
>}
>
>
>public long getItemId(int position) {
>return position;
>}
>
>
>//---returns an ImageView view---
>public View getView(int position, View convertView, ViewGroup
> parent) {
>ImageView imageView = new ImageView(context);
>imageView.setImageResource(imageIDs[position]);
>imageView.setScaleType(ImageView.ScaleType.FIT_XY);
>imageView.setLayoutParams(new Gallery.LayoutParams(150,
> 120));
>imageView.setBackgroundResource(itemBackground);
>return imageView;
>}
>}
>
>
>
> }
>
>
>
> ***­
> **
>
> The Section of code which pulls up the image and makes the bigger
> picture show is:
>
>
>
> ***­
> **
>  gallery.setOnItemClickListener(new OnItemClickListener()
>{
> public void onItemClick(AdapterView parent,
>View v, int position, long id)
>{
>//---display the images selected---
>ImageView imageView = (ImageView)
> findViewById(R.id.image1);
>
>
> imageView.setImageResource(imageIDs[position]);
>}
>});
>
> ***­
> ***
>
>
>
>
> Please help, I'm only learning.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscri

Re: [android-beginners] Re: Triggering an AppWidget Update

2010-06-24 Thread Mark Murphy
> Do you
> set an alarm to trigger even minute or would that also drain the
> battery?

Ideally, you let the user choose:

http://www.androidguys.com/2010/03/29/code-pollution-background-control/

> Do you trigger an update only when the screen is turned on?
> Can that even be detected?

There are ACTION_SCREEN_OFF and ACTION_SCREEN_ON broadcast Intents,
but it is simpler to just use a non-wakeup alarm with AlarmManager.

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

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Adding a button which opens another screen

2010-06-24 Thread Justin
I have written a app, and I have pictures which are stored in the /
drawable directory.  My app makes a sliding gallery across the top,
(id gallery1) and as you select the picture in the gallery it load
the
picture bigger underneath, (id image1). These a layed out in a XML
file.  There is a button below the image (image1) which is called (id
mybutton).
I want it when a image comes up, when the button is pressed it loads
the same image on a XML layout file, in which the picture is full
screen, the ID of the XML file image is (id bigpic), and then from
there to beable to press the back button to go back to the gallery
screen.  Can anyone help?


My Whole Code is:


***­
**
public class PicViews extends Activity
{
//---the images to display---
Integer[] imageIDs = {
R.drawable.pic01,
R.drawable.pic02,
R.drawable.pic03,
R.drawable.pic04,
R.drawable.pic05


};


@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.displayview);


Gallery gallery = (Gallery) findViewById(R.id.gallery1);


gallery.setAdapter(new ImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener()
{
 public void onItemClick(AdapterView parent,
View v, int position, long id)
{
//---display the images selected---
ImageView imageView = (ImageView)
findViewById(R.id.image1);


imageView.setImageResource(imageIDs[position]);
}
});
}


public class ImageAdapter extends BaseAdapter
{
private Context context;
private int itemBackground;


public ImageAdapter(Context c)
{
context = c;
//---setting the style---
TypedArray a =
obtainStyledAttributes(R.styleable.Gallery1);
itemBackground = a.getResourceId(
R.styleable.Gallery1_android_galleryItemBackground,
0);
a.recycle();
}


//---returns the number of images---
public int getCount() {
return imageIDs.length;
}


//---returns the ID of an item---
public Object getItem(int position) {
return position;
}


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


//---returns an ImageView view---
public View getView(int position, View convertView, ViewGroup
parent) {
ImageView imageView = new ImageView(context);
imageView.setImageResource(imageIDs[position]);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setLayoutParams(new Gallery.LayoutParams(150,
120));
imageView.setBackgroundResource(itemBackground);
return imageView;
}
}



}


***­
**

The Section of code which pulls up the image and makes the bigger
picture show is:


***­
**
 gallery.setOnItemClickListener(new OnItemClickListener()
{
 public void onItemClick(AdapterView parent,
View v, int position, long id)
{
//---display the images selected---
ImageView imageView = (ImageView)
findViewById(R.id.image1);


imageView.setImageResource(imageIDs[position]);
}
});
***­
***




Please help, I'm only learning.


-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Triggering an AppWidget Update

2010-06-24 Thread Kostya Vasilyev

Jake,

The 30 minute minimum intervals only applies to updates specified in the 
widget's XML file (updateTimeMillis).


You can have alarm-driven (or other event driven) updates as often as 
you like, so it's only a question of judgement with respect to battery life.


Android 2.x includes analog clocks that update once a minute, so it 
can't be that bad.


Avoiding updates when the screen is off is pretty easy - just use alarm 
options without the _WAKEUP (i.e. ELAPSED_REALTIME or RTC). If such 
alarm goes of while the phone is asleep, it will be delivered when the 
phone wakes up.


-- Kostya

24.06.2010 19:36, Jake Colman пишет:

But in the second example, would it be appropriate to update every
minute?  But Android 2.2 only allows an update every 30 minutes.  Do you
set an alarm to trigger even minute or would that also drain the
battery?  Do you trigger an update only when the screen is turned on?
Can that even be detected?

   



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: SOAP complex request

2010-06-24 Thread Justin Anderson
*> Any ideas?*
Apparently not...

*> Any help would be nice*
Yes it would.  It would also be nice to have some more pertinent
information.  Like exactly where the error occurs and the exact error
message you are getting.


--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Thu, Jun 24, 2010 at 8:39 AM, Milo  wrote:

> Any help would be nice
>
> On Jun 17, 4:32 pm, Milo  wrote:
> > any ideas?
> > On Jun 16, 9:44 pm, Milo  wrote:
> >
> >
> >
> > > I'm trying to consume the following service
> >
> > > 
> > > http://www.w3.org/2001/XMLSchema-instance";
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://
> > > schemas.xmlsoap.org/soap/envelope/">
> > >   
> > > http://tempuri.org/";>
> > >   string
> > >   
> > > string
> > > string
> > >   
> > > 
> > >   
> > > 
> >
> > > I've cobbled together the following.: ---
> >
> > > String rtn = "";
> > > SoapObject Request =  new
> SoapObject(NAME_SPACE, METHOD_NAME);
> > > PropertyInfo pi = new PropertyInfo();
> >
> > > String [] objectArray = { "string1", "string2",
> "string3",
> > > "string4"};
> >
> > > pi.setName("args");
> > > pi.setValue(objectArray);
> >
> > > Request.addProperty("procedure",
> "actionProcedure");
> > > Request.addProperty(pi);
> >
> > > SoapSerializationEnvelope soapEnvelope = new
> > > SoapSerializationEnvelope(SoapEnvelope.VER11);
> > > soapEnvelope.dotNet = true;
> > > soapEnvelope.setOutputSoapObject(Request);
> >
> > > AndroidHttpTransport aht = new
> AndroidHttpTransport(URL);
> > > try
> > > {
> > > aht.call(SOAP_ACTION, soapEnvelope);
> > > SoapObject resultString =
> (SoapObject)soapEnvelope.getResponse();
> >
> > > But I'm getting a "Cannot serialize" error...
> >
> > > Any ideas??? thanks...
> >
> > > Milo- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Triggering an AppWidget Update

2010-06-24 Thread Jake Colman
> "KV" == Kostya Vasilyev  writes:

   KV> Jake,

   KV> There are two issues here:

   KV> - Getting notifications when appointment data changes. If the appointment
   KV> database is your own, set up an intent to be fired whenever there is a
   KV> change. If you are using the built-in calendar, there is got to be a 
way, too
   KV> - I just don't have any pointers not having used this API.

   KV> - Time until next appointment changes with real wallclock time, so it 
would
   KV> have to be updated (every minute? every second?). This is a UI
   KV> design decision - do you think your users prefer to see time til
   KV> next appointment with 1-second accuracy, at the expense of
   KV> possibly poor battery life, or would they be happy with 1-minute
   KV> resolution, or perhaps just time of next appointment, updated a
   KV> few times a day?

Kostya,

This is actually a theoretical discussion since I'm trying to understand
how this type of problem, as opposed to this actual problem, can be
solved.

If the data to be updated is fixed, then it sounds like you would want
an intent to be fired when the data changes.  So in my first example,
the problem can be solved by firing an intent when the appointment time
has passed so that you get the time of the next appointment or forcing
an update when the a new appointment is added.

But in the second example, would it be appropriate to update every
minute?  But Android 2.2 only allows an update every 30 minutes.  Do you
set an alarm to trigger even minute or would that also drain the
battery?  Do you trigger an update only when the screen is turned on?
Can that even be detected?

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Triggering an AppWidget Update

2010-06-24 Thread Kostya Vasilyev

Jake,

There are two issues here:

- Getting notifications when appointment data changes. If the 
appointment database is your own, set up an intent to be fired whenever 
there is a change. If you are using the built-in calendar, there is got 
to be a way, too - I just don't have any pointers not having used this API.


- Time until next appointment changes with real wallclock time, so it 
would have to be updated (every minute? every second?). This is a UI 
design decision - do you think your users prefer to see time til next 
appointment with 1-second accuracy, at the expense of possibly poor 
battery life, or would they be happy with 1-minute resolution, or 
perhaps just time of next appointment, updated a few times a day?


-- Kostya

24.06.2010 19:11, Jake Colman пишет:

But let's say the appwidget displays the amount of time remaining until
the next appointment.  Since that data changes all the time, how does
one structure the widget update in that instance?
   



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Triggering an AppWidget Update

2010-06-24 Thread Jake Colman
> "MM" == Mark Murphy  writes:

   MM> On Thu, Jun 24, 2010 at 10:31 AM, Jake Colman  wrote:
   >> For this widget to work it must be regularly checking the time and
   >> the calendar since at any minute it might be time to display the
   >> next appointment.  Does this mean I have to update the widget's
   >> display every minute?  Clearly not, but how else?

   MM> Update the display when the data changes. That will occur at the
   MM> earlier of:

   MM> -- when the time for the previous event passed, so you would need to
   MM> show the next event
   MM> -- when the Google Calendar GData APIs tell you there is a new event
   MM> that is earlier than the one you are presently showing

   >> But do we only
   >> update if the screen is active?

   MM> Ideally, no, you update when the data changes.

Mark and Kostya,

Thanks for your (amazingly quick) replies.

So I guess the best approach would be to set an alarm to trigger at the
time of the next appointment so that I wake up and get the next time to
display.  That makes sense and limits the number of times that I wake up
to do an update.

But let's say the appwidget displays the amount of time remaining until
the next appointment.  Since that data changes all the time, how does
one structure the widget update in that instance?

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Triggering an AppWidget Update

2010-06-24 Thread Mark Murphy
On Thu, Jun 24, 2010 at 10:31 AM, Jake Colman  wrote:
> For this widget to work it must be regularly checking the time and the
> calendar since at any minute it might be time to display the next
> appointment.  Does this mean I have to update the widget's display every
> minute?  Clearly not, but how else?

Update the display when the data changes. That will occur at the earlier of:

-- when the time for the previous event passed, so you would need to
show the next event
-- when the Google Calendar GData APIs tell you there is a new event
that is earlier than the one you are presently showing

> But do we only
> update if the screen is active?

Ideally, no, you update when the data changes.

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

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Triggering an AppWidget Update

2010-06-24 Thread Kostya Vasilyev

Jake,

There are two scenarios involved:

1. Android calls the widget provider's onUpdate() - when the widget is 
first shown and then regularly at updatePeriodMillis intervals, if 
specified. Note that automatic updates based on updatePeriodMillis are 
limited to once every 30 minutes since Android 2.x.


2. You are free to update your widgets any time, by doing something like 
this:


ComponentName thisWidget = new ComponentName(context, 
MyWidgetProvider.class);

AppWidgetManager manager = AppWidgetManager.getInstance(context);

RemoteViews updateViews = .. specify new widget state here ..

manager.updateAppWidget(thisWidget, updateViews);

For your calendar example, obviously the second scenario has to be involved.

As for performing updates when necessary (and only then), your code 
needs to contain some logic to figure out the appropriate time for the 
next update (based on actual calendar events and how much in advance 
they are supposed to be displayed). Then set an alarm using AlarmManager 
to update the widget.


Note that AlarmManager does not have to be used in a service, although 
sample code typically does. An alarm simply fires off a PendingIntent. 
This intent can be specific to your code, triggering a widget update 
just in time to for next scheduled calendar event.


A good place to receive this special intent is in your AppWidgetProvider 
- since it's a BroadcastReceiver anyway.


Hope this helps.

-- Kostya

24.06.2010 18:31, Jake Colman пишет:

I have some questions about the correct approach for updating an
AppWidget's display.

Since this is a beginners forum, please let me state what I already do
know:

1) I can use android::updatePeriodMillis to specify the update
interval.  When this interval has elapsed the phone is woken up.
Intervals of less than one hour are not a good idea.

2) Updates can be triggered by an alarm that will not actually wake up
the phone.

What I'm confused about is how/why/when to trigger an update.

Let's say I am creating an AppWidget that will display the time of my
next appointment.  The widget needs to know the current time and the
time of my next appointment.  When the current time is after the current
appointment the widget has to display the time of the next appointment.

For this widget to work it must be regularly checking the time and the
calendar since at any minute it might be time to display the next
appointment.  Does this mean I have to update the widget's display every
minute?  Clearly not, but how else?  In actuality, I only really need to
update the display if the user is looking at the screen.  But do we only
update if the screen is active?  If so, what about if that update is a
time-consuming process?  The UI would then appear non-responsive.

So what the is correct approach for this kind of problem?

Thanks!

   



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: SOAP complex request

2010-06-24 Thread Milo
Any help would be nice

On Jun 17, 4:32 pm, Milo  wrote:
> any ideas?
> On Jun 16, 9:44 pm, Milo  wrote:
>
>
>
> > I'm trying to consume the following service
>
> > 
> > http://www.w3.org/2001/XMLSchema-instance";
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://
> > schemas.xmlsoap.org/soap/envelope/">
> >   
> >     http://tempuri.org/";>
> >       string
> >       
> >         string
> >         string
> >       
> >     
> >   
> > 
>
> > I've cobbled together the following.: ---
>
> > String rtn = "";
> >                         SoapObject Request =  new SoapObject(NAME_SPACE, 
> > METHOD_NAME);
> >                         PropertyInfo pi = new PropertyInfo();
>
> >                         String [] objectArray = { "string1", "string2", 
> > "string3",
> > "string4"};
>
> >                         pi.setName("args");
> >                         pi.setValue(objectArray);
>
> >                         Request.addProperty("procedure", "actionProcedure");
> >                         Request.addProperty(pi);
>
> >                         SoapSerializationEnvelope soapEnvelope = new
> > SoapSerializationEnvelope(SoapEnvelope.VER11);
> >                         soapEnvelope.dotNet = true;
> >                         soapEnvelope.setOutputSoapObject(Request);
>
> >                         AndroidHttpTransport aht = new 
> > AndroidHttpTransport(URL);
> >                         try
> >                         {
> >                                 aht.call(SOAP_ACTION, soapEnvelope);
> >                                 SoapObject resultString = 
> > (SoapObject)soapEnvelope.getResponse();
>
> > But I'm getting a "Cannot serialize" error...
>
> > Any ideas??? thanks...
>
> > Milo- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: SOAP complex request

2010-06-24 Thread Milo
Any ideas?

On Jun 17, 4:32 pm, Milo  wrote:
> any ideas?
> On Jun 16, 9:44 pm, Milo  wrote:
>
>
>
> > I'm trying to consume the following service
>
> > 
> > http://www.w3.org/2001/XMLSchema-instance";
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://
> > schemas.xmlsoap.org/soap/envelope/">
> >   
> >     http://tempuri.org/";>
> >       string
> >       
> >         string
> >         string
> >       
> >     
> >   
> > 
>
> > I've cobbled together the following.: ---
>
> > String rtn = "";
> >                         SoapObject Request =  new SoapObject(NAME_SPACE, 
> > METHOD_NAME);
> >                         PropertyInfo pi = new PropertyInfo();
>
> >                         String [] objectArray = { "string1", "string2", 
> > "string3",
> > "string4"};
>
> >                         pi.setName("args");
> >                         pi.setValue(objectArray);
>
> >                         Request.addProperty("procedure", "actionProcedure");
> >                         Request.addProperty(pi);
>
> >                         SoapSerializationEnvelope soapEnvelope = new
> > SoapSerializationEnvelope(SoapEnvelope.VER11);
> >                         soapEnvelope.dotNet = true;
> >                         soapEnvelope.setOutputSoapObject(Request);
>
> >                         AndroidHttpTransport aht = new 
> > AndroidHttpTransport(URL);
> >                         try
> >                         {
> >                                 aht.call(SOAP_ACTION, soapEnvelope);
> >                                 SoapObject resultString = 
> > (SoapObject)soapEnvelope.getResponse();
>
> > But I'm getting a "Cannot serialize" error...
>
> > Any ideas??? thanks...
>
> > Milo- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Approach to learning android

2010-06-24 Thread Maxood
All you need is to concentrate on Java programming. There are lot of
good book available in the market to learn Java. One of them is Ivor
Horton's book on wrox (http://www.wrox.com). Another one is Java -How
to program by Deitel & Deitel (http://www.deitel.com/).

Also get hold of Mark Murphy's book: http://www.commonsware.com/

On Jun 21, 3:10 pm, Justin Anderson  wrote:
> That is because both Java and C++ are object oriented...  I would think your
> first step would be to do a quick Google search and learn some Java basics.
> You don't need to learn anything related to Java GUI components because
> Android doesn't use those but most everything else would be good knowlege
>
> --
> There are only 10 types of people in the world...
> Those who know binary and those who don't.
> --
>
>
>
> On Mon, Jun 21, 2010 at 4:03 PM, Keith Roberts  wrote:
> > ok that helps!  i think my biggest issue was with understanding the
> > small syntax things that are different from other languages.
> > conceptually it seems very similar to c++.
>
> > thanks
>
> > On Jun 21, 5:56 pm, Temitope Akinwande  wrote:
> > > I am not sure how you can do that as Android is based on Java and not
> > > JavaScript.
> > > If you already have some c++ experience, the switch to Java should not
> > > be too difficult.
>
> > > You could buy some books or you could check out this linkhttp://
> >www.javabeginner.com/learn-java/introduction-to-java-programming
> > > Most of the topics won't be necessary for Android development but they
> > > are good to know as a Java programmer.
>
> > > -Tope
>
> > > On Mon, Jun 21, 2010 at 2:51 PM, Keith Roberts 
> > wrote:
> > > > I'm not familiar with javascript but I do have a strong background in
> > > > fortran and some c++, so im not completely new to the programming
> > > > world.  However,  I would like to know a good tutorial to understand
> > > > the javascript used on the android platform besides the one that's on
> > > > the sdk site?  I find those tutorials a little too much for a
> > > > beginner.  Or better yet, what do you think would be the best way to
> > > > learn android if you have no experience in javascript?
>
> > > > Thanks,
>
> > > > keith
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Beginners" group.
>
> > > > NEW! Try asking and tagging your question on Stack Overflow at
> > > >http://stackoverflow.com/questions/tagged/android
>
> > > > To unsubscribe from this group, send email to
> > > > android-beginners+unsubscr...@googlegroups.com > > >  i...@googlegroups.com>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-beginners?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow at
> >http://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com > i...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Triggering an AppWidget Update

2010-06-24 Thread Jake Colman

I have some questions about the correct approach for updating an
AppWidget's display.

Since this is a beginners forum, please let me state what I already do
know:

1) I can use android::updatePeriodMillis to specify the update
   interval.  When this interval has elapsed the phone is woken up.
   Intervals of less than one hour are not a good idea.

2) Updates can be triggered by an alarm that will not actually wake up
   the phone.

What I'm confused about is how/why/when to trigger an update.

Let's say I am creating an AppWidget that will display the time of my
next appointment.  The widget needs to know the current time and the
time of my next appointment.  When the current time is after the current
appointment the widget has to display the time of the next appointment.

For this widget to work it must be regularly checking the time and the
calendar since at any minute it might be time to display the next
appointment.  Does this mean I have to update the widget's display every
minute?  Clearly not, but how else?  In actuality, I only really need to
update the display if the user is looking at the screen.  But do we only
update if the screen is active?  If so, what about if that update is a
time-consuming process?  The UI would then appear non-responsive.

So what the is correct approach for this kind of problem?

Thanks!

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Saving Pictures from /drawable in a app to SD Card

2010-06-24 Thread Justin
I kind of confussed and hope one of you nice people will help me.

I have written a app, and I have pictures which are stored in the /
drawable directory.  My app makes a sliding gallery across the top,
(id gallery1) and as you select the picture in the gallery it load the
picture bigger underneath, (id image1). These a layed out in a XML
file.  What I would like to do is be able to is when the image1 is
pressed it gives the option to save the picture on the SD Card.

My Whole Code is:

*
public class PicViews extends Activity
{
//---the images to display---
Integer[] imageIDs = {
R.drawable.pic01,
R.drawable.pic02,
R.drawable.pic03,
R.drawable.pic04,
R.drawable.pic05


};

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.displayview);

Gallery gallery = (Gallery) findViewById(R.id.gallery1);

gallery.setAdapter(new ImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener()
{
 public void onItemClick(AdapterView parent,
View v, int position, long id)
{
//---display the images selected---
ImageView imageView = (ImageView)
findViewById(R.id.image1);
 
imageView.setImageResource(imageIDs[position]);
}
});
}

public class ImageAdapter extends BaseAdapter
{
private Context context;
private int itemBackground;

public ImageAdapter(Context c)
{
context = c;
//---setting the style---
TypedArray a =
obtainStyledAttributes(R.styleable.Gallery1);
itemBackground = a.getResourceId(
R.styleable.Gallery1_android_galleryItemBackground,
0);
a.recycle();
}

//---returns the number of images---
public int getCount() {
return imageIDs.length;
}

//---returns the ID of an item---
public Object getItem(int position) {
return position;
}

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

//---returns an ImageView view---
public View getView(int position, View convertView, ViewGroup
parent) {
ImageView imageView = new ImageView(context);
imageView.setImageResource(imageIDs[position]);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setLayoutParams(new Gallery.LayoutParams(150,
120));
imageView.setBackgroundResource(itemBackground);
return imageView;
}
}
}


*

The Section of code which pulls up the image and makes the bigger
picture show is:

*
 gallery.setOnItemClickListener(new OnItemClickListener()
{
 public void onItemClick(AdapterView parent,
View v, int position, long id)
{
//---display the images selected---
ImageView imageView = (ImageView)
findViewById(R.id.image1);
 
imageView.setImageResource(imageIDs[position]);
}
});
**

Its at this point I want to be able to have a option to save the
picture either by pressing a button or ideally pressing the picture
which will bring up options.

Also what alterations in the manifest do I need to make to be able to
access the SD Card Storage?

Please help, I'm only learning.



-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: onHandleIntent(Intent) method does not get called

2010-06-24 Thread Kostya Vasilyev

24.06.2010 10:49, appsgrrl пишет:

Hi -- Okay, I got further!  Yay!  It turns out that I also had to call
super.onCreate()  to avoid the null pointer exception.
So, if I call super.onCreate() and super.onStartCommand(),  my
onHandleIntent() does get excecuted.
   


Great. Both superclass methods need to get called - onCreate() set up a 
worker thread, and onStartCommand() queues the intent to this thread, 
which ultimately calls your onHandleIntent()

Now, my new mystery is why my service gets an onDestroy() call right
after it is started.
I return START_STICKY from onStartCommand, but that does not seem to
have an effect.
I guess I need to understand the life cycle stuff a little more.
   


This is intended behaviour. The service is stopped when the last queued 
intent has been processed by your subclass's onHandleIntent().


--

Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en