[android-developers] Re: Good example for showing exchanging of data mostly arrays or non premitive data types,objects

2008-03-26 Thread Amos

Hi Raja,

I think the following thread provides good info (although it's become
a bit long): 
http://groups.google.com/group/android-developers/browse_thread/thread/9632cb52888ef6db/9287a1a6a24ea577

Assuming you want to pass Objects between Activities in the *same*
application (i.e. same process), I believe that passing the Object
reference is better than Parceling it using the Intent Extras
mechanism (passing a pointer is obviously more efficient than
parceling/unparceling an object).
If the objects you are passing are relatively lightweight and few in
numbers - the performance difference is probably negligible.
If you want 2 activities to manipulate the *same* object and not 2
different copies of the same object - then you have to pass an object
reference between activities.

I faced this problem pretty early in my development effort, and came
up with the following mechanism:

I created a class called ReferencePasser that wraps a HashMap of
Objects, with Long keys. I have an instance of ReferencePasser
available to all Activities (as a public static field somewhere, or
through the Application object).

When an activity wants to pass an object to another activity, it adds
the object to ReferencePasser and gets a long key as a result. It then
passes this object key to the activity it is starting as an extra,
using some agreed-upon String key. When the called activity is
created, it retrieves the object key from its intent extras, and gets
the object reference from reference passer. It can then remove the
object from ReferencePasser to keep its Map small.

This approach has been working great for me so far, although obviously
it is limited to a single application process.
I'll attach sample code in the next thread.

Hope this helps,

Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Good example for showing exchanging of data mostly arrays or non premitive data types,objects

2008-03-26 Thread Amos

Here is the sample code for passing Object references between
activities:

I have a class called ReferencePasser, which wraps a HashMap:

import java.util.HashMap;

/**
 * @author Amos
 * Maps Objects to keys.
 * The keys are generated automatically on insertion (based on a
running index).
 * Useful for passing references to objects.
 */
public class ReferencePasser {
private HashMap _objects;
private long _nextKey;

public ReferencePasser() {
_objects = new HashMap();
_nextKey = 1;
}

/**
 * Adds the given object to the map.
 * @param o
 * @return the key of object inserted.
 */
public long put(Object o) {
long key = _nextKey++;
_objects.put(Long.valueOf(key), o);
return key;
}

/**
 * @param key
 * @return the object with the given key, or null if 
key doesn't
exist in
 * the map.
 */
public Object get(long key) {
return _objects.get(Long.valueOf(key));
}

/**
 * Removes the object mapped to the given key from the 
map.
 * @param key
 */
public void remove(long key) {
_objects.remove(Long.valueOf(key));
}
}

Access to a single instance of ReferencePasser is achived through this
class:

public class GlobalStuff {
private static ReferencePasser _passer;

/**
 * Returns the application's ReferencePasser, which is 
useful for
passing
 * references to complex objects between Activities 
and/or
Services.
 * @return
 */
public static ReferencePasser getReferencePasser() {
if (_passer == null)
_passer = new ReferencePasser();
return _passer;
}
}

Here's a sample for an activity that wants to send an object to
another activity:

public class SourceActivity extends Activity {
...

private void startTargetActivity(SomeObject myObject) {
ReferencePasser passer = 
GlobalStuff.getReferencePasser();
long objectKey = passer.put(myObject);
Intent intent = new Intent(this, 
TargetActivity.class);
intent.putExtra("com.myapp.blabla", objectKey);
startActivity(intent);
}

...
}

And here's how the called activity gets the object that was passed to
it:

public class SourceActivity extends Activity {
protected void onCreate(Bundle icicle) {
//remember to handle null values, which I don't 
do here
long objectKey = 
getIntent().getLongExtra("com.myapp.blabla", 0);
ReferencePasser passer = 
GlobalStuff.getReferencePasser();
SomeObject passedObject = (SomeObject) 
passer.get(objectKey);
passer.remove(objectKey) //if I don't need the 
object reference
anymore

...
}

...
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to associate my App with a file extension in the Browser

2008-03-26 Thread Amos

Hi,

I would like to implement the following scenario:

When a user browses a web page with Browser and clicks a link with a
special file extension (which is unique to my application, such as
"www.mysite.com/somefile.xxx"), that file will be downloaded and then
my application launched to view the downloaded file.

I'd like the browser to handle the file download if possible, and when
it's done start one of my activities and provide the  file to it.

This is desktop behavior and I'm not sure it conforms to the Android
intent/content provider way of doing things - but this is what I'd
like to happen.

Any ideas or pointers?

Thanks in advance,

Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to associate my App with a file extension in the Browser

2008-03-26 Thread Amos

Thanks for your reply, Dianne!

I'll register my Activity like you specified.

But how will I be able to access the downloaded file. Will it be
downloaded to a temp location and have global read permission set on
it? How will the file's path be passed to me using the Intent sent by
the browser?

Many thanks,

Amos

On Mar 26, 7:02 pm, hackbod <[EMAIL PROTECTED]> wrote:
> All of Android's file mappings are based on MIME types.  As long as
> your web server is returning the correct MIME type, you can implement
> an activity that says it knows how to VIEW that MIME type and it will
> be launched when the user clicks on such a file after downloading it.
>
> On Mar 26, 3:34 am,Amos<[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I would like to implement the following scenario:
>
> > When a user browses a web page withBrowserand clicks a link with a
> > special file extension (which is unique to my application, such as
> > "www.mysite.com/somefile.xxx"), that file will be downloaded and then
> > my application launched to view the downloaded file.
>
> > I'd like thebrowserto handle the file download if possible, and when
> > it's done start one of my activities and provide the  file to it.
>
> > This is desktop behavior and I'm not sure it conforms to the Android
> > intent/content provider way of doing things - but this is what I'd
> > like to happen.
>
> > Any ideas or pointers?
>
> > Thanks in advance,
>
> >Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to associate my App with a file extension in the Browser

2008-04-01 Thread Amos

Hi,

I've been working on this today and haven't managed to make it happen
yet.
I registered an intent-filter for an activity in my
AndroidManifest.xml like this:







When I click a link from the browser to a ".zzz" file with a content-
type value "myapp/zzz" (I verified this by looking at the headers of
the server response) I get 2 kinds of errors:

1. A dialog box saying: "Error. Unable to download file as content
type is not supported"
the logcat trace for this is:

INFO/ActivityManager(518): Starting activity: Intent
{ action=android.intent.action.VIEW data=http://www.mysite.com/
myfile.zzz comp={com.google.android.browser/
com.google.android.browser.BrowserActivity} }
DEBUG/browser(3255): *-* Start browser instrument
VERBOSE/favicons(3255): Starting load with icon 0x0 for
http://www.mysite.com/myfile.zzz
DEBUG/(3255): removing file '/sdcard/download/myfile.zzz-part'

2. An uncaught exception displayed as a dialog box giving the "Unable
to add window" error. logcat trace is:
WARN/WindowManager(518): Attempted to add application window with
unknown token HistoryRecord{402d80b0 {com.google.android.browser/
com.google.android.browser.BrowserActivity}}.  Aborting.
DEBUG/dalvikvm(3572): Exception Landroid/view/WindowManager
$BadTokenException; from ViewRoot.java:186 not caught locally
DEBUG/dalvikvm(3572): Exception Landroid/view/WindowManager
$BadTokenException; from ZygoteInit.java:1553 not caught locally
DEBUG/AndroidRuntime(3572): Shutting down VM
WARN/dalvikvm(3572): threadid=3: thread exiting with uncaught
exception (group=0x4000fdf8)
ERROR/AndroidRuntime(3572): Uncaught handler: thread Main exiting due
to uncaught exception
...

Apparently, the second error happens after I clear the browser cache,
and from that point I get the first error.
Seems like the intent for the mime type I specified is not found -
although I'm not sure.

Perhaps I should mention that I managed to get my activity fired by
registering a scheme in an intent filter using:






but this means I need to handle the file download myself (not much of
a problem), but worse, that this is a very proprietary kind of URI
scheme that I think is good to avoid.

Any ideas?
Anyone managed to get their activities launched by the browser after
downloading a file using a mimeType intent-filter?

Thanks!

Amos.

P.S.
I'm using m5-rc15.

On Mar 27, 7:15 pm, "Jean-Baptiste Queru" <[EMAIL PROTECTED]> wrote:
> To be perfectly honest here, I'm not familiar with Java Web Start (I had
> never heard of it before), and therefore I'll have a hard time comparing
> it to the capabilities I'm working on. Because of that, and because it's
> not available yet, I'd rather not speculate on what might or might not
> happen.
>
> JBQ
>
> On Thu, Mar 27, 2008 at 7:32 AM, Anil <[EMAIL PROTECTED]> wrote:
>
> >  Will you be developing something similar to Java Web Start for
> >  distribution?
> >  -
> >  Anil
>
> >  On Mar 26, 8:57 pm, "Jean-Baptiste Queru" <[EMAIL PROTECTED]> wrote:
> >  > Hello, I'm the Google engineer who works on that area of Android.
>
> >  > Indeed, the download system is still under development, and you can 
> > expect
> >  > to see changes there at some point.
>
> >  > The two key aspects that you need to know is that:
> >  > -the MIME type is what matters. The URI extension is not relevant in 
> > this case.
> >  > -in order for the files to be downloaded and for your app to be 
> > launched, your
> >  > application needs to register as a viewer the MIME type of your files
> >  > (Intent.VIEW_ACTION).
>
> >  > There's a high probability that in the long run the files downloaded 
> > from the
> >  > browser will be saved on the SD card (which the emulator can emulate).
> >  > However, I am not sure what the exact behavior is in the currently 
> > available
> >  > SDKs.
>
> >  > (For what it's worth, at the implementation level, there's indeed going 
> > to be
> >  > some code that involves some content providers and some permissions, but
> >  > at your level you don't need to worry about that, that's only used by the
> >  > browser to manage its downloads).
>
> >  > JBQ
>
> > > On Wed, Mar 26, 2008 at 5:52 PM, hackbod <[EMAIL PROTECTED]> wrote:
>
> >  > >  This stuff is still under development, but I believe right now it is
> >  > >  downloaded into a content provider that anyone can access.  In the

[android-developers] Starting my application from browser using MIME Type Intent

2008-04-02 Thread Amos

Hello,

I'm trying to make the browser start my application after a file with
a specific MIME content type is downloaded.
I've followed some hints and tips from the forum - but have not
succeeded so far.

>From the errors I'm getting I'm not sure if I'm doing something wrong
- or if this feature is fully supported already.

My Intent Filter is:








Has anyone managed to do something similar in m5-rc15?

Thanks!

Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Starting my application from browser using MIME Type Intent

2008-04-06 Thread Amos

Thanks for your help, baldmountain!

I saw your group thread about this issue as well. Too bad this feature
doesn't work - it's very important to me as I'm sure to many others.

Following your reply, I'm going to stop working on this issue and try
to find a workaround, as I understand it is an inherent limitation of
the current SDK. If anyone has any updates on this issue - they will
be most welcomed!


On Apr 3, 2:25 pm, baldmountain <[EMAIL PROTECTED]> wrote:
> I managed to get a bit farther. My intent filter looks like:
>
> 
>
> You can see it is commented out. It causes the browser to crash. I
> submitted a bug for this.  See issue 341 in the issue tracker. It was
> marked "Future Release".
>
> Oh, you'll also need to create an sdcard for downloads and the sdcard
> should have a directory named download. But until this is implemented
> your activity isn't going to get launched.
>
> On Apr 2, 2:37 pm, Amos <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I'm trying to make the browser start my application after a file with
> > a specific MIME content type is downloaded.
> > I've followed some hints and tips from the forum - but have not
> > succeeded so far.
>
> > From the errors I'm getting I'm not sure if I'm doing something wrong
> > - or if this feature is fully supported already.
>
> > My Intent Filter is:
> > 
> > 
> >  > android:name="android.intent.category.DEFAULT" />
> >  > android:name="android.intent.category.BROWSABLE" />
> > 
> > 
>
> > Has anyone managed to do something similar in m5-rc15?
>
> > Thanks!
>
> > Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to handle a "long press" on a mapview/map overlay

2008-11-13 Thread Amos

Hi,

I want to be able to handle "long taps" on a mapview (or, preferrably,
a map overlay), like LongClick events. tap events are handled by these
classes, but I found no way to differentiate regular taps from long
taps.

I can probably implement this in the onTouchEvent method - but I don't
want to reinvent the wheel if there's already a way to do this. Any
ideas?

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Problem with the heap size

2008-05-17 Thread Amos

This (logCat messages not appearing all of a sudden) happens
frequently to me. I never managed to isolate the cause, so it's just a
bit of annoying behavior I've come to live with :-). Restarting the
emulator or eclipse usually helps, not always.

On May 17, 1:03 pm, mystic-d <[EMAIL PROTECTED]> wrote:
> when i say "i cant see nothing in the logCat" i mean that the logCat
> was stop to work (i didnt see any message..  even when i restart the
> application)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: MapView and Zoom Control in 0.9 SDK

2008-08-26 Thread Amos

Hi All,

There's no need to manually handle touch events for displaying the
zoom controls. The following works for me:

My layout xml file is...


http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

   

   



... And in my onCreate I do:

//...
LinearLayout lay=(LinearLayout)findViewById(R.id.layout);
LinearLayout zoom=(LinearLayout)findViewById(R.id.layout_zoom);
_map= new MapView(this, MyConstants.GOOGLE_MAPS_API_KEY);
_map.setClickable(true);
_map.setEnabled(true);

_map.displayZoomControls(true);

lay.addView(_map, new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));

View zoomView = _map.getZoomControls();
zoom.addView(zoomView, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
//...

Hope this helps.

Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: MapView and Zoom Control in 0.9 SDK

2008-08-26 Thread Amos

I think you're right. It's probably a better idea to add the mapview
to the relativelayout. The "layout" is not necessary.

On Aug 27, 3:29 am, jokochi <[EMAIL PROTECTED]> wrote:
> That's a neat solution. It works! Thank you, Amos.
> I really know how to use RelativeLayout.
>
> It's just a small question comes to me, why mapview was stacked on
> layer "layout"?
> I think mapview is able to be on top layer like as before.
>
> On 8月26日, 午後9:38, Amos <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > There's no need to manually handle touch events for displaying the
> > zoom controls. The following works for me:
>
> > My layout xml file is...
>
> > 
> > http://schemas.android.com/apk/res/
> > android"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent">
>
> > > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > />
>
> > > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:layout_alignParentBottom="true"
> > android:layout_centerHorizontal="true" />
>
> > 
>
> > ... And in my onCreate I do:
>
> > //...
> > LinearLayout lay=(LinearLayout)findViewById(R.id.layout);
> > LinearLayout 
> > zoom=(LinearLayout)findViewById(R.id.layout_zoom);
> > _map= new MapView(this, MyConstants.GOOGLE_MAPS_API_KEY);
> > _map.setClickable(true);
> > _map.setEnabled(true);
>
> > _map.displayZoomControls(true);
>
> > lay.addView(_map, new LinearLayout.LayoutParams(
> > LayoutParams.FILL_PARENT,
> > LayoutParams.WRAP_CONTENT));
>
> > View zoomView = _map.getZoomControls();
> > zoom.addView(zoomView, new LinearLayout.LayoutParams(
> > LayoutParams.WRAP_CONTENT,
> > LayoutParams.WRAP_CONTENT));
> > //...
>
> > Hope this helps.
>
> > Amos
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to start the native Camera app in 1.0 SDK?

2008-10-02 Thread Amos

Hi,

The MediaStore.ACTION_IMAGE_CAPTURE constant, which was used to start
the native Camera application to capture an image, has been removed in
the 1.0 SDK.

Is there an alternative way to start the native Camera app to take a
picture and return it to my calling Activity?

Thanks,

Amos
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to start the native Camera app in 1.0 SDK?

2008-10-02 Thread Amos

Seems like using the MediaStore.ACTION_IMAGE_CAPTURE hardcoded String
value ("android.media.action.IMAGE_CAPTURE") still works in 1.0 and
starts the native camera app. Nevertheless, removing this constant
might mean there's a better way to do this... Any feedback is
welcomed.

Furthermore, both in 0.9 and 1.0, when starting the camera app this
way, the captured image is returned in the result intent extras. The
returned image is small with a much smaller resolution than the images
captured in the camera activity in the normal way. The pictures look
very grainy. Is there a way to overcome this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] PreferenceActivity Refresh Problem

2008-10-02 Thread Amos

I have a PreferenceActivity inflated from xml. One of the preferences
launches an intent which opens an activity that clears all the
preferences and resets them to the default values.
My problem is that when this "restore defaults" activity returns, the
previous preference values still appear on the screen. If I exit the
preference activity and then reopen it, the updated preference values
appear.
This seems like a refresh issue. Is there a way I can tell the
PreferenceActivity to refresh its values? (I made sure I am comitting
all my preference changes)

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] PreferenceActivity Refresh Problem

2008-10-02 Thread Amos

I have a PreferenceActivity inflated from xml. One of the preferences
launches an intent which opens an activity that clears all the
preferences and resets them to the default values.

My problem is that when this "restore defaults" activity returns, and
I navigate to another preference screen with, say, a checkbox
preference, the previous preference values still appear on the screen.
If I exit the preference activity and then reopen it, the updated
preference values appear.

This seems like a refresh issue. Is there a way I can tell the
PreferenceActivity to refresh its values? (I made sure I am comitting
all my preference changes)

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: PreferenceActivity Refresh Problem

2008-10-04 Thread Amos

I've implemented something similar and will leave it like this for
now. My "reset preferences" option is currently not in the main
activity screen, but I'll move it there so it'll behave reasonably.

Guess this is an example of the limitations of working with a
framework rather than rolling your own code. I'm still very happy with
the preferences framework, though - it's consistent, works well and
saves a lot of time and hassle.

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: HttpClient, URLConnection, settings, etc...

2008-10-10 Thread Amos



Make sure you have the "android.permission.INTERNET" Uses Permission
in your AndroidManifest.xml file to enable your app to access the
internet.

I don't know of any preference between HttpClient and URLConnection
(I'd also be happy to know if one of them is preferred).

There's an apps-for-android project which contains app samples created
by Google's Android team. I haven't examined them in-depth, but I'm
sure they have some pretty good usage examples. From just a quick
browse, this class might be a useful reference for you:

http://code.google.com/p/apps-for-android/source/browse/trunk/Translate/src/com/beust/android/translate/Translate.java

Good Luck,
Amos

On Oct 9, 12:54 pm, Jasp182 <[EMAIL PROTECTED]> wrote:
> I have tried to call out to the web using both HttpClient and
> URLConnection, and I get "unknown error" in both cases at the point
> the call is actually made (HttpClient.execute() or
> URLConnection.getContent() methods).  My emulator is able to connect
> to the web, because I can use the Browser with no problem.  So, I'm
> assuming that there aren't any issues with my settings (this is being
> done on my home network with no proxy server).  Is there a "best
> practices" preference between using HttpClient or URLConnection, and
> are there any examples or sample apps (with source code) that make
> simple calls to the web?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to store questions for quiz type application

2010-08-02 Thread amos
Hello,
I want to create such application that would show a question to user
and possible 3 (or n) answers and user should pick correct answer
(some kind of learning quiz). I'm not sure about the storage for those
data - questions and possible answers. What would be most natural way
for Android. I know that I can either use property files or tables in
sqlite database. There will be about 500 items (1 question, 3 answers,
1 correct answer ).
Any ideas?
Thanks

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


[android-developers] Re: How to store questions for quiz type application

2010-08-04 Thread amos
Thanks guys for opinion. I'm already working on SQL based version of
the application.

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


[android-developers] Disable all Android emulator traffic from emulator invocation

2012-11-06 Thread Brandon Amos


Copied on 
StackOverflow
 (I 
can delete one if double posting isn't acceptable - I just wanted to get 
more eyes on my question)

I'm working on scripts to manage large amounts of Android emulators and I 
need to disable all network traffic on some of them. I'm currently routing 
the TCP traffic through a null proxy with by using emulator-arm ... 
-http-proxy 0.0.0.0:0 and this blocks the traffic that I want it to.

I thought this was working well until I noticed some strange error messages 
while running my scripts. The console started outputting accept too many 
open files and checking the open files with lsof reveals numerous messages 
stating "can't identify protocol"

...
emulator- 19463 username   19u sock0,6   0t0 1976595845 
can't identify protocol
emulator- 19463 username   20u sock0,6   0t0 1976595847 
can't identify protocol...

The only "solution" I found to this is to kill all of the emulators and 
then wait until this limit is reached again, which is hardly a solution at 
all.

Is there another way to do this while invoking the emulator? Am I 
incorrectly using the -htt-proxy switch to block the traffic?

Other people found solutions to block traffic by manually doing this by 
using airplane 
mode,
 
but this isn't feasible for me as I'm controlling emulators via scripts. I 
could send keyevents to the emulator with my script and turn the phone on 
in airplane mode, but I would prefer something more reliable than this.

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