[android-beginners] Re: How does emulator manage to install all the applications?

2009-03-10 Thread David Turner
On Tue, Mar 10, 2009 at 4:48 AM, ramakrishna
mramakrishnapra...@gmail.comwrote:

 Hii David,

 Its nice to meet u...Can you please mail me the google maps apk file if u
 have it?


I will not do that. If you want the .apk, you should download the SDK and
abide to its end-user license, which as far as I know
forbids reverse engineering and redistributions of certain proprietary
binaries (which the Google Maps application is probably
part of). The SDK will allow you to develop applications that use the Google
Maps API, some people also use it to run the
application on real hardware too.

If you're interested in distributing the application in one of your
products, you should contact someone else at Google,
since I can't help you and this is a forum for people developing Android
applications.


 It will be of great help for me if anyone can share me the .apk file of
 google maps application.




 Thanks,
 Ramakrishna.

 On Tue, Mar 10, 2009 at 1:01 AM, David Turner di...@android.com wrote:

 the applications are pre-installed in the read-only /system partition.the
 Google Maps source code is not available. the corresponding .apk should be
 somewhere under / though.


 On Mon, Mar 9, 2009 at 6:35 PM, Ramakrishna mramakrishnapra...@gmail.com
  wrote:


 Hi everybody,

 I just wanna know how Android emulator manages to install
 all the applications by default when it is started. And moreover i was
 searching for Google maps source code or atleast the .apk file for
 that application in the emulator.  Any kind of help will be of great
 help to me.

 Thanks,
 Ramakrishna.







 --
 Best Regards,
 M.Rama Krishna Prasad,
 ST Microelectronics,Bangalore
 Ph No:09008718152


 


--~--~-~--~~~---~--~~
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: Problem with textview in a Dialog

2009-03-10 Thread Chavepeyer Geoffrey

So, I've created a test case but still encounter the same problem:

package be.geoc.DialogTest;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

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

Button b = (Button) findViewById(R.id.Button01);

b.setOnClickListener(new View.OnClickListener(){

public void onClick(View arg0) {
Dialog d = new Dialog(Dialog_Test.this);
d.setContentView(R.layout.meeting_detail);


TextView tv = (TextView) findViewById(R.id.TextView01);
System.out.println(tv);
tv.setText(TEST);

d.show();

}

});
}
}

And the 2 xml layout files :
main.xml :

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=@string/hello android:id=@+id/TextView/
Button android:id=@+id/Button01 android:layout_width=wrap_content
android:layout_height=wrap_content android:text=Ouvrir le dialog/
Button
/LinearLayout


and meeting_detail.xml :

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent


TextView android:id=@+id/TextView01
android:layout_width=wrap_content
android:layout_height=wrap_content/TextView
/LinearLayout


Is anyone able to help me ?
Thanks a lot !!!

Geoffrey
--~--~-~--~~~---~--~~
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] EditText appearance

2009-03-10 Thread Mr.No

Hello,
how do i change the size, style, typeface of a hint?
If the EditText gains the focus the border-color changes to orange,
how do i set a other color?

rgds
   Mr.No
--~--~-~--~~~---~--~~
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: Filling a large database causes crash

2009-03-10 Thread Mark Murphy

NFSpeedypur wrote:
 I am trying to on first start up fill up a sql database with the
 default values.  This database is around 9000 entries and it is
 causing the app to go over the 16MB heap.  I am trying to find a way
 to do this so that it will not cause this over flow.
 
 At the moment I am running the 9000 inserts, 1 after another in a
 thread.  Are there any other suggestions?

Use transactions. The heap problem is probably due to SQLite holding
everything in transaction buffers. You might, say, do a transaction for
every 100 entries or so.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~-~--~~~---~--~~
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 save and restore database

2009-03-10 Thread SLY

Hi,
Can anyone please tell me how to save existing database to sd card and
then later read from that file ?
Here's what I want. I have created an application which writes to the
db (sqlite) as and when the user enters data through a form page. I
want to make an option to save existing database to a file on sd card,
so that the user can do a restore from that saved database file. Once
the user has saved the database the data persists even after the
application has been uninstalled from the device, so that after he re-
installs the application the old database is persistent and he can
restore data from that file.

I do not want to read and write to it every time the user saves new
data. I want it do save or restore on user demand.

I have not worked with files yet, so I do not have any clue as to how
it can be done.
I would really help me if someone can give me some pointers or a
sample application which does the same.

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] Fetching and Storing Images

2009-03-10 Thread Joseph Arceneaux
Greetings,
I am trying to fetch and cache a number of thumbnail images - about 80 - to
the device.  It appears I can get the bitstream through the usual HttpGet
and HttpDefaultClient methods, but once I have the bits, what is the correct
way to store the image?

- SD Card
- SQLite
- filesystem

Any suggestions for the nominal way of handling this would be appreciated.

Joe

--~--~-~--~~~---~--~~
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 do you detect target platform characteristics?

2009-03-10 Thread Mark Rosenberg

Is there an API for interrogating the handset for physical and
operating characteristics such as number/type of buttons, QWERTY,
accelerometer, screensize, etc. Is there any minimum set of features
that Android apps can assume to be present on a handset?

--~--~-~--~~~---~--~~
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] Hello world !

2009-03-10 Thread Mallikarjuna

Hello world

--~--~-~--~~~---~--~~
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] Could not find HelloWorld.apk

2009-03-10 Thread sddandroid

I got past my previous problem.  It was actually as simple as clearing
the Error Console in Eclipse and recompiling the app but now I'm
getting this problem...

I looked on Google and it seems that the people that are having the
problem solved it but no one provides an actual solution to their
problem.  Anyone else have any ideas?

--~--~-~--~~~---~--~~
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] Linux Eclipse Error

2009-03-10 Thread sddandroid

I am working on a Linux setup in Eclipse.  I have downloaded and
installed Eclipse 3.4.1, APT, and the most recent SDK.  I am trying to
run the Hello World app on the developers site and I receive the
following error...

Error executing aapt. Please check aapt is present at /usr/share/
android-sdk-linux_x86-1.1_r1/tools/aapt

I have added the path to the SDK inside Preferences and my best
confirmation of this is that auto complete is working and there are no
other errors beyond this one.  I have tried to set permissions on aapt
to 777 and an ls -alsh confirms that there are indeed sufficient
privileges to the application (which I am already running from the
root account with elevation).

Are there any other things that I need to be checking???  I'm sure it
is the simplest mundane thing that I am missing and at this point I
could use a little insight.

--~--~-~--~~~---~--~~
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] Checking Internet Connection

2009-03-10 Thread Android Beginners

Hi,

How can I check the Internet Connection? I need also the same with the
GPS signal... I am developing an app that needs to be persistently
connected to the Internet and I need something like a Listener. Should
I create my own Listener or there is something implemented?

Thank you 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] Synchronized Statements In Lunar Lander Sample

2009-03-10 Thread skineh

Hi everyone!  I'm new to both the SDK and Java in general (coming from
a Flash dev background), and I had a quick question regarding the
Lunar Lander sample code:

I was just wondering why synchronized statements are used in all of
the methods in the LunarThread when it's the only thread ever in use
in the activity.  Looking solely at the code for the Lunar Lander
game, it doesn't look like you'd need intrinsic locks.

I'm following all of the examples and the (well laid out)
documentation on the SDK fairly well, but the sychronization in that
thread has me confused.  As a novice, it looks like it's unecessary to
me, and I was hoping someone could clarify why it's been done.  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: Checking Internet Connection

2009-03-10 Thread Jean-Baptiste Queru

http://developer.android.com/reference/android/net/ConnectivityManager.html
might be what you're looking for.

JBQ

On Tue, Mar 10, 2009 at 4:03 AM, Android Beginners
albert.hernan...@gmail.com wrote:

 Hi,

 How can I check the Internet Connection? I need also the same with the
 GPS signal... I am developing an app that needs to be persistently
 connected to the Internet and I need something like a Listener. Should
 I create my own Listener or there is something implemented?

 Thank you in advance.

 




-- 
Jean-Baptiste M. JBQ Queru
Android Engineer, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

--~--~-~--~~~---~--~~
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: Linux Eclipse Error

2009-03-10 Thread Xavier Ducrohet

Are you running a 64bit installation? If so, at the bottom of
http://developer.android.com/sdk/1.1_r1/installing.html there are some
linux installation notes.
Did you follow them?

Xav

On Mon, Mar 9, 2009 at 8:14 PM, sddandroid sddm...@gmail.com wrote:

 I am working on a Linux setup in Eclipse.  I have downloaded and
 installed Eclipse 3.4.1, APT, and the most recent SDK.  I am trying to
 run the Hello World app on the developers site and I receive the
 following error...

 Error executing aapt. Please check aapt is present at /usr/share/
 android-sdk-linux_x86-1.1_r1/tools/aapt

 I have added the path to the SDK inside Preferences and my best
 confirmation of this is that auto complete is working and there are no
 other errors beyond this one.  I have tried to set permissions on aapt
 to 777 and an ls -alsh confirms that there are indeed sufficient
 privileges to the application (which I am already running from the
 root account with elevation).

 Are there any other things that I need to be checking???  I'm sure it
 is the simplest mundane thing that I am missing and at this point I
 could use a little insight.

 




-- 
Xavier Ducrohet
Android Engineer, Google.

--~--~-~--~~~---~--~~
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: Linux Eclipse Error

2009-03-10 Thread Mike Garcia
I managed to get it working. The problem just turned out being that my cache
wasn't clearing in eclipse (fedora 10 distro) which I am filing with fedora
to get it fixed. Thanks though.

On Mar 10, 2009 5:09 PM, Xavier Ducrohet x...@android.com wrote:


Are you running a 64bit installation? If so, at the bottom of
http://developer.android.com/sdk/1.1_r1/installing.html there are some
linux installation notes.
Did you follow them?

Xav

On Mon, Mar 9, 2009 at 8:14 PM, sddandroid sddm...@gmail.com wrote:   I
am working on a Linux s...
Xavier Ducrohet
Android Engineer, Google.

--~--~-~--~~~---~--~~ You received this
message because you are sub...

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

2009-03-10 Thread sync qa2
Fygdfhgxzfg

On Jan 5, 2009 9:39 AM, Mark Murphy mmur...@commonsware.com wrote:

Apparao Mulpuri wrote:  I am newbie to android development. I have
experience in Apple Mac and  i...
If you are not familiar with Java, you probably should learn that first
outside the Android environment. There are numerous Java educational
resources, from free online tutorials to books like _Head First Java_.

To learn Android, there is a tutorial or two on the Android site
(http://code.google.com/android/). Beyond that, there are numerous
tutorials published on various blogs, at least five books, and so on.
You can find links to Android-related books at the Android Programming knol:

http://knol.google.com/k/mark-murphy/android-programming

--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.9 Published!

--~--~-~--~~~---~--~~ You received this
message because you are sub...

--~--~-~--~~~---~--~~
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 a button from an image (PNG)

2009-03-10 Thread xspotlivin

Can you layer different views and/or layouts on top of each other? I
thought maybe I could use a ViewGroup with an absolute layout for the
buttons and my custom ClockView. Can you put the absolute layout with
a transparent background on top of the ClockView?

On Mar 9, 11:15 pm, xspotlivin dmbrown2...@gmail.com wrote:
 Ok, thanks for the replies. I'm going to describe what I'm trying to
 do better, because I'm still unsure of the solution, and I could
 really use some help.

 I have a clock application (how can you attache an image). For each
 shaded region I want to place abuttonon top of it (a differentbuttondepending 
 on some xml data). I don't know how to create abuttonfrom the attached image 
 and then draw it in the correct spot.
 My xml data has the time of the shaded region, so I can figure out
 what angle to put thebutton. Below is the relevant code from my
 ClockView class. The for loop is looping through each element in an
 xml document (which I pass from the activity class).

 Java:
 public class ClockView extends View {

  protected Document clockXML;

  public ClockView(Context context) {
   super(context);
   this.setBackgroundDrawable(getResources().getDrawable
 (R.drawable.clockbackgroundwithoutnames));

  }
  @Override
  protected void onDraw(Canvas canvas) {

   // Clock-size rectangle to draw compliance windows
   RectF clockRect = new RectF(86, 6, 394, 314);

   // Create a node list containing each reminder
   NodeList reminderNodes = this.clockXML.getElementsByTagName
 (Reminder);
   int reminderLength = reminderNodes.getLength();

   // Loop through each reminder drawing compliance windows
   for (int i=0; i  reminderLength; i++) {
String timeScheduledString = reminderNodes.item
 (i).getFirstChild().getFirstChild().getNodeValue();
float timeScheduled = Float.valueOf
 (timeScheduledString.trim());
String complianceWindowString = reminderNodes.item
 (i).getFirstChild().getNextSibling().getFirstChild().getNodeValue();
float complianceWindow = Float.valueOf
 (complianceWindowString.trim());
String administered = reminderNodes.item
 (i).getFirstChild().getNextSibling().getNextSibling().getFirstChild
 ().getNodeValue().trim();

float compStartAngle = -90 + ((timeScheduled*360)/24) -
 (complianceWindow*15);
float complianceSweepAngle = (complianceWindow*2)*15;

// If we are in the daytime.
if (compStartAngle  90  compStartAngle = -90) {
 // If a reminder is scheduled in the daytime, but
 window overlaps into the night.
 if ((compStartAngle + complianceSweepAngle)  90)
 {
  // Compute new angles and sweeps
  float startAngle1 = compStartAngle;
  float sweepAngle1 = 90 - startAngle1;
  // Draw for daytime
  canvas.drawArc(clockRect, startAngle1,
 sweepAngle1, true, this.amColor);
  float sweepAngle2 = complianceSweepAngle -
 sweepAngle1;
  // Draw for nighttime
  canvas.drawArc(clockRect, 90, sweepAngle2,
 true, this.pmColor);
 // Else, just draw normally.
 } else {
  canvas.drawArc(clockRect, compStartAngle,
 complianceSweepAngle, true, this.amColor);
 }
// If we are in the nighttime
} else if (compStartAngle = 90) {
 // If a reminder is scheduled in the nighttime,
 but window overlaps into the day.
 if ((compStartAngle + complianceSweepAngle)  270)
 {
  // Compute new angles and sweeps
  float startAngle2 = compStartAngle;
  float sweepAngle3 = 270 - compStartAngle;
  // Draw for nighttime
  canvas.drawArc(clockRect, startAngle2,
 sweepAngle3, true, this.pmColor);
  float sweepAngle4 = complianceSweepAngle -
 sweepAngle3;
  // Draw for daytime
  canvas.drawArc(clockRect, 270, sweepAngle4,
 true, this.amColor);
 // Else, just draw normally.
 } else {
  canvas.drawArc(clockRect, compStartAngle,
 complianceSweepAngle, true, this.pmColor);
 }
// If a reminder is scheduled in the early daytime, but
 window overlaps into the nighttime (backwards)
} else {
 // Compute new angles and sweeps
 float startAngle3 = compStartAngle;
 float sweepAngle5 = -90 - compStartAngle;
 // Draw for nighttime
   

[android-beginners] Different UI based on orientation

2009-03-10 Thread dutch

Not sure if this is been answered (I searched). I am working on an app
that should have a different look depending on the orientation (i.e.
if the keyboard is opened). Specifically, certain buttons I put in the
UI should disappear when the keyboard is opened, since the keyboard
will be used for that.
How can this be done in the code? Do I need 2 different XML files for
the layout and somehow swap between the two?

--~--~-~--~~~---~--~~
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] Intercepting web browser clicks

2009-03-10 Thread Kevin

Hi All,

I have an interesting problem: I'd like to create a background service
that can somehow detect/intercept/keep track of user clicks on the
phone's internet browser. I was wondering if this is even possible. I
know you can overwrite your own WebView to get this information, but
given that the phone's browser and my service are completely different
applications, I doubt that the service can get any information about
the browser's clicks.

If you're wondering why I want to do this, it's because I'm doing a
research project at school.

Thanks,
Kevin

--~--~-~--~~~---~--~~
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: Very Basic question regarding Activities

2009-03-10 Thread Kaka

Hi,

I also have a basic problem? How could I share a object reference,
e.g., a class instance, between two activities. In the Bundle's member
methods, no method support putting object reference.

Thanks

On Feb 15, 10:57 pm, Tote tot...@gmail.com wrote:
 Typically you call your current activity's startActivity() method to
 switch to another activity. That method can accept an instance of
 Intent class, which in turn enables you to put some data in the intent
 object before you call startActivity. Check out the documentation of
 Bundle class and you'll see that it's got a lot of put... methods (and
 the corresponding get... methods, too). So for example you could call
 putIntArray method which adds an int array to the bundle. E.g.:

 int[] ia = {1, 2, 3};

 Intent i = new Intent();
 Bundle b = i.getExtras();
 b.putIntArray(myIntArray, ia);
 startActivity(i, MyActivity2.class);

 Similarly, on the receiving end you can use getIntArray to get your
 data. The disadvantage of this solution is that whenever the data
 changes on one end you've got to update the other end, too, because it
 doesn't happen automatically.

 Another approach would be to use a singleton to store information that
 shall survive activity changes. In this case both ends access the same
 information and since no two activities can live at the same time you
 don't even need to bother with synchronization issues.

 On Feb 15, 11:58 am, madcoder paperga...@gmail.com wrote:

  Could you give a more detailed example - I too would like to see how
  an array (of ints, for example) can be accessed in activity 2 from
  activity one.  As it is now, I'm loading that data every time I start
  a new activity - and it's quite slow!

  Thanks

  On Feb 14, 7:32 pm, Ganesan V ganesan.v...@gmail.com wrote:

   U can use Indent class of MyActivity from MyActivity2.

   Ganesh.

   On Sat, Feb 14, 2009 at 2:05 AM, Alex55 aroch...@gmail.com wrote:

Hello guys,

I have a very basic question regarding Activities in Android.

Can I share data types a cross Activities in Android?

Let's say I have 2 activities, MyActivity.java and MyActivity2.java. I
have declared some Strings and Arrays on MyActivity that I would like
to access from MyActivity2, is this possible? If so, how can I
accomplish this?

I know its a very basic question, but believe it or not I've had a
hard time figuring this one out!

Many thanks for your prompt response,

Alex



--~--~-~--~~~---~--~~
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: Checking Internet Connection

2009-03-10 Thread Jon Phenow
You might also try and be careful. It seems that many applications on many
hand-held devices, if they are attempting to have a persistent connection
with anything such as GPS or internet will drain a battery fast. I realize
these devices are getting better at handling such demanding applications but
just something to keep in mind. Possibly look for a way to have retrieve
information from the internet/GPS when you know it is needed.

On Tue, Mar 10, 2009 at 1:55 PM, Jean-Baptiste Queru j...@android.comwrote:


 http://developer.android.com/reference/android/net/ConnectivityManager.html
 might be what you're looking for.

 JBQ

 On Tue, Mar 10, 2009 at 4:03 AM, Android Beginners
 albert.hernan...@gmail.com wrote:
 
  Hi,
 
  How can I check the Internet Connection? I need also the same with the
  GPS signal... I am developing an app that needs to be persistently
  connected to the Internet and I need something like a Listener. Should
  I create my own Listener or there is something implemented?
 
  Thank you in advance.
 
  
 



 --
 Jean-Baptiste M. JBQ Queru
 Android Engineer, Google.

 Questions sent directly to me that have no reason for being private
 will likely get ignored or forwarded to a public forum with no further
 warning.

 


--~--~-~--~~~---~--~~
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: Copy File to file system

2009-03-10 Thread Justin Allen Jaynes

I am trying to do the same thing.  And I can successfully copy a text
file over.

But when I use a sqlite3 db file (either one I pulled off android
emulator data directory or one I made on my desktop machine), I throw
an exception.

Every time I run the read method on a the steam from the db file, I
get an java.io.IOException with no details.  Why is this?

I've done some reading and I understand that binary files and unicode
files must be read differently (1 byte versus 2 bites for unicode),
but I thought that readers were for unicode and inputstreams were for
binary.  Still, I tried using readers and that didn't work either.

The following code works perfectly to copy a file named textfile.txt
from my raw resource folder.  However, when I switch the text file for
an actual myapp.db file (even if I try using the same name as the text
file), I get an exception.  If I comment out the while loop, the error
goes away.  And it's the read that has the problem.  If I comment out
just the write line, I still throw an excpetion.

private void copyDataBase() throws IOException{

//Path to the just created empty db, which I carefully closed so I
have safe write access
OutputStream databaseOutputStream = new FileOutputStream(/data/
data/com.mydomain.myapp/databases/myapp.db);
InputStream databaseInputStream =
databaseOpenHelperContext.getResources().openRawResource
(R.raw.textfile);

byte[] buffer = new byte[1];
int length;
while ( (length = databaseInputStream.read(buffer))  0 ) {
databaseOutputStream.write(buffer);
Log.w(Bytes: , ((Integer)length).toString());
Log.w(value, buffer.toString());
}

//Close the streams
databaseOutputStream.flush();
databaseOutputStream.close();
databaseInputStream.close();
 }


On Feb 11, 12:49 pm, Mark Murphy mmur...@commonsware.com wrote:
 Anders wrote:
  I have a simple problem. I want to put a file into my applications
  apk, and upon installation I would like to copy this file into the
  device filesystem. Does anyone know how to do this?

 Package the file as a raw resource. Get an input stream for the
 resource. Get an output stream for your destination file. From there,
 it's a standard Java I/O copy operation:

 http://www.exampledepot.com/egs/java.io/CopyFile.html

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

 Android Training on the Ranch! -- Mar 16-20, 
 2009http://www.bignerdranch.com/schedule.shtml

--~--~-~--~~~---~--~~
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] Intents and Activities

2009-03-10 Thread Lovedumplingx

Don't know if this went through last time so I'll post again


So I'm still working to get the paradigm down.

Activities are related to screens and everything you want a user to
see needs to be part of an activity.  But what's with the Intent?  Are
all intents tied to an activity?

I thought I had read that Intents were more like events.  If that's
the case cool...but I'm really struggling on where Intents fit into
the whole concept.

--~--~-~--~~~---~--~~
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: Copy File to file system

2009-03-10 Thread Justin Allen Jaynes

I am trying to do the same thing but with a database file.  And I can
successfully copy a text file to the data directory.

But when I use a sqlite3 db file (either one I pulled off android
emulator data directory or one I made on my desktop machine), I throw
an exception.

Every time I run the read method on a the steam from the db file, I
get an java.io.IOException with no details.  Why is this?

I've done some reading and I understand that binary files and unicode
files must be read differently (1 byte versus 2 bites for unicode),
but I thought that readers were for unicode and inputstreams were for
binary.  Still, I tried using readers and that didn't work either.

The following code works perfectly to copy a file named textfile.txt
from my raw resource folder.  However, when I switch the text file for
an actual myapp.db file (even if I try using the same name as the text
file), I get an exception.  If I comment out the while loop, the error
goes away.  And it's the read that has the problem.  If I comment out
just the write line, I still throw an excpetion.

Is there something different about this file type that won't allow me
to read a stream from it as I am doing?

private void copyDataBase() throws IOException{

//Path to the just created empty db, which I carefully closed so I
have safe write access
OutputStream databaseOutputStream = new FileOutputStream(/data/
data/com.mydomain.myapp/databases/myapp.db);
InputStream databaseInputStream =
databaseOpenHelperContext.getResources().openRawResource
(R.raw.textfile);

byte[] buffer = new byte[1];
int length;
while ( (length = databaseInputStream.read(buffer))  0 ) {
databaseOutputStream.write(buffer);
Log.w(Bytes: , ((Integer)length).toString());
Log.w(value, buffer.toString());
}

//Close the streams
databaseOutputStream.flush();
databaseOutputStream.close();
databaseInputStream.close();
 }

On Feb 11, 12:49 pm, Mark Murphy mmur...@commonsware.com wrote:
 Anders wrote:
  I have a simple problem. I want to put a file into my applications
 apk, and upon installation I would like tocopythis file into the
 devicefilesystem. Does anyone know how to do this?

 Package the file as a raw resource. Get an input stream for the
 resource. Get an output stream for your destination file. From there,
 it's a standard Java I/Ocopyoperation:

 http://www.exampledepot.com/egs/java.io/CopyFile.html

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

 Android Training on the Ranch! -- Mar 16-20, 
 2009http://www.bignerdranch.com/schedule.shtml

--~--~-~--~~~---~--~~
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] Intents and Activities

2009-03-10 Thread Lovedumplingx

Accidentally posted this in the wrong area


So I'm still working to get the paradigm down.

Activities are related to screens and everything you want a user to
see needs to be part of an activity.  But what's with the Intent?  Are
all intents tied to an activity?

I thought I had read that Intents were more like events.  If that's
the case cool...but I'm really struggling on where Intents fit into
the whole concept.

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

2009-03-10 Thread frizzo

The system in place to pass information between the screens... I am
confused why the team chose to reinvent the wheel via the putExtras
methods.  Instead of making the transport objects inherit from
Parcelable and the like, why not just use Java's OO strength and set
objects to Activities themselves.  For instance, like this:


class Caller extends Activity {
   public on buttonClick() {
  ThisScreen ts = new ThisScreen();
  ts.SetCustomValue(10);

  startActivity(ts)
   }
}

class ThisScreen extends Activity {
   public void onCreate() {
   txtBox.setText(Integer.toString(i));
   }

   public void SetCustomValue (int i) {
...
   }
}

Instead we are having to unnecessarily learn new concepts.  Was there
a compelling reason to implement it they it's implemented that I am
not seeing?

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