[android-beginners] What is a toast?

2009-11-10 Thread pushkar bandi
Hi,

Could somebody give me some detailed information about toast?

I got a comment saying that This is called a toast and cannot be
dismissed by the user. Toasts are dismissed automatically after a fixed
period of time.

Then why the period of time for a toast is more, which degrades the user
experience.

Thanks

Regards
Pushkar Setty

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] What is a toast?

2009-11-10 Thread Marton Kodok
Think of Toast like a subtitle in movies.
It's a simple text that shows for X seconds.
It has no buttons, it's like a bubble that tells you something happened,
then vanishes out.

If you setup a long period for a toast, that will be visible too long and
will degrade the user experience, as in movies if you have a subtitle on
screen for a long time, longer then the speech, you dislike it.

http://www.androidx.org/wp-content/uploads/2009/10/android-toast-usage-03.png

2009/11/10 pushkar bandi pushkarse...@gmail.com

 Hi,

 Could somebody give me some detailed information about toast?

 I got a comment saying that This is called a toast and cannot be
 dismissed by the user. Toasts are dismissed automatically after a fixed
 period of time.

 Then why the period of time for a toast is more, which degrades the user
 experience.

 Thanks

 Regards
 Pushkar Setty

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en




-- 
Márton

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] What is a toast?

2009-11-10 Thread Sean Hodges
From the dev guide
(http://developer.android.com/reference/android/widget/Toast.html):

A toast is a view containing a quick little message for the user. The
toast class helps you create and show those.
When the view is shown to the user, appears as a floating view over
the application. It will never receive focus. The user will probably
be in the middle of typing something else. The idea is to be as
unobtrusive as possible, while still showing the user the information
you want them to see. Two examples are the volume control, and the
brief message saying that your settings have been saved.

Think of it like the transient notification pop-ups you get in Pidgin
or MSN messenger. It appears for a pre-determined amount of time, at a
position specified by the developer. It differs from a pop-up dialog
because you can continue to interact with the UI whilst it is being
displayed, and you are not expected to act on it.

The period of time for a toast is customisable, you want to use the
setDuration() method to change it:
http://developer.android.com/reference/android/widget/Toast.html#setDuration(int).


On Tue, Nov 10, 2009 at 11:25 AM, pushkar bandi pushkarse...@gmail.com wrote:
 Hi,

 Could somebody give me some detailed information about toast?

 I got a comment saying that This is called a toast and cannot be
 dismissed by the user. Toasts are dismissed automatically after a fixed
 period of time.

 Then why the period of time for a toast is more, which degrades the user
 experience.

 Thanks

 Regards
 Pushkar Setty

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to android-beginners@googlegroups.com
 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.
To post to this group, send email to android-beginners@googlegroups.com
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] Help with creating a sport scoring application

2009-11-10 Thread Sam
Hi community

I am new to programming...i have this idea of creating a sport scoring
app
but i have no idea how to do the coding
i knw some basic concepts of object oriented programming
but i want to knw how to layout the structure of the programming
if anyone wants to join me (can share the rights) or help me out in
this project you will be most welcome

i have a solid business plan for this app...

the basic idea of the app is as follows

in any sportat any given event has finite set of outcomes
so the interface is an intuitive interface to score and keep
statistics...
usually sport scoring applications are very very clumsy with all the
options on one screen

in this...v start from idle postion ...lets say in cricket t idle
position is the bowler bowling the ball
once the bowler bowls ...there are finite outcomes
...the screen shows only those options required at THAT point of
time...the next screens depend on the option u chooseif you choose
out...the next screen will ask u how he was out
if its a run...then next options wil be how many ...next will be wich
area...n so on

i believe the app needs strong database and data counters its all
confusing for me
but i am very clear abt the requirements for the app
plz contact me if any one is interested

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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: play video encounter PV SW DECODER IS USED FOR MPEG4

2009-11-10 Thread lei
I am using the Android SDK 1.6.

On Nov 10, 6:18 pm, lei eirst...@gmail.com wrote:
 I wrote a media player for playing video, but it encounter an error of
 PV SW DECODER IS USED FOR MPEG4 when I try to play back a 3gp format
 video, anyone knows what is it? How to solve this problem? I paste my
 code below:

 package com.test;

 import android.app.Activity;
 import android.content.Intent;
 import android.content.res.AssetFileDescriptor;
 import android.media.AudioManager;
 import android.media.MediaPlayer;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;

 public class MediaVideoTest extends Activity implements
 MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,SurfaceHold 
 er.Callback
 {

         private static final String TAG = MediaVideoTest;
         private MediaPlayer player;
         private SurfaceHolder holder;
         private SurfaceView surfaceView;
         private int mWidth,mHeight;

         @Override
         protected void onCreate(Bundle savedInstanceState) {

                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.video_view);
                 surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
                 holder = surfaceView.getHolder();
         holder.addCallback(this);
         holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

         }

         private void playVideo() {

                 try {
                         AssetFileDescriptor asd = 
 getResources().openRawResourceFd
 (R.raw.chainsaw);

                         //create media player
                         player = new MediaPlayer();
                         
 player.setDataSource(asd.getFileDescriptor(),asd.getStartOffset
 (),asd.getLength());
                         player.setDisplay(holder);
                         player.prepare();
                         player.setOnPreparedListener(this);
                         player.setOnCompletionListener(this);
             player.setAudioStreamType(AudioManager.STREAM_MUSIC);

                 } catch (Exception e) {
             Log.e(TAG, error:  + e.getMessage(), e);
                 }
         }

         @Override
         public void onPrepared(MediaPlayer mp) {
         Log.d(TAG, onPrepared called);
                 mWidth = player.getVideoWidth();
                 mHeight = player.getVideoHeight();
                 Log.d(TAG, width :  + mWidth +  height :  + mHeight);

                 if(mWidth != 0  mHeight != 0){
                         holder.setFixedSize(mWidth, mHeight);
                         player.start();
                 }
         }

         @Override
         public void surfaceChanged(SurfaceHolder holder, int format, int
 width,int height) {
         Log.d(TAG, surfaceChanged width :  + width +  height :  +
 height);
         }

         @Override
         public void surfaceCreated(SurfaceHolder holder) {
         Log.d(TAG, surfaceCreated() is called);
                 playVideo();
         }

         @Override
         public void surfaceDestroyed(SurfaceHolder holder) {
         Log.d(TAG, surfaceDestroy() is called);
         }

         @Override
         protected void onDestroy() {
                 super.onDestroy();
                 if(player != null){
                         player.release();
                         player = null;
                 }
         }

         @Override
         public void onCompletion(MediaPlayer mp) {

                 if(player != null){
                         player.release();
                         player = null;
                 }

                 //close this activity;
                 finish();

                 //go back to the main menu
                 Intent intent = new Intent(this,MediaTest.class);
                 startActivity(intent);

         }



 }

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] changing a package name

2009-11-10 Thread jbrohan
Hello
This is more a Java question than Android
I have a graphing routine AChartEngine (very very good by the way).
Now I want to link this with another routine say a sound recording
activity. They are in different packages and different projects.
AChartEngine has lots of Lib's and Referenced Libraries, so it's
easier to move the other stuff there. However the charting demo has
the demo package name and the demo project name.

What is the best way to move these things about? Is there a sensible
text which explains more about packages and libraries etc?
Thanks
John

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Matt
Hi everybody,

can somebody please explain why

AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
());

will result in a runtime error, while

AlertDialog.Builder b = new AlertDialog.Builder(this);

will run just fine? I can use this and getApplicationContext()
with Toast.makeText() interchangeably without any problems. What is
different with that AlertDialog.Builder? Any ideas?


Cheers, Matt

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Justin Anderson
That's interesting.  I've never run into that problem before.  It probably
has something to do with what classes you are in or something like that.

Here's a question... did you try the Toast in the same place where using
AlertDialog.Builder gives an error or were they in different parts of your
code?

Thanks,
Justin

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


On Tue, Nov 10, 2009 at 12:16 PM, Matt reisc...@googlemail.com wrote:

 Hi everybody,

 can somebody please explain why

 AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
 ());

 will result in a runtime error, while

 AlertDialog.Builder b = new AlertDialog.Builder(this);

 will run just fine? I can use this and getApplicationContext()
 with Toast.makeText() interchangeably without any problems. What is
 different with that AlertDialog.Builder? Any ideas?


 Cheers, Matt

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@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.
To post to this group, send email to android-beginners@googlegroups.com
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: getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Matt
I have all the following code in my onCreate() method.

Toast.makeText(getApplicationContext(), Hello World!,
Toast.LENGTH_SHORT).show();
AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
());

[Dialog configuration]

b.show();


While the Toast message gets displayed right away, the AlertDialog
won't. Instead there is a runtime error. Like I said, if you replace
the getApplicationContext() with this, it works flawlessly.



On 10 Nov., 20:44, Justin Anderson janderson@gmail.com wrote:
 That's interesting.  I've never run into that problem before.  It probably
 has something to do with what classes you are in or something like that.

 Here's a question... did you try the Toast in the same place where using
 AlertDialog.Builder gives an error or were they in different parts of your
 code?

 Thanks,
 Justin

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

 On Tue, Nov 10, 2009 at 12:16 PM, Matt reisc...@googlemail.com wrote:
  Hi everybody,

  can somebody please explain why

  AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
  ());

  will result in a runtime error, while

  AlertDialog.Builder b = new AlertDialog.Builder(this);

  will run just fine? I can use this and getApplicationContext()
  with Toast.makeText() interchangeably without any problems. What is
  different with that AlertDialog.Builder? Any ideas?

  Cheers, Matt

  --
  You received this message because you are subscribed to the Google
  Groups Android Beginners group.
  To post to this group, send email to android-beginners@googlegroups.com
  To unsubscribe from this group, send email to
  android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@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.
To post to this group, send email to android-beginners@googlegroups.com
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: how to call a function after taking snap from camera?? plz help

2009-11-10 Thread wahib haq
hi Chris !! Its after a long time i am responding to your suggestion
:S. I was out of this task for a while. I tried your suggestion that
to use StartActivityForResult and then calling mufunction() in an
override of onActivityResult(). But its not working and being a newbie
its tough to find the cause very quickly.

I tried like this ..

Intent intent = new Intent();
intent.setClassName(com.android.camera,
com.android.camera.Camera);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//startActivity(intent);

startActivityForResult(intent,0);

 @Override
protected void onActivityResult(int requestCode, int
resultCode,Intent data)
{


super.onActivityResult(requestCode, resultCode, data);

decode(); //function which i want to call

}

I searched for few examples using onActivityResult() and i found that
it used requestCode with Switch in most of them. I am confused what to
pass with Intent(intentobject, ?) and what would i receive in
requestCode variable ??

Remember i intend to take a snap from camera app and want to execute
decode() function.

Kindly help.

Regards,

-- 
Wahib-ul-haq

Communications Engineering Student,
NUST, Pakistan.
www.sizzlotech.com

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] How to use startActivityForResult() onActivityResult() ??

2009-11-10 Thread wahib
Hi Ev1 !! I am stuck with an issue with Camera built-in app. I intend
to call built-in camera app from my app and then as user takes a snap
it should quit camera app and return back to execute my decode()
function.

Rite now the camera app is successfully opened but after taking one
snap the camera app doesnt quits :S. I received a suggestion from one
of the post to use startActivityForResult() and override
onActivityResult(). But i am not clear how to use it. what to pass
along with Intent(Intentobject, ?)  what to receive in RequestCode
variable in override version of onActivityResult().

Hope i made myself clear. If there is any other solution to this
problem. Kindly refer it. Thanks in advance !!

Regards,
wahib

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] Mobile web pages

2009-11-10 Thread Eros Stein
Hi all.
I've been searching how to develop mobile web pages but I haven't got ...
yet.
Does anyone know how to do it? I already know I got to make a CSS specific
for that page.

Any more info?

Thanks.

-- 
Eros Eduardo Stein
Técnico de Informática / Em breve analista.
USE  http://www.ekaaty.org
http://www.erosstein.info

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] Mobile web pages

2009-11-10 Thread Justin Anderson
This isn't really the place for this type of question

But essentially all you need to do is design your website to look good on
small screen resolutions.  You probably don't want to have too many images,
etc...

Here are some links that may help:
http://www.devwebpro.com/2009/06/26/developing-amazing-mobile-web-pages
http://adwords.google.com/support/aw/bin/answer.py?hl=enanswer=29489
http://www.w3.org/Mobile/
http://woork.blogspot.com/2008/07/tips-to-design-your-site-for-mobile.html
http://www.cameronmoll.com/archives/000577.html
http://www.webpagefx.com/design-build-mobile-web-site.html

By the way, I found these links by googling the following:
develop mobile web page
design mobile web page

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


On Tue, Nov 10, 2009 at 3:05 PM, Eros Stein eros.st...@gmail.com wrote:

 Hi all.
 I've been searching how to develop mobile web pages but I haven't got ...
 yet.
 Does anyone know how to do it? I already know I got to make a CSS specific
 for that page.

 Any more info?

 Thanks.

 --
 Eros Eduardo Stein
 Técnico de Informática / Em breve analista.
 USE  http://www.ekaaty.org
 http://www.erosstein.info

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@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.
To post to this group, send email to android-beginners@googlegroups.com
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: getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Matt
I should mention that the runtime error does not occur in this line
here

AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
());

but when calling

b.show()

later on. According to DDMS, the WindowManager crashes because it is
trying to add a new Window (the dialog) with a token=null. How can
that be? Especially when the Toast message gets displayed properly and
that is created and shown even before creating that Builder instance.
I thought that maybe the application context wasn't fully initialized
yet, so I moved all the code to the onStart() method. Well, needless
to say that did not work either. Any clues?


Best wishes, Matt


On 10 Nov., 21:53, Justin Anderson janderson@gmail.com wrote:
 Shoot... I was kinda hoping they were in different parts of your code.  I'm
 going to have to punt this one off to someone else...

 Anyone?

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

 On Tue, Nov 10, 2009 at 1:27 PM, Matt reisc...@googlemail.com wrote:
  I have all the following code in my onCreate() method.

  Toast.makeText(getApplicationContext(), Hello World!,
  Toast.LENGTH_SHORT).show();
  AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
  ());

  [Dialog configuration]

  b.show();

  While the Toast message gets displayed right away, the AlertDialog
  won't. Instead there is a runtime error. Like I said, if you replace
  the getApplicationContext() with this, it works flawlessly.

  On 10 Nov., 20:44, Justin Anderson janderson@gmail.com wrote:
   That's interesting.  I've never run into that problem before.  It
  probably
   has something to do with what classes you are in or something like that.

   Here's a question... did you try the Toast in the same place where using
   AlertDialog.Builder gives an error or were they in different parts of
  your
   code?

   Thanks,
   Justin

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

   On Tue, Nov 10, 2009 at 12:16 PM, Matt reisc...@googlemail.com wrote:
Hi everybody,

can somebody please explain why

AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
());

will result in a runtime error, while

AlertDialog.Builder b = new AlertDialog.Builder(this);

will run just fine? I can use this and getApplicationContext()
with Toast.makeText() interchangeably without any problems. What is
different with that AlertDialog.Builder? Any ideas?

Cheers, Matt

--
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to
  android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
  android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@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.
  To post to this group, send email to android-beginners@googlegroups.com
  To unsubscribe from this group, send email to
  android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@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.
To post to this group, send email to android-beginners@googlegroups.com
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: getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Justin Anderson
This may seem weird, but try doing this:

b.create().show();

I have never actually used the show method on the Builder class (I didn't
realize it existed) and have never had any problems displaying a dialog.

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


On Tue, Nov 10, 2009 at 4:31 PM, Matt reisc...@googlemail.com wrote:

 I should mention that the runtime error does not occur in this line
 here

 AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
 ());

 but when calling

 b.show()

 later on. According to DDMS, the WindowManager crashes because it is
 trying to add a new Window (the dialog) with a token=null. How can
 that be? Especially when the Toast message gets displayed properly and
 that is created and shown even before creating that Builder instance.
 I thought that maybe the application context wasn't fully initialized
 yet, so I moved all the code to the onStart() method. Well, needless
 to say that did not work either. Any clues?


 Best wishes, Matt


 On 10 Nov., 21:53, Justin Anderson janderson@gmail.com wrote:
  Shoot... I was kinda hoping they were in different parts of your code.
  I'm
  going to have to punt this one off to someone else...
 
  Anyone?
 
  --
  There are only 10 types of people in the world...
  Those who know binary and those who don't.
  --
 
  On Tue, Nov 10, 2009 at 1:27 PM, Matt reisc...@googlemail.com wrote:
   I have all the following code in my onCreate() method.
 
   Toast.makeText(getApplicationContext(), Hello World!,
   Toast.LENGTH_SHORT).show();
   AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
   ());
 
   [Dialog configuration]
 
   b.show();
 
   While the Toast message gets displayed right away, the AlertDialog
   won't. Instead there is a runtime error. Like I said, if you replace
   the getApplicationContext() with this, it works flawlessly.
 
   On 10 Nov., 20:44, Justin Anderson janderson@gmail.com wrote:
That's interesting.  I've never run into that problem before.  It
   probably
has something to do with what classes you are in or something like
 that.
 
Here's a question... did you try the Toast in the same place where
 using
AlertDialog.Builder gives an error or were they in different parts of
   your
code?
 
Thanks,
Justin
 
   
 --
There are only 10 types of people in the world...
Those who know binary and those who don't.
   
 --
 
On Tue, Nov 10, 2009 at 12:16 PM, Matt reisc...@googlemail.com
 wrote:
 Hi everybody,
 
 can somebody please explain why
 
 AlertDialog.Builder b = new
 AlertDialog.Builder(getApplicationContext
 ());
 
 will result in a runtime error, while
 
 AlertDialog.Builder b = new AlertDialog.Builder(this);
 
 will run just fine? I can use this and getApplicationContext()
 with Toast.makeText() interchangeably without any problems. What is
 different with that AlertDialog.Builder? Any ideas?
 
 Cheers, Matt
 
 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 To post to this group, send email to
   android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com
 
   android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com
 android-beginners%252bunsubscr...@googlegroups.comandroid-beginners%25252bunsubscr...@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.
   To post to this group, send email to
 android-beginners@googlegroups.com
   To unsubscribe from this group, send email to
   android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@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.
 To post to this group, send email to android-beginners@googlegroups.com
 To unsubscribe from this group, send email to
 

[android-beginners] Re: getApplicationContext() AlertDialog.Builder

2009-11-10 Thread Matt
I tried

b.create().show();

but that did not solve the problem. This is very strange. If I can use
'getApplicationContext()' and 'this' interchangeably when dealing with
Toast messages, I assume that those two are in fact pretty much the
same. Now, on the other hand, when dealing with that
AlertDialog.Builder class, where I can use 'this', but using
'getApplicationContext()' results in a runtime error when showing the
dialog, I must assume that 'this' and 'getApplicationContext()' are
NOT the same. How is that possible?

Anyway, here is a error log. Maybe someone can think of a solution
while looking at the actual error message.

...
WARN/WindowManager(56): Attempted to add window with non-application
token WindowToken{43be4580 token=null}.  Aborting.
DEBUG/AndroidRuntime(233): Shutting down VM
WARN/dalvikvm(233): threadid=3: thread exiting with uncaught exception
(group=0x4001b188)
ERROR/AndroidRuntime(233): Uncaught handler: thread main exiting due
to uncaught exception
ERROR/AndroidRuntime(233): android.view.WindowManager
$BadTokenException: Unable to add window -- token null is not for an
application
...

Oh, and thank you Justin for your effort! I really appreciate your
help!

Best wishes, Matt


On 11 Nov., 00:51, Justin Anderson janderson@gmail.com wrote:
 This may seem weird, but try doing this:

 b.create().show();

 I have never actually used the show method on the Builder class (I didn't
 realize it existed) and have never had any problems displaying a dialog.

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

 On Tue, Nov 10, 2009 at 4:31 PM, Matt reisc...@googlemail.com wrote:
  I should mention that the runtime error does not occur in this line
  here

  AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
  ());

  but when calling

  b.show()

  later on. According to DDMS, the WindowManager crashes because it is
  trying to add a new Window (the dialog) with a token=null. How can
  that be? Especially when the Toast message gets displayed properly and
  that is created and shown even before creating that Builder instance.
  I thought that maybe the application context wasn't fully initialized
  yet, so I moved all the code to the onStart() method. Well, needless
  to say that did not work either. Any clues?

  Best wishes, Matt

  On 10 Nov., 21:53, Justin Anderson janderson@gmail.com wrote:
   Shoot... I was kinda hoping they were in different parts of your code.
   I'm
   going to have to punt this one off to someone else...

   Anyone?

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

   On Tue, Nov 10, 2009 at 1:27 PM, Matt reisc...@googlemail.com wrote:
I have all the following code in my onCreate() method.

Toast.makeText(getApplicationContext(), Hello World!,
Toast.LENGTH_SHORT).show();
AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
());

[Dialog configuration]

b.show();

While the Toast message gets displayed right away, the AlertDialog
won't. Instead there is a runtime error. Like I said, if you replace
the getApplicationContext() with this, it works flawlessly.

On 10 Nov., 20:44, Justin Anderson janderson@gmail.com wrote:
 That's interesting.  I've never run into that problem before.  It
probably
 has something to do with what classes you are in or something like
  that.

 Here's a question... did you try the Toast in the same place where
  using
 AlertDialog.Builder gives an error or were they in different parts of
your
 code?

 Thanks,
 Justin

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

  --

 On Tue, Nov 10, 2009 at 12:16 PM, Matt reisc...@googlemail.com
  wrote:
  Hi everybody,

  can somebody please explain why

  AlertDialog.Builder b = new
  AlertDialog.Builder(getApplicationContext
  ());

  will result in a runtime error, while

  AlertDialog.Builder b = new AlertDialog.Builder(this);

  will run just fine? I can use this and getApplicationContext()
  with Toast.makeText() interchangeably without any problems. What is
  different with that AlertDialog.Builder? Any ideas?

  Cheers, Matt

  --
  You received this message because you are subscribed to the Google
  Groups Android Beginners group.
  To post to this group, send email to
android-beginners@googlegroups.com
  To unsubscribe from 

[android-beginners] Re: Unable to select build target for new Android project

2009-11-10 Thread mconstant
I need help with this, too

On Nov 5, 1:31 pm, Songmak kevinve...@gmail.com wrote:
 I am using Ubuntu 9.10 and Eclipse 3.5.  After getting everything
 setup, the new Android project wizard screen is not allowing me to
 select a buildtargetfrom the list.  The targets are there and
 installed but the table is so condensed in the UI that you are unable
 to select atargetand move to the next step.

 Can anyone shed light on how to correct?

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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: Unable to select build target for new Android project

2009-11-10 Thread mconstant
Figured it out.  I use a netbook.  The resolution was set so that it
squished the box.  I fixed it by changing the screen orientation.
Good luck!

On Nov 5, 1:31 pm, Songmak kevinve...@gmail.com wrote:
 I am using Ubuntu 9.10 and Eclipse 3.5.  After getting everything
 setup, the new Android project wizard screen is not allowing me to
 select a buildtargetfrom the list.  The targets are there and
 installed but the table is so condensed in the UI that you are unable
 to select atargetand move to the next step.

 Can anyone shed light on how to correct?

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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 in GPS while running in timer

2009-11-10 Thread Nemat
Hi frinds..

I am presently working on GPS.I have to start GPS periodically.I mean
I want GPS to start after a particular intervel,get Location value and
then stop taking location updates.For this,I m calling
requestLocationUpdates( , , ) method in a timer.Then in
onLocationChanged(), I stop taking location by using removeUpdates
().Then after particular intervel ,it again start taking values,then
when location changes ,it stops, and so on..

Here is my code:
TimerTask IntervelTimer = new TimerTask()
{
public void run()
{
Log.d
(startLocationUpdate,startLocationUpdate);
startLocationUpdate();

}
};
Timer  timer2 = new Timer();


  try{
timer2.schedule(IntervelTimer,  1*60 * 1000, 1*60 * 1000);
  }
  catch(Exception e)
  {
  Log.e(Error,e.toString());
  }

 public void startLocationUpdate()
 {
 System.out.println(startLocationUpdate());
 if(locationListener==null)
{
Looper.prepare();

 locationListener = new MyLocationListener();
 try{
lm.requestLocationUpdates(
  LocationManager.GPS_PROVIDER,
 0,
  0,
  locationListener);
 }
 catch(Exception e)
 {
 Log.e(error,e.toString());
 }
 Looper.loop();
 Looper.myLooper().quit();
}
 }

 private class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location loc) {
System.out.println(GetLocation);
if (loc != null) {
StoreGPSlocation(String.valueOf
(loc.getLatitude()),String.valueOf(loc.getLongitude()));
stopLocationUpdate();
}
}

public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}

public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}

public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
}
}

public void stopLocationUpdate()
 {
  LocationManager lm = (LocationManager)getSystemService
(Context.LOCATION_SERVICE);
 if (lm != null)

   {
if (locationListener != null)

 {

lm.removeUpdates(locationListener);
   locationListener= null;

}



   lm = null;

}



 }

Now the problem is:It starts fine for the first time,when location
changes it stops then starts again,but the timer stops running  after
that.I dont get any error or exception.I dont know where is the
problem.As far as I am concirned,the problem is in timer..

What do you guys think...

I need Help. urgently!!!

Thanks in Advance
Nemat

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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] Buttons within custom dialog?

2009-11-10 Thread Jeffrey
I am trying to get a custom dialog to have buttons that manipulate the
progress of a seekbar. I've set up the dialog layout through xml but I
can't get the buttons to work.

This is the code I'm getting stuck on:

protected Dialog onCreateDialog(int id) {
Dialog WoundSlider = new Dialog(this);
Button BDOWN = (Button) WoundSlider.findViewById(R.id.BDOWN);
BDOWN.setOnClickListener(new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {

}
});

I keep getting an error that says: The method setOnClickListener
(View.OnClickListener) in the type View is not applicable for the
arguments (new DialogInterface.OnClickListener(){})

It then lists several other listeners that it suggest I change to but
I get the same error for all of them. How do I set up a listener
within a custom dialog?

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
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