[android-beginners] Re: Android emu on Mac OS X 10.5.7

2009-07-10 Thread Romain Guy

You can safely ignore this message. It won't prevent the emulator nor
your application from running correctly.

On Fri, Jul 10, 2009 at 8:43 PM, 伟伟 wrote:
> Hey,
>   It's the first time that i run the android emulator on the mac. and
> I'm pretty sure that i have configure it well.
>
> so i write a program called AndroidDialer
> here is the program
>
> package com.google.android.AndroidDialer;
>
> import android.app.Activity;
> import android.content.Intent;
> import android.net.Uri;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
>
> public class AndroidDialer extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>     super.onCreate(savedInstanceState);
>     setContentView(R.layout.main);
>
>     final EditText numberInputed = (EditText)
> findViewById(R.id.numberInputed);
>     final Button callButton = (Button) findViewById(R.id.callButton);
>
>     callButton.setOnClickListener(new Button.OnClickListener(){
>             public void onClick(View v) {
>                 Intent callIntent = new Intent(Intent.ACTION_CALL,
> Uri.parse("tel:" + numberInputed.getText().toString()));
>                 callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>                 startActivity(callIntent);
>             }
>     });
>     }
> }
>
>
> and when I lunch the emulator it show  something  that i have never meet
> before.
> "[2009-07-11 11:34:59 - Emulator] 2009-07-11 11:34:59.236 emulator[3585:10b]
> Warning once: This application, or a library it uses, is using
> NSQuickDrawView, which has been deprecated. Apps should cease use of
> QuickDraw and move to Quartz.
> "
>
> so could anyone be kind enough to help me ?
> thanks.
>
> >
>



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

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android 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: How to set the activity as Main ?

2009-07-10 Thread Nerj

Pls, Suggest me
Its urgent, I can't get the solution...

On Jul 10, 4:10 pm, Nerj  wrote:
> Hi!
> I am begginer of Android Development.
> I can create an activity with different views, and can run them
> successfully.
> The problem is that,
>          >>   If  I have several activities in the android project, it
> takes only one to launch.
> Can u pls, tell me how to set an activity as Main one which is to be
> launch at first time when the app is open?
>
> Pls, suggest me..
>
> Thanks in advance...
--~--~-~--~~~---~--~~
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] Android emu on Mac OS X 10.5.7

2009-07-10 Thread 伟伟
Hey,
  It's the first time that i run the android emulator on the mac. and
I'm pretty sure that i have configure it well.

so i write a program called AndroidDialer
here is the program

package com.google.android.AndroidDialer;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AndroidDialer extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

final EditText numberInputed = (EditText)
findViewById(R.id.numberInputed);
final Button callButton = (Button) findViewById(R.id.callButton);

callButton.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:" + numberInputed.getText().toString()));
callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
}
});
}
}


and when I lunch the emulator it show  something  that i have never meet
before.
"[2009-07-11 11:34:59 - Emulator] 2009-07-11 11:34:59.236 emulator[3585:10b]
Warning once: This application, or a library it uses, is using
NSQuickDrawView, which has been deprecated. Apps should cease use of
QuickDraw and move to Quartz.
"

so could anyone be kind enough to help me ?
thanks.

--~--~-~--~~~---~--~~
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: How to install and run applications from within another application?

2009-07-10 Thread Yasser

For getLaunchIntentForPackage(), it says it is undefined for type
PackageManager and hence code cannot compile?
i can see the other methods when I put . after getPackageManager()
except this one.

Thanks
Yasser

On Jul 6, 10:39 am, "Justin (Google Employee)" 
wrote:
> > > How does the process for retrieving system rights look like?
>
> Its a matter of signatures. Whoever signs the system is also going to
> need to sign any app that wants system privileges.
>
> > I suppose this problem
> > shouldn't exist if I was able to save the .apk file in the private
> > directory of my application and then invoke the system install UI on
> > the file.
>
> Well, no, you can't have your cake and eat it to. The package manager
> needs to be able to read the APK file to install the app. In order to
> do this you need to place the APK in a world-readable location because
> you can't have the same UID or GID as the package manager. No matter
> what you do, if you want to allow the package manager to read the
> file, everyone can. Now, if you put the file in your private directory
> and set the mode to MODE_WORLD_READABLE, the package manager may be
> able to read the file, I think it should be able to. Everyone else
> can, but they would have to know the exact path because I don't
> believe they can list the directory in which the file resides.
>
> Now, regardless of where the APK is placed, you should probably delete
> it after installation, otherwise you're at least doubling storage
> space required per application. If you delete the APK after its
> installed, you also fix your "install only to device downloaded on".
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Jul 2, 3:48 am, calleandersson  wrote:
>
>
>
> > I have been testing with the 'file://' prefix and got the following
> > results:
>
> > When saving an .apk file in the private directory of my application
> > and trying to invoke the system installation UI, an parse error
> > occured due to permission issues:
> >   07-02 07:15:27.826: WARN/zipro(726): Unable to open zip '/data/data/
> > test.calle.helloworld/files/AndroidHelloWorld.apk': Permission denied
> >   07-02 07:15:27.826: DEBUG/asset(726): failed to open Zip archive '/
> > data/data/test.calle.helloworld/files/AndroidHelloWorld.apk'
> >   07-02 07:15:27.846: WARN/PackageParser(726): Unable to read
> > AndroidManifest.xml of /data/data/test.calle.helloworld/files/
> > AndroidHelloWorld.apk
> >   07-02 07:15:27.846: WARN/PackageParser(726):
> > java.io.FileNotFoundException: AndroidManifest.xml
> >    ...
> >   07-02 07:15:27.856: WARN/PackageInstaller(726): Parse error when
> > parsing manifest. Discontinuing installation
>
> > When I saved the .apk file on the SD card, everything went as supposed
> > and the system installation UI was displayed.
>
> > So far so good. However, I only want a downloaded .apk file to be
> > installed on the same phone which downloaded it. If the application is
> > placed on the SD card, wouldn't it be possible to use the same SD card
> > in another phone (or copy the .apk file to another SD card used by
> > another phone) and install the application on that phone too? Am I
> > correct in these assumtions?
>
> > With regards to what I wrote above, is it somehow possible to restrict
> > an application file from beeing installed on any other phone except
> > the very same phone which downloaded the .apk file (using my
> > application)? Is system rights needed? I suppose this problem
> > shouldn't exist if I was able to save the .apk file in the private
> > directory of my application and then invoke the system install UI on
> > the file.
>
> > Regards,
> > Calle
>
> > On 1 Juli, 18:22, calleandersson  wrote:
>
> > > Hi Justin,
>
> > > Thanks for the tips about the 'file://' prefix and SD card, I will
> > > look into that tomorrow.
>
> > > How does the process for retrieving system rights look like? Is it the
> > > manufacturer of an Android device which decides if an application
> > > should have system rights? I suppose that that kind of clients must be
> > > installed/included in the device before it is released or am I wrong?
>
> > > Is there somehow possible to simulate that an application has system
> > > rights in the Emulator?
>
> > > By the way, I was thinking of using the same Intent code to start an
> > > already installed application but, currently, I'm using the following
> > > code which seems to work pretty well (and the class name doesn't need
> > > to be specified):
> > > Intent intent = getPackageManager().getLaunchIntentForPackage
> > > (packageName);
> > > startActivity(intent);
>
> > > Regards,
> > > Calle
>
> > > On 1 Juli, 17:18, "Justin (Google Employee)"  wrote:
>
> > > > The package manager way will not work, you need the permission you
> > > > referenced, INSTALL_PACKAGES, which only the system has and is not
> > > > obtainable by user-installed applications.
>
> > > > I think your Intent-based method should work, I believe this is more
> > > > or

[android-beginners] Re: How to programatically launch an installed app?

2009-07-10 Thread Yasser

Thanks a lot Mark, that clarified my doubts.

On Jul 10, 4:05 pm, Mark Murphy  wrote:
> Yasser wrote:
> > To know the intent for an activity in order to launch it, do I need to
> > have access to the app source code?
>
> Ideally, you have documentation telling you "hey, it is perfectly
> acceptable to use this Intent to launch my application: ...".
>
> Now, you can find out possible Intents other ways -- use PackageManager,
> watch messages in LogCat, examine the source code -- but any of those
> techniques may result in you creating something that will be unsupported
> over time.
>
> So, no, you do not necessarily need the source code, though it helps.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Development Wiki:http://wiki.andmob.org
--~--~-~--~~~---~--~~
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: SQL Lite question, can you insert negative numbers

2009-07-10 Thread Mark Murphy

Beth Mezias wrote:
> Hello,
> Can I get an (Android) example for getting signed numbers into a SQL
> Lite database?  I've been trying many silly things that generate syntax
> errors so I thought I could put out the question.  Note that I searched
> and searched the groups and (surprisingly) found no history.

Outside of Android, here's a sqlite3 session:

SQLite version 3.6.10
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table foo (number real);
sqlite> .schema foo
CREATE TABLE foo (number real);
sqlite> insert into foo (number) values (-1);
sqlite> select * from foo;
-1.0
sqlite> .exit

Inside of Android, you should be able to just put a negative number into
your ContentValues that you supply to your insert() call with
SQLiteDatabase.

Can you provide any source code and the syntax errors you are getting?

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

Android Development Wiki: http://wiki.andmob.org

--~--~-~--~~~---~--~~
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: How to programatically launch an installed app?

2009-07-10 Thread Mark Murphy

Yasser wrote:
> To know the intent for an activity in order to launch it, do I need to
> have access to the app source code?

Ideally, you have documentation telling you "hey, it is perfectly
acceptable to use this Intent to launch my application: ...".

Now, you can find out possible Intents other ways -- use PackageManager,
watch messages in LogCat, examine the source code -- but any of those
techniques may result in you creating something that will be unsupported
over time.

So, no, you do not necessarily need the source code, though it helps.

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

Android Development Wiki: http://wiki.andmob.org

--~--~-~--~~~---~--~~
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] SQL Lite question, can you insert negative numbers

2009-07-10 Thread Beth Mezias
Hello,Can I get an (Android) example for getting signed numbers into a SQL
Lite database?  I've been trying many silly things that generate syntax
errors so I thought I could put out the question.  Note that I searched and
searched the groups and (surprisingly) found no history.
Thanks and regards,
Beth

--~--~-~--~~~---~--~~
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: How to programatically launch an installed app?

2009-07-10 Thread Yasser

To know the intent for an activity in order to launch it, do I need to
have access to the app source code?


On Jul 10, 1:23 pm, Mark Murphy  wrote:
> Yasser wrote:
> > I want to launch/start an already installed application like
> > Calculator on Android and then send some keystrokes to it.
>
> You cannot send keystrokes to other applications.
>
> > Is there a way to programatically launch an app without having access
> > to its code?
>
> If you can find out an Intent that launches it, you use startActivity()
> like you would any other activity. Finding the proper Intent can be a
> bit tricky, though there are methods on the PackageManager class that
> may help you identify what is launchable.
>
> Bear in mind, though, that unless those Intents are publicly documented,
> they are likely to break in future releases of Android (or of whatever
> 3rd party app you attempt to launch).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Need help for your Android OSS project?http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
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: fastboot on emulator

2009-07-10 Thread David Turner
no fastboot doesn't work with the emulator at all.

(fastboot is talking to the hardware bootloader that simply doesn't exist on
the emulator.
Instead, the emulator directly loads a Linux kernel image and starts it
directly...)

On Thu, Jul 9, 2009 at 3:48 PM, pan.gaoy...@gmail.com  wrote:

>
> Hi,
>
> The "adb devices" can detect the emulator but "fastboot devices" can
> not, does the fastboot work on emulator? if yes, how to enter into
> fastboot mode?
>
> >
>

--~--~-~--~~~---~--~~
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: How to contact device with ADB from Windows NT

2009-07-10 Thread Yusuf T. Mobile

The system requirements for the Android SDK on Windows are Windows XP
(32-bit) or Vista (32- or 64-bit). But to quote Henry Ford, "Obstacles
are those frightful things you see when you take your eyes off your
goal." So to set ADBHOST or any environment variable on Windows NT,
follow the instructions in this link: http://support.microsoft.com/kb/100843



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Jul 10, 3:34 am, Chenny  wrote:
> Hi All,
> I know we can easy contact devide with ADB from Linux PC. such as:
>   $ export ADBHOST=xx.xx.xx.xx
>   $ adb kill-server (you must make sure adb path is set)
>   $ adb shell
>
> But how to do it from Windows NT?
> How to set ADBHOST from windows?
>
> Thanks very much!
--~--~-~--~~~---~--~~
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: How to programatically launch an installed app?

2009-07-10 Thread Mark Murphy

Yasser wrote:
> I want to launch/start an already installed application like
> Calculator on Android and then send some keystrokes to it.

You cannot send keystrokes to other applications.

> Is there a way to programatically launch an app without having access
> to its code?

If you can find out an Intent that launches it, you use startActivity()
like you would any other activity. Finding the proper Intent can be a
bit tricky, though there are methods on the PackageManager class that
may help you identify what is launchable.

Bear in mind, though, that unless those Intents are publicly documented,
they are likely to break in future releases of Android (or of whatever
3rd party app you attempt to launch).

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

Need help for your Android OSS project? http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
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] UI changing layouts

2009-07-10 Thread bobby

Hi,

I have created multiple UI layout files and placed them in res/layout
folder. The layouts designed are similar to a forms. Each layout has
some buttons to transition to an alternate layout. Let me elaborate
how my files look like:

main.xml
linearlayout with button b1

s1.xml
linearlayout with button b2

s2.xml
linearlayout with button b3

s3.xml

In the main Activity, for OnClickListener of b1, i modify to

{
runOnUiThread(new Runnable()
{
public void run()
{
// with some processing
setContentView(R.layout.s1);
}
});
}

for OnClickListener of b2, i modify to
{
runOnUiThread(new Runnable()
{
public void run()
{
// with some processing
setContentView(R.layout.s2);
}
});
}

for OnClickListener of b3, i modify to
{
runOnUiThread(new Runnable()
{
public void run()
{
// with some processing
setContentView(R.layout.s3);
}});
}

I get a force close when I try to perform the same. Could you please
point what mistake I am making? Any suggestions of a better UI design?

Cheers
Bobby
--~--~-~--~~~---~--~~
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 programatically launch an installed app?

2009-07-10 Thread Yasser

Hi,

I want to launch/start an already installed application like
Calculator on Android and then send some keystrokes to it.

Is there a way to programatically launch an app without having access
to its code?

Thanks
Yasser
--~--~-~--~~~---~--~~
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: USB data acquisition

2009-07-10 Thread Disconnect

Serial does not have a master/slave requirement, so that will work if
you can get serial working on the G1. (The necessary cables exist, but
information on making or getting them has yet to come out of google
afaik. I think either San or Romainguy were working on it, although I
could be wrong.)

Bluetooth has no API support (but then again, neither does usb-otg or
serial so..) but otherwise is a fully functioning stack - if you use
rfcomm-compatible modules (serial over bt) you should be fine.  (It
would require root of course.)

On Fri, Jul 10, 2009 at 2:30 PM, Mas wrote:
>
> Hello,
>
> Thanks for the feedback. I have been doing some more reading online
> and I found that the audio pins can be set to TTL level RX and TX
> pins. If the USB cannot act as a host, does anyone know if the serial
> port can act as a host? Or another alternative, can a Bluetooth
> connection be made to allow communication with a sensor (assuming I
> make the sensor work with a Bluetooth module)?
>
> Thanks for the help,
> Mas
>
> On Jul 10, 5:32 am, Disconnect  wrote:
>> When you plug your headset in, its not a usb port at all. Its straight
>> analog audio. (Take a closer look, there are 10 or so pins. There is
>> even a pinout diagram floating around, and 3way headset adapters that
>> allow usb data, headset audio and charging..)
>>
>> At the end of the day, usb host/guest is NOT interchangable without
>> hardware modifications.
>>
>> There is some good news here - rumours are that the g1 has a usb-otg
>> capable chipset. With 'magic' bit flipping (as in, the info has to
>> come from htc/qualcomm) and some minor hardware hacking (5v supply,
>> similar to what n770/n800/n810 needs) you can get usb host working.
>> (That 'minor' hack may be less minor if there is a diode in the way,
>> since it'd require soldering onto the board instead of just building
>> an adapter.)
>>
>> On Fri, Jul 10, 2009 at 4:16 AM, Nicholas
>>
>>
>>
>> Radford wrote:
>> > The phones usb port is not a guest when I plug my headset into it.
>>
>> > It is when I plug my computer into it, but thats less of a guest / host
>> > situation and more like mutual devices chattering to it each other.
>>
>> > USB in just a serial bus at the end of the day. If one end has to be a host
>> > and the other a guest, this can change based on which configuration, non?
>> > It's not like USB are hardwired to be either host or guests, that's a
>> > progmatic thing, decided by the two devices in question.
>>
>> > On Fri, Jul 10, 2009 at 7:10 AM, Tony Su  wrote:
>>
>> >> Unless someone can answer definitively based on the phone's technical
>> >> information,
>>
>> >> Based on observation only, it's not possible based on general USB
>> >> architecture. In any USB connection, one endpoint is designated the Host 
>> >> and
>> >> multiple guests can connect to that Host (IIRC theoretically 256 devices).
>>
>> >> Because the Phone can connect to the USB port of a computer, the computer
>> >> is always the Host and anything else that can connect is a Guest, so the
>> >> Phone's USB port is a Guest.
>>
>> >> A Sensor would also be a Guest so cannot connect to the Phone, it needs to
>> >> connect to a port configured as a Host.
>>
>> >> Tony
>>
>> >> - Original Message -
>> >> From: Mas 
>> >> Sent: Wed, 7/8/2009 12:12pm
>> >> To: Android Beginners 
>> >> Subject: [android-beginners] USB data acquisition
>>
>> >> Hello,
>>
>> >> I am doing a feasibility study using an Android Dev phone. I want to
>> >> attach the phone using the USB cable (or the serial port) to a sensor.
>> >> In an application, I want to pole the sensor over the cable and have
>> >> the resultant value displayed on the screen. The interaction between
>> >> the sensor and the phone would involve the phone sending down a
>> >> request data byte and the sensor responding with the necessary data.
>> >> Is a data acquisition application of this nature possible on the
>> >> phone?
>>
>> >> Thank you for your time,
>> >> Mas
> >
>

--~--~-~--~~~---~--~~
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: USB data acquisition

2009-07-10 Thread Mas

Hello,

Thanks for the feedback. I have been doing some more reading online
and I found that the audio pins can be set to TTL level RX and TX
pins. If the USB cannot act as a host, does anyone know if the serial
port can act as a host? Or another alternative, can a Bluetooth
connection be made to allow communication with a sensor (assuming I
make the sensor work with a Bluetooth module)?

Thanks for the help,
Mas

On Jul 10, 5:32 am, Disconnect  wrote:
> When you plug your headset in, its not a usb port at all. Its straight
> analog audio. (Take a closer look, there are 10 or so pins. There is
> even a pinout diagram floating around, and 3way headset adapters that
> allow usb data, headset audio and charging..)
>
> At the end of the day, usb host/guest is NOT interchangable without
> hardware modifications.
>
> There is some good news here - rumours are that the g1 has a usb-otg
> capable chipset. With 'magic' bit flipping (as in, the info has to
> come from htc/qualcomm) and some minor hardware hacking (5v supply,
> similar to what n770/n800/n810 needs) you can get usb host working.
> (That 'minor' hack may be less minor if there is a diode in the way,
> since it'd require soldering onto the board instead of just building
> an adapter.)
>
> On Fri, Jul 10, 2009 at 4:16 AM, Nicholas
>
>
>
> Radford wrote:
> > The phones usb port is not a guest when I plug my headset into it.
>
> > It is when I plug my computer into it, but thats less of a guest / host
> > situation and more like mutual devices chattering to it each other.
>
> > USB in just a serial bus at the end of the day. If one end has to be a host
> > and the other a guest, this can change based on which configuration, non?
> > It's not like USB are hardwired to be either host or guests, that's a
> > progmatic thing, decided by the two devices in question.
>
> > On Fri, Jul 10, 2009 at 7:10 AM, Tony Su  wrote:
>
> >> Unless someone can answer definitively based on the phone's technical
> >> information,
>
> >> Based on observation only, it's not possible based on general USB
> >> architecture. In any USB connection, one endpoint is designated the Host 
> >> and
> >> multiple guests can connect to that Host (IIRC theoretically 256 devices).
>
> >> Because the Phone can connect to the USB port of a computer, the computer
> >> is always the Host and anything else that can connect is a Guest, so the
> >> Phone's USB port is a Guest.
>
> >> A Sensor would also be a Guest so cannot connect to the Phone, it needs to
> >> connect to a port configured as a Host.
>
> >> Tony
>
> >> - Original Message -
> >> From: Mas 
> >> Sent: Wed, 7/8/2009 12:12pm
> >> To: Android Beginners 
> >> Subject: [android-beginners] USB data acquisition
>
> >> Hello,
>
> >> I am doing a feasibility study using an Android Dev phone. I want to
> >> attach the phone using the USB cable (or the serial port) to a sensor.
> >> In an application, I want to pole the sensor over the cable and have
> >> the resultant value displayed on the screen. The interaction between
> >> the sensor and the phone would involve the phone sending down a
> >> request data byte and the sensor responding with the necessary data.
> >> Is a data acquisition application of this nature possible on the
> >> phone?
>
> >> Thank you for your time,
> >> Mas
--~--~-~--~~~---~--~~
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] Android Device not detected on Karmic

2009-07-10 Thread Daniel Sloof

Long story short, I can't get adb to list my android device:

dan...@ubuntu:~$ uname -ar
Linux ubuntu 2.6.31-2-generic #16-Ubuntu SMP Mon Jul 6 20:38:51 UTC 2009 
i686 GNU/Linux
dan...@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu karmic (development branch)
Release:9.10
Codename:karmic
dan...@ubuntu:~$ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
dan...@ubuntu:~$ sudo /etc/init.d/udev restart
 * Stopping kernel event 
manager...  

   
[ OK ]
 * Starting kernel event 
manager...  

   
[ OK ]
dan...@ubuntu:~$ sudo killall adb
dan...@ubuntu:~$ dmesg | grep -i android
[150391.798593] scsi 9:0:0:0: Direct-Access HTC  Android 
Phone0100 PQ: 0 ANSI: 2
dan...@ubuntu:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/daniel/dev/android-sdk-linux_x86-1.5_r2/tools
dan...@ubuntu:~$ adb devices
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached

dan...@ubuntu:~$


Anyone know what else I can try?

--~--~-~--~~~---~--~~
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] Scrolling speed in Gallery widget

2009-07-10 Thread AJ

Hi all,

I've noticed the scrolling "speed" in the Gallery widget is rather
fast.  This is probably the first time I'd say something is rendering
TOO fast.

Here's the example:

Imagine 5 icons in a Gallery widget scrolling horizontally, each icon
takes up 1 screen width.  If you swipe your finger to move the current
image, the rest of the gallery's icons fly by very fast (instead of
just moving you to the next icon).  You must move your finger pretty
slow to accurately move through one-by-one.

Is there a value which one can change the "coefficient of friction"
for scroll speed in Gallery?  So one can make it "drag" a little
slower instead of flying by so quickly.


Thanks,
AJ

--~--~-~--~~~---~--~~
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] HTC Magic for development using the android source code

2009-07-10 Thread scs

I tried to use HTC magic for development.
But It is not booting up.

Can you please help me up?

I followed the steps as
http://developer.android.com/guide/developing/device.html

And used latest master branch code system image. Please help me.

--~--~-~--~~~---~--~~
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 contact device with ADB from Windows NT

2009-07-10 Thread Chenny

Hi All,
I know we can easy contact devide with ADB from Linux PC. such as:
  $ export ADBHOST=xx.xx.xx.xx
  $ adb kill-server (you must make sure adb path is set)
  $ adb shell

But how to do it from Windows NT?
How to set ADBHOST from windows?

Thanks very much!

--~--~-~--~~~---~--~~
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: Make an "Emergency Call"

2009-07-10 Thread Nick Badal

You would use an Intent with the following code:

Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:911"));
startActivity(intent);

On Jul 9, 12:22 pm, Ankit Shah  wrote:
> From my Android application I would like to make an Emergency Call
> "911".
>
> Any information on this would be greatly appreciated.
>
> Thank you.

--~--~-~--~~~---~--~~
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] Grid of clickable views

2009-07-10 Thread Nick Badal

Hi, I'm trying to create a grid of clickable views from an array, and
the following code places all of the view on top of eachother. What am
I doing wrong?

 for(int ct = 0; cthttp://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: start

2009-07-10 Thread Richard Schilling


I own the book you mention - an excellent place to start:
"Professional Android Appliation Development" by Reto Meier

Also watch Android videos on the developer site and YouTube, and
search for Google/IO (the conference) sessions.

The Android platform is unique in that from an application
perspective, it could be considered a "hybrid" crossing between a
standard desktop computing environment and an embedded device.  You
can't program it like you would a desktop computer, but if you follow
development "The Android Way" and pay attention to the constraints and
system design of the platform, there's a really stable and powerful
platform to take advantage of.

Oh, and look at the API online weekly for changes.

The Android crew are doing a crack job at development and keeping
things updated.

Good luck!

Cheers,

Richard


On Jun 30, 10:53 am, Pablo Vagliati  wrote:
> Thanks Yusuf. The developer guide is a best source to begin that books like
> "Professional Android Application Development-2009"?
>
> On Tue, Jun 30, 2009 at 2:40 PM, Yusuf T. Mobile 
> wrote:
>
>
>
>
>
> > Hello Pablo, you've come to the right place to ask this question.
>
> > Android uses the Java programming language. If you have not learned
> > Java yet, you may start here:http://java.sun.com/docs/books/tutorial/
>
> > If you are familiar with Java, you can learn about Android here:
> >http://developer.android.com/guide/index.html
>
> > Buona fortuna.
>
> > Yusuf Saib
> > Android
> > ·T· · ·Mobile· stick together
> > The views, opinions and statements in this email are those of the
> > author solely in their individual capacity, and do not necessarily
> > represent those of T-Mobile USA, Inc.
>
> > On Jun 27, 9:46 pm, Pablo Vagliati  wrote:
> > > hi,
>
> > > I will begin to break into Android. As you recommend I start?
>
> > > --
> > > Ing. Pablo Vagliati
> > > 0054 03858 15 44 9012
>
> --
> Ing. Pablo Vagliati
> 0054 03858 15 44 9012

--~--~-~--~~~---~--~~
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] Android running slow

2009-07-10 Thread Noodles

Is it normal for there to be lag time when scrolling or switching to
the home screen?  Scrolling through my contacts is frustrating because
I have to wait for it to catch up to my finger and when I close a
program and I have to wait for the icons to show up on the home
screen. It seems as if there's a bunch of processes running in the
background.  I installed Task Manager 1.5 and found a bunch of
programs running.  I spent a long time searching the internet on how
to close a program because the user manual says nothing.  I found that
pressing the back button closes a program (except for browsers).  So I
closed everything I could and it still runs real slow.  My wife has
the new iPhone and it runs so smooth compared to my Android.

Any suggestions?  Thanks.

--~--~-~--~~~---~--~~
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 set the activity as Main ?

2009-07-10 Thread Nerj

Hi!
I am begginer of Android Development.
I can create an activity with different views, and can run them
successfully.
The problem is that,
 >>   If  I have several activities in the android project, it
takes only one to launch.
Can u pls, tell me how to set an activity as Main one which is to be
launch at first time when the app is open?

Pls, suggest me..

Thanks in advance...

--~--~-~--~~~---~--~~
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: android open database

2009-07-10 Thread Yusuf T. Mobile

Ah, the inspiration and heartbreak of tutorials for a moving target.
The vagaries of coding on the bleeding edge of technology like a leaf
upon on the wind of our collective mind.

Where was I? Oh right, that API was removed, I think in 1.5. Now we
have openOrCreateDatabase:

http://developer.android.com/reference/android/content/Context.html#openOrCreateDatabase(java.lang.String,%20int,%20android.database.sqlite.SQLiteDatabase.CursorFactory)


Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Jul 8, 9:14 pm, xventure  wrote:
> Hi,
>
> import java.io.FileNotFoundException;
>
> import android.content.Context;
> import android.database.sqlite.SQLiteDatabase;
>
> public class DBHelper {
>         class Tuple extends Object {
>         public String name;
>         public String mobile;
>         public String address;
>         public String email;
>         public String notes;
>         public long rowId;
>         }
>         private SQLiteDatabase db;
>         public DBHelper(Context ctx) {
>
>         try {
>                 db =  ctx.openDatabase("AddressBook", null);
>         } catch (FileNotFoundException e) {
>         try {
>                 db =ctx.createDatabase("AddressBook", 1, 0,null);
>                 db.execSQL(DATABASE_CREATE);
>         } catch (FileNotFoundException e1) {
>         db = null;
>         }
>         }
>         }
>         private static final String DATABASE_CREATE =
>         "create table addressbook (_id integer primary key autoincrement, "
>         + "name text not null,"
>         + "mobile text not null,"
>         + "address text not null,"
>         + "email text not null,"
>         + "notes text null"
>         +");";
>         public void close() {
>         db.close();
>         }
>         }
>
> i got this tutorial somewhere from the net, but at the line:
>
> db =  ctx.openDatabase("AddressBook", null);
>
> i got an error: "the method openDatabase(String, null) is undefined
> for the type Context"
>
> Please help,
>
> Thanks,
>
> Xve
--~--~-~--~~~---~--~~
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: interacting with phone

2009-07-10 Thread Yusuf T. Mobile

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" +
phoneNumber + ";" + dtmfSequence));


Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Jul 9, 2:16 am, Edward  wrote:
> Hi,
>
> I want to do the following; dial a number (or a contact), wait for the
> conference call automated speech to run for a few seconds (5+/-), then
> have the application or script punch in the conference code and the #
> key to access the conference call. Any one able to assist in example
> code and\or point me in the right direction?
>
> Ed.
--~--~-~--~~~---~--~~
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: Install Android on my pocket pc

2009-07-10 Thread Yusuf T. Mobile

The short answer is: yes, if you have access to the device bootloader
as well as device drivers that Android can use.

The other short answer (at no additional cost!) is: there is a
wonderful forum for precisely these questions: 
http://groups.google.com/group/android-porting



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Jul 8, 11:39 am, tiger2wander  wrote:
> Hi,
>   I'm new to android too, I have some experience with compile
> android's kernel for my pocketpc: O2 XDA IIs (blueangel).
>
> On Jun 29, 11:33 pm, xda  wrote:> Hi,
>
> > I'm new toAndroid& have heard its open source, but am not very clear
> > on a few things.
>
> > -Is it possible to download the sources & compile it for an Intel
> > Xscale processor as used by most pocket pc devices?
>
> ==> Of course, you can re-compile the android's source code for almost
> device
>
> > -If the above is true, is it possible to flash the device toAndroid
> > to make it the default OS?
>
> ==> AKA, flash the device such as blueangel, himalaya... is not
> possible at least now as I known.
> Usually I have using HaRET to take device boot into linux and use SD
> card (of course, you can put your linux to ram)
> for more information about HaRET go 
> here:http://www.handhelds.org/moin/moin.cgi/HaRET
>
>
>
>
>
> > I'd be interested in customizing the OS for HTC devices like 
> > theBlueangel(XDA IIs) & Universal (XDA exec).
>
> > Thanks,
> > /xda
--~--~-~--~~~---~--~~
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: Make an "Emergency Call"

2009-07-10 Thread Yusuf T. Mobile

I have good news for you: 
http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL
calls a number.

I also have bad news for you. The documentation at that link states,
"Note: this Intent cannot be used to call emergency numbers.
Applications can dial emergency numbers using ACTION_DIAL, however."



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.




On Jul 9, 12:22 pm, Ankit Shah  wrote:
> From my Android application I would like to make an Emergency Call
> "911".
>
> Any information on this would be greatly appreciated.
>
> Thank you.
--~--~-~--~~~---~--~~
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: AsyncTask Misbehaviours

2009-07-10 Thread Romain Guy

> You are supposed to be passing in strings to execute(), and you're not.

With varargs you can pass no value if you wish.

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

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android 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] HTC Dream G1

2009-07-10 Thread Jose Ayerdis
I don't know if this is the right forum to check this but here i go:

I just got my HTC Dream Phone (finally) but i haven't been able to configure
it i found a online manual with a option of skip the gmail account but mine
does not have.

Do you have any suggestion??? how can i do it. Can i access internet by plug
it in to my computer how??.  or if you have any other way to do it i'll be
very thanksful



PD. it does not recognise my home wireless 802.11 b/g neither

-- 
Atte

[[Jose Luis Ayerdis Espinoza]]
http://blognecronet.blogspot.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] Re: USB data acquisition

2009-07-10 Thread Disconnect

When you plug your headset in, its not a usb port at all. Its straight
analog audio. (Take a closer look, there are 10 or so pins. There is
even a pinout diagram floating around, and 3way headset adapters that
allow usb data, headset audio and charging..)

At the end of the day, usb host/guest is NOT interchangable without
hardware modifications.

There is some good news here - rumours are that the g1 has a usb-otg
capable chipset. With 'magic' bit flipping (as in, the info has to
come from htc/qualcomm) and some minor hardware hacking (5v supply,
similar to what n770/n800/n810 needs) you can get usb host working.
(That 'minor' hack may be less minor if there is a diode in the way,
since it'd require soldering onto the board instead of just building
an adapter.)

On Fri, Jul 10, 2009 at 4:16 AM, Nicholas
Radford wrote:
> The phones usb port is not a guest when I plug my headset into it.
>
> It is when I plug my computer into it, but thats less of a guest / host
> situation and more like mutual devices chattering to it each other.
>
> USB in just a serial bus at the end of the day. If one end has to be a host
> and the other a guest, this can change based on which configuration, non?
> It's not like USB are hardwired to be either host or guests, that's a
> progmatic thing, decided by the two devices in question.
>
> On Fri, Jul 10, 2009 at 7:10 AM, Tony Su  wrote:
>>
>> Unless someone can answer definitively based on the phone's technical
>> information,
>>
>> Based on observation only, it's not possible based on general USB
>> architecture. In any USB connection, one endpoint is designated the Host and
>> multiple guests can connect to that Host (IIRC theoretically 256 devices).
>>
>> Because the Phone can connect to the USB port of a computer, the computer
>> is always the Host and anything else that can connect is a Guest, so the
>> Phone's USB port is a Guest.
>>
>> A Sensor would also be a Guest so cannot connect to the Phone, it needs to
>> connect to a port configured as a Host.
>>
>> Tony
>>
>> - Original Message -
>> From: Mas 
>> Sent: Wed, 7/8/2009 12:12pm
>> To: Android Beginners 
>> Subject: [android-beginners] USB data acquisition
>>
>>
>> Hello,
>>
>> I am doing a feasibility study using an Android Dev phone. I want to
>> attach the phone using the USB cable (or the serial port) to a sensor.
>> In an application, I want to pole the sensor over the cable and have
>> the resultant value displayed on the screen. The interaction between
>> the sensor and the phone would involve the phone sending down a
>> request data byte and the sensor responding with the necessary data.
>> Is a data acquisition application of this nature possible on the
>> phone?
>>
>> Thank you for your time,
>> Mas
>>
>>
>>
>>
>
>
> >
>

--~--~-~--~~~---~--~~
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: AsyncTask Misbehaviours

2009-07-10 Thread Mark Murphy

In addition to what Romain Guy wrote, here are some other problems with
your code:

Persona wrote:
> hi, the code below was designed to display text within android (this
> is a response from the web server). But somehow the code doesn't work-
> looking at it I don't see any problem, and there are no errors
> reported. The application runs and no code is displayed.
> 
> Can somebody with greater experience uncover any problem within the
> program?



>  public class TestHttpClient extends Activity
>  {
>@Override
>   public void onCreate(Bundle icicle){
>   super.onCreate(icicle);
>   setContentView(R.layout.main);
>   new HttpConnect1().execute();
>   }
> 
>private class HttpConnect1 extends AsyncTask
>{
>   String result;
>   @Override
>   protected Void doInBackground(String...strings)

You are supposed to be passing in strings to execute(), and you're not.
Now, I am definitely fuzzy on my Java varargs, so it may be your code is
still getting executed here. But I would either switch this to Void or
pass "http://www.cnn.com"; in your execute() method above.

>   {
>   BufferedReader in = null;
>   try {
>   HttpClient client = new DefaultHttpClient();
>   HttpPost request = new 
> HttpPost("http://www.cnn.com";);
>   List postParameters = new 
> ArrayList
> ();
>   postParameters.add(new BasicNameValuePair("one",
> "valueGoesHere"));
>   UrlEncodedFormEntity formEntity = null;
>   try {
>   formEntity = new 
> UrlEncodedFormEntity(postParameters);
>   } catch (UnsupportedEncodingException e) {
>   // TODO Auto-generated catch block
>   e.printStackTrace();
>   }
>   request.setEntity(formEntity);
>   HttpResponse response = client.execute(request);

You might consider switching to BasicResponseHandler to simplify your code:

http://bit.ly/lCVgZ

>   in = new BufferedReader(new 
> InputStreamReader(response.getEntity
> ().getContent()));
>   StringBuffer sb = new StringBuffer("");
>   String line = "";
>   String NL = 
> System.getProperty("line.separator");
>   while ((line = in.readLine()) != null) {
>   sb.append(line + NL);
>   }
>   in.close();
>   result = sb.toString();
> 
>   } catch (Exception e) {
>   e.printStackTrace();
>   } finally
>   {
>   if (in != null) {
>   try {
>   in.close();
>   } catch (IOException e) {
>   e.printStackTrace();
>   }
>   }
>   }
>   return null;
>   }
>   //@Override
>   protected void onPostExecute(String result)
>   {
>   TextView tv = new TextView(TestHttpClient.this);
>   tv.setText(result);
>   }
>   }

But the big problem (besides your created-but-unused TextView) is that
you declared your class as , meaning that
onPostExecute() should take no parameters. However, your implementation
takes a String parameter. If you uncomment your @Override annotation,
you should get a compiler error pointing this out.

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

Android Development Wiki: http://wiki.andmob.org

--~--~-~--~~~---~--~~
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: USB data acquisition

2009-07-10 Thread Nicholas Radford
The phones usb port is not a guest when I plug my headset into it.

It is when I plug my computer into it, but thats less of a guest / host
situation and more like mutual devices chattering to it each other.

USB in just a serial bus at the end of the day. If one end has to be a host
and the other a guest, this can change based on which configuration, non?
It's not like USB are hardwired to be either host or guests, that's a
progmatic thing, decided by the two devices in question.

On Fri, Jul 10, 2009 at 7:10 AM, Tony Su  wrote:

>
> Unless someone can answer definitively based on the phone's technical
> information,
>
> Based on observation only, it's not possible based on general USB
> architecture. In any USB connection, one endpoint is designated the Host and
> multiple guests can connect to that Host (IIRC theoretically 256 devices).
>
> Because the Phone can connect to the USB port of a computer, the computer
> is always the Host and anything else that can connect is a Guest, so the
> Phone's USB port is a Guest.
>
> A Sensor would also be a Guest so cannot connect to the Phone, it needs to
> connect to a port configured as a Host.
>
> Tony
>
> - Original Message -
> From: Mas 
> Sent: Wed, 7/8/2009 12:12pm
> To: Android Beginners 
> Subject: [android-beginners] USB data acquisition
>
>
> Hello,
>
> I am doing a feasibility study using an Android Dev phone. I want to
> attach the phone using the USB cable (or the serial port) to a sensor.
> In an application, I want to pole the sensor over the cable and have
> the resultant value displayed on the screen. The interaction between
> the sensor and the phone would involve the phone sending down a
> request data byte and the sensor responding with the necessary data.
> Is a data acquisition application of this nature possible on the
> phone?
>
> Thank you for your time,
> Mas
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: USB data acquisition

2009-07-10 Thread Tony Su

Unless someone can answer definitively based on the phone's technical 
information,

Based on observation only, it's not possible based on general USB architecture. 
In any USB connection, one endpoint is designated the Host and multiple guests 
can connect to that Host (IIRC theoretically 256 devices).

Because the Phone can connect to the USB port of a computer, the computer is 
always the Host and anything else that can connect is a Guest, so the Phone's 
USB port is a Guest.

A Sensor would also be a Guest so cannot connect to the Phone, it needs to 
connect to a port configured as a Host.

Tony

- Original Message -
From: Mas 
Sent: Wed, 7/8/2009 12:12pm
To: Android Beginners 
Subject: [android-beginners] USB data acquisition


Hello,

I am doing a feasibility study using an Android Dev phone. I want to
attach the phone using the USB cable (or the serial port) to a sensor.
In an application, I want to pole the sensor over the cable and have
the resultant value displayed on the screen. The interaction between
the sensor and the phone would involve the phone sending down a
request data byte and the sensor responding with the necessary data.
Is a data acquisition application of this nature possible on the
phone?

Thank you for your time,
Mas



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