Re: [android-developers] Accessing the /data folder

2010-02-18 Thread Mark Murphy
Thalisson wrote:
 I'm working on a android project and we're wondering if there is any
 way to access all the data on the /data folder. I'm asking this
 because we need to copy (and paste) all the data on that folder and,
 so far, we couldn't find a way to do that.
 
 I know that normally we don't have access due to security (with access
 we could modify/read anything that other apps uses), but is that
 anyway (signing the app with a Recognized Certificate Authority to
 have full access, like we can with J2ME) to have this kind of power?

No, sorry.

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

_Android Programming Tutorials_ Version 1.9 Available!

-- 
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: singleTask + activity stack not preserved?

2010-02-18 Thread jotobjects
Just curious since you and others have asked similar questions in the
past.  I just wrote a simple App with ActivityA and ActivityB where A
is singleTask launchMode.  If I go A-b-Home-relaunch I get gack to
B.  So I cannot replicate the scenario you describe.  The code and all
files for the app are just a couple of dozen lines so I can post if
here if that would be helpful to figure out what you are doing
differently than my test.

On Feb 18, 7:09 am, Mark Wyszomierski mar...@gmail.com wrote:
 Hi,

 I have an activity, ActivityA, and its launchMode is set to
 singleTask.

 I start the application from the app tray. ActivityA launches
 ActivityB from a button click. ActivityB is a normal activity with no
 launchMode set (standard).

 With ActivityB on top of the activity stack, I hit the home button,
 then resume the app, I see ActivityA instead of ActivityB when
 resumed.

 Shouldn't the history stack be preserved in this case, and B be
 showing? When I resume, I see A get onNewIntent() called, and I'm not
 sure why this is happening. I thought the stack would be preserved.

 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] Content Length -1 in HTTP Response / Parial Read

2010-02-18 Thread kumaresh
Hi,
  1. Implemented an application, that does a webservice call to our
servers. when the response size is around 200 Kb, iam receiving the
content length as -1. It works well in Droid/ADP1/etc (receiving the
original length) but fails in HTC My Touch and HTC DREAM.

  2. When i replace, the content length , with 20 , when the
content length is -1. Still, cannot able to read the complete chunk
from the input stream.

This issue can be in other devices too.
The issue could be with the buffer size/allocation ?



Here is that piece of code:
 private byte[] doHttpRequest(String url,String req) throws
IOException {
InputStream is = null;
HttpURLConnection c = null;
   OutputStream os = null;

String errMsg = null;
try {

c = (HttpURLConnection) new URL(url)
.openConnection();

c.setDoInput(true);
c.setDoOutput(true);
c.setConnectTimeout(15000);
c.setReadTimeout(4);
c.setRequestMethod(POST);
   c.setRequestProperty(Content-Language, en-US);
   os=c.getOutputStream();
   os.write((mobile_request= +
StringStuff 
.URLEncodeStr(req).getBytes());
rc = c.getResponseCode();
if (rc != HttpURLConnection.HTTP_OK) {

throw new IllegalResponseCodeException(HTTP 
response code: 
+ rc);
}
is = c.getInputStream();
int len = (int) c.getContentLength();
// Length=-1 , incase of HTC DREAM/HTC Touch
if (len  0) {
int actual = 0;
int bytesread = 0;
byte[] data = new byte[len];
while ((bytesread != len)  (actual != -1)) {
actual = is.read(data, bytesread, len - 
bytesread);
bytesread += actual;
}
return data;
}
}
}

-- 
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] How to move Activity to foreground

2010-02-18 Thread // C
You can send an Activity to the background by calling the
moveTaskToBack() operation. This seems to work perfectly. But when I
later on want to retrieve my Activity to the foreground again, how can
I do this programatically ?
Can someounde illustarte with a small example ?

-- 
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] SMS inbox Read Problem

2010-02-18 Thread Akage
Hi Thank you for Read this thread.

i tryed for apps  sms blocker

first i get sms inbox message like this

public class CsmsHandler extends BroadcastReceiver {
   public void onReceive(Context arg0, Intent arg1) {
   Bundle bundle = arg1.getExtras();
   SmsMessage[] msgs = null;
   String str = ;
  if (bundle != null){
  Object[] pdus = (Object[]) bundle.get(pdus);
  msgs = new SmsMessage[pdus.length];
for (int i=0; imsgs.length; i++){
msgs[i] =
SmsMessage.createFromPdu((byte[])pdus[i]);
   str += SMS from  +
msgs[i].getOriginatingAddress();
   str +=  :;
   str += msgs[i].getMessageBody().toString();
   str += \n;
}

Toast.makeText(arg0, str, Toast.LENGTH_SHORT).show();
main.instance.viewSmsList();  mark
}
}
--  mark is ListActivity List refresh from smsinbox

DDMS send to sms recieve event and refresh List very well
but last messeage is not view  in list

how can process last message into list?

-- 
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] Usb Tethering in Android Eclair 2.1

2010-02-18 Thread Aniruddha Mukherjee
Hi All,

In android eclair 2.1 is dialup networking through usb possible?
Is there any Support for usb tethering present in kernel layer.

I am trying to make my own app, if needed ready to do some kernel
related code chage also.

I have seen in \kernel\drivers\usb\gadget\f_derial.c file some modem
related code has present  uder CONFIG_MODEM_SUPPORT flag.

Please suggest.
Thanks in advance for your reply.

-- 
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] OpenGL Texture Scaling Problem

2010-02-18 Thread Barrett_A
I have a texture with 8 equally sized stripes that I am using as a
wall with OpenGL.  On my Nexus One it scales it properly, as the
stripes get smaller the further away they get ( 
http://lbarrettanderson.com/pongGood.png
).

However, in emulators and on a G1 (and probably on other hardware), it
does not scale properly, as the stripes remain the same width, while
the height scales as it should. ( http://lbarrettanderson.com/pongBad.png
).

Is there an option that I need to set that is set to default on my
nexus one but not on other platforms?

I can post code if needed, but I figured this would be a simple option/
configuration fix.

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] How to get current time accurately?

2010-02-18 Thread Yoshinori
Hi

I want to get current time accurately.
I tried to get the time by System.currentTimeMillis() but it has the
effect on the modificaion by User. So it is not useful for me.

Could you kindly tell me how to get current time accurately?

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] differentiating single click and long click.

2010-02-18 Thread mmkr
Hi all,
I have an array list of a view in my application. The view has
both single click and long click
listeners. To detect a particular view that is selected I'm using
isPressed() for single click listener. Now how can I detect that a
particular view is longclicked from the array list of view?

thanks in advance

-- 
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] Retrieving data from portrait to landscape

2010-02-18 Thread sid
Hi All,

For changing from portrait to landscape mode i have done some changes
in manifest.xml and included some code in test.java file

In manifest.xml i have included activity_name
android:configChanges=orientation/

i entered some data in portrait mode.
but when i rotate my mobile from portrait to landscape the control
goes to onConfigurationChanged() method.

public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
setContentView(R.layout.screen1_landscape);
}

in the above method im displaying one more new screen..
here is the problem that the data entered in portrait mode is not
retrieving in landscape mode..

Please let me know where am going wrong???

-- 
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] Add a new custom locking screen

2010-02-18 Thread plouck
Dear,

We are looking to add a new android locking screen (a password based
one) with the same behaviour of the current unlock pattern.

In fact we have been able to create a custom locking screen but we
haven't found the way to disable the home key.

Any ideas ?

Cheers

--
plouck

-- 
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] Gestures in app Widget

2010-02-18 Thread Rajesh G
Hi All:

Greetings!!!

I'm newbie to Android and developed a widget for my application. I
want to use gesture to open up some of my application features inside
the widget. As far I know implementation of gesture inside my
application is possible and my question is will it be possible to
implement predefined (using gesture builder given along SDK) gestures
inside our widgets? Kindly throw some light on this and any help would
be greatly appreciated.

Best
Rajesh G.

-- 
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] Stop Surface View being destroyed

2010-02-18 Thread Adrian Hirst
Hi,

I have created a game that uses SurfaceView and need input for player
to enter there name so I created a View xml that allows the player to
enter there name with the virtual keyboard.

The problem I have is when I call setContentView(nameView) it destroys
the surfaceview and everything associated with it is there away to
preserve the SurfaceView as it gets rid of all the gfx that have been
loaded.

Thanks

Adrian

-- 
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] How to get Bitmap from SurfaceView?

2010-02-18 Thread ASL
Hello,

I'm using the MediaPlayer to play a video and I need to get some
frames of the video while it is being played.
I found that SurfaceHolder has the method lockCanvas() returning a
Canvas object, using it I can draw thing on the surface, but how can I
get the pixels that are currently on the surface?

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] TranslateAnimation z-order problem

2010-02-18 Thread mc_sunw
I've come across a curious problem:

I have a simple horizontal LinearLayout: Button A - ViewGroup
(vertical LinearLayout containing TextViews) - Button B
It's important to note that the views are defined in the XML in the
above order i.e. Button A, ViewGroup, Button B.

I have a simple TranslateAnimation:
1. Press Button A and the ViewGroup gets animated off the screen to
the right, past Button B.
2. Press Button B and the ViewGroup gets animated off the screen to
the left, past Button A.

In the case of #1, the animation happens with the ViewGroup being
animated *behind* Button B.
In the case of #2, the animation happens with the ViewGroup being
animated *above* Button A.

This happens specifically because Button A was defined before the
ViewGroup in the layout XML.  I've tried changing the Z adjustment for
the animation but this has no effect.

What I want is to have both animations happen behind the buttons (i.e
#2 same as #1).  I don't want to have to re-arrange my layout to have
to define the ViewGroup first and I've tried bringing Button A to the
front but that messes with the overall layout when the ViewGroup is
off the screen, with Button A ending up next to Button B on the right.

Any ideas?  It seems like the Z adjustment isn't doing what it should.

-- 
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] Content Observer

2010-02-18 Thread Kiran
As per normal content observer, you will just get to know that content
has been changed but not the data.

So how can I exactly find out what changes has been made using Content
Observer?
Is there any alternative way to obtain the changes done on specific
content URI?

Thanks a lot in advance !!

Thanks
kiran

-- 
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: Store contact name in emulator phonebook.

2010-02-18 Thread ivar
Try this:

ContentValues values = new ContentValues();
values.put(Contacts.People.NAME, Dummy Contact+i);

Uri uri =
Contacts.People.createPersonInMyContactsGroup(getContentResolver(),
values);
Uri newContact = Uri.withAppendedPath(uri,
People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(People.Phones.TYPE, 
People.Phones.TYPE_MOBILE);
values.put(People.Phones.NUMBER, number);
getContentResolver().insert(newContact, values);

Thanks,
Ravi

On Feb 18, 3:06 pm, Pranav vips...@gmail.com wrote:
 Hi all,

 I am able to retrieve contact name from emulator phonebook using the
 above code:

 ___ _
 public  class TestContacts extends  Activity {
     /** Called when the activity is first created. */

      ContentResolver contentResolver;
      Cursor cursor;
      String id, name;
      TextView tv;

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

         tv = (TextView)findViewById(R.id.txtView);

         contentResolver = getContentResolver();
         cursor =
 contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null,
 null, null, null);
         if (cursor.getCount()  0) {
           while (cursor.moveToNext()) {
                String id =
 cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
                System.out.println(ID: +id);

                String name =
 cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NA 
 ME));
                System.out.println(Name: +name);
                tv.append(ID: +id+ +Name: +name+\n);
           }
         }
     }}

 ___

 But i want to add contact name in emulator phonebook and i tried it
 using the below code but anyhow i could not able to see the contact
 name in phonebook where as i also trace out something from logcat.
 ___
 ...
 ContentValues values = new ContentValues();
 values.put(People.NAME, Test);
 Uri uri = getContentResolver().insert(People.CONTENT_URI, values);
 if(uri == null){
      System.out.println(NEW URI);}

 ...
 ___

 Infect, when i run the application for adding the new contact, i found
 this from the logcat:

 ___
 02-18 13:18:53.667: DEBUG/AccountManagerService(60): bind attempt
 failed for Session: expectLaunch false, connected false, stats
 (0/0/0), lifetime 0.082, getAccountsByTypeAndFeatures,
 legacy_hosted_or_google
 02-18 13:18:53.727: ERROR/ContactsProvider(108): Cannot determine the
 default account for contacts compatibility
 02-18 13:18:53.727: ERROR/ContactsProvider(108):
 android.accounts.AuthenticatorException: bind failure
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 android.accounts.AccountManager.convertErrorToException(AccountManager.java :
 659)
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 android.accounts.AccountManager.access$500(AccountManager.java:53)
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 android.accounts.AccountManager$BaseFutureTask
 $Response.onError(AccountManager.java:566)
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 android.accounts.IAccountManagerResponse
 $Stub.onTransact(IAccountManagerResponse.java:69)
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 android.os.Binder.execTransact(Binder.java:287)
 02-18 13:18:53.727: ERROR/ContactsProvider(108):     at
 dalvik.system.NativeStart.run(Native Method)
 02-18 13:18:54.037: INFO/ContactAggregator(108): Contact aggregation:
 1
 02-18 13:18:54.197: INFO/ContactAggregator(108): Contact aggregation
 complete: 1, 157 ms per contact
 ___

 After that i had also tried to run the application for retrieving the
 contacts from phonebook. It works fine and also giving perfect result
 but somehow it doesn't show me the contact which i have added named
 Test that i could not find in phonebook.

 What is really happening inside, i don't know. Can anybody give me any
 advice or idea or any code to resolve this problem.

 Please help me out to resolve this problem.

 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

[android-developers] Custom locking screen

2010-02-18 Thread Clément Lecigne
Dear,

We are looking to add a new android locking screen (a password based
one) with the same behaviour of the current unlock pattern.

With some ugly hacks we have been able to create a custom locking
screen but we haven't found a way to disable the home key.

Any ideas ?

Cheers

--
plouck

-- 
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] Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
What am I doing wrong here? I have a listview of items (songs on the
sd card). The user has an option to load all the songs on the sd card
to into a current playlist -- those songs are what is displayed in the
listview. Because this can take few seconds to load if they have a lot
of songs on the card, I want to display a progress dialog to just tell
the user One moment... until the list refresh is done.

I launch a thread to do this. I've done this successfully on another
app I have (which just updates a database in the background but
doesn't update any display), but this one fails with this error
message, Can't create handler inside thread that has not called
Looper.prepare(). I chopped down the activity and pasted it below.
What am I doing wrong here? I have just a vague idea of what might be
happening.

By the way, everything works when I take out the threaded stuff, it
just looks like the app freezes for a couple seconds.

Ken

/
/

public class ListingThing extends ListActivity implements Runnable {
public static final String PREF_NAME = PlaylistAlarmPreferences;
static final private int CONFIGURE_PLAYLIST = Menu.FIRST;
static final private int DELETE_LIST = Menu.FIRST+1;
static final private int DELETE_SONG = Menu.FIRST;
static final private int LOAD_ALL = Menu.FIRST+2;
String playlistName, CURRENT_PLAYLIST;
SharedPreferences settings;
String[] items, subitems, fullpath;
int DRILL_DOWN_LEVEL, resultCount;
MediaPlayer mMediaPlayer;
ProgressDialog myProgressDialog;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mMediaPlayer = new MediaPlayer();

getListOfPlaylists();
setListAdapter(new MySpecialAdapter(this));
// you need this for the contextmenu
registerForContextMenu(getListView());
}

public void getListOfPlaylists(){
// query db for list of songs
}

class MySpecialAdapter extends ArrayAdapter {
Activity context;

MySpecialAdapter(Activity context) {
super(context, R.layout.double_list_item, items);
this.context=context;
}

public View getView(int position, View convertView, ViewGroup
parent) {
View row=convertView;

if (row==null) {
LayoutInflater inflater=context.getLayoutInflater();
row=inflater.inflate(R.layout.double_list_item, null);
}

TextView text1 = (TextView)row.findViewById(R.id.maintext);
text1.setText(items[position]);
TextView text2 = (TextView)row.findViewById(R.id.subtext);
text2.setText(subitems[position]);
row.setSoundEffectsEnabled(true);

return row;
}
}

// This handles a context menu item click
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo)
item.getMenuInfo();
Object n = this.getListAdapter().getItemId((int)info.id);
final String pos = n.toString();// get the item number of
selection

myProgressDialog = ProgressDialog.show(this,
  One moment..., Refreshing list of songs in
playlist., true);
CURRENT_PLAYLIST = items[Integer.parseInt(pos)];
Thread t = new Thread(this);
t.start();

return super.onContextItemSelected(item);
}

public void run(){
loadsongs(CURRENT_PLAYLIST);
handler.sendEmptyMessage(0);
}

private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg){
myProgressDialog.dismiss();
// refresh the listing of playlists
getListOfPlaylists();
setListAdapter(new MySpecialAdapter(ListingThing.this));

}
};

// delete all songs in playlist and then reload all songs into it
private void loadsongs(String pl){
try{
Uri media = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
DBAdapter db_songs = new DBAdapter(ListingThing.this);

String[] projection = { 
// The columns we want
MediaStore.Audio.Media._ID, 
// 0
MediaStore.Audio.Media.ARTIST,  
// 1 artist
MediaStore.Audio.Media.TITLE,   
// 2 song
MediaStore.Audio.Media.DATA,
// 3 full path of 

Re: [android-developers] Add a new custom locking screen

2010-02-18 Thread Mark Murphy
plouck wrote:
 We are looking to add a new android locking screen (a password based
 one) with the same behaviour of the current unlock pattern.
 
 In fact we have been able to create a custom locking screen but we
 haven't found the way to disable the home key.

Write your own firmware. Blocking the HOME key should not be possible
from SDK applications.

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

Android Training in US: 14-18 June 2010: http://bignerdranch.com

-- 
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] How to implement UI for re-ordering a list?

2010-02-18 Thread Luke Meyer
I have an Android app where users can add items to a ListView, and I'd
like them to be able to re-order the items in the list however they
want (as opposed to just offering them different sort orders). It's
easy enough to add a position setting for the items (they come from
the DB) but what kind of UI elements are available for the user to
indicate the desired ordering?

Is there a pattern anyone has seen implemented for this? I have not
seen anything on Android that does anything like this, except the home
screen which is similar but looks a little bit beyond my expertise at
this point. The best I can think of is to use a long click and context
menu to move up or move down. Any better ideas?

-- 
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: username and password for sample sync adapter

2010-02-18 Thread HCH
Could someone on the android team please tell us what we should use
for the password when connecting to the SampleSyncAdapter server?

On Feb 16, 4:19 pm, HCH hayeshau...@gmail.com wrote:
 as for 1)

 - The source tree is not available for download that I can tell.  You
 have to cut and paste each individual file from the html and
 reconstruct the source tree locally.
 - The source to the server has a directory but is not actually there.
 - What to use as a password isn't clear and I can't find one (tried
 all values in the user account I created plus 'password', etc.).

 So even though there is now an example months after the OS shipped
 with this feature it isn't complete and was seemingly put up without
 much care.

 On Feb 16, 3:50 am, Sameer AM sam2...@gmail.com wrote:



  Hello,

  I just got thesamplesyncadaptercode running on the emulator, but
  how do I add account in it when it asks for username and password?

  And I have the following questions

  1) SampleSyncAdapter is for 2.0 and in 2.0 emulator I don't see the
  Accounts Syncoptions in the Settings, am I missing anything?
   -- so for this I compiled this app in 2.1 and ran on 2.1 emulator

  2) In 2.0 emulator when I launch Accounts option from Contact app, it
  crashes? I saw this a raised bug, is this solved?

-- 
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: Is it possible to launch an activity on a certain key sequence?

2010-02-18 Thread BillS
So I would need to write an activity that listens for a certain key
sequence and then launches a second activity?

On Feb 18, 9:08 am, Mark Murphy mmur...@commonsware.com wrote:
 BillS wrote:
  Sorry, I meant the key sequence would launch my activity. Can you
  elaborate on what it would take?

 Again, it would only work if you are trying to launch Activity B from
 Activity A, where you wrote both B and A.

 The precise techniques will vary based on what Activity A is doing, but
 you'll want to look at onKeyDown() and onKeyUp() in Activity.

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

 Android Consulting/App Development:http://commonsware.com/consulting

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


Re: [android-developers] differentiating single click and long click.

2010-02-18 Thread social hub
can u try using onclickpress() and implement there

On Thu, Feb 18, 2010 at 5:47 AM, mmkr manutd...@gmail.com wrote:

 Hi all,
I have an array list of a view in my application. The view has
 both single click and long click
 listeners. To detect a particular view that is selected I'm using
 isPressed() for single click listener. Now how can I detect that a
 particular view is longclicked from the array list of view?

 thanks in advance

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] differentiating single click and long click.

2010-02-18 Thread social hub
sorry meant onlongpress


On Thu, Feb 18, 2010 at 12:36 PM, social hub shubem...@gmail.com wrote:

 can u try using onclickpress() and implement there

 On Thu, Feb 18, 2010 at 5:47 AM, mmkr manutd...@gmail.com wrote:

 Hi all,
I have an array list of a view in my application. The view has
 both single click and long click
 listeners. To detect a particular view that is selected I'm using
 isPressed() for single click listener. Now how can I detect that a
 particular view is longclicked from the array list of view?

 thanks in advance

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




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

Re: [android-developers] Can't show ProgressDialog during listview update

2010-02-18 Thread Frank Weiss
Use AsyncTask instead od Java threads. I'm not kidding, it's that simple.

On Thu, Feb 18, 2010 at 10:21 AM, Ken H hunt1...@gmail.com wrote:

 What am I doing wrong here? I have a listview of items (songs on the
 sd card). The user has an option to load all the songs on the sd card
 to into a current playlist -- those songs are what is displayed in the
 listview. Because this can take few seconds to load if they have a lot
 of songs on the card, I want to display a progress dialog to just tell
 the user One moment... until the list refresh is done.

 I launch a thread to do this. I've done this successfully on another
 app I have (which just updates a database in the background but
 doesn't update any display), but this one fails with this error
 message, Can't create handler inside thread that has not called
 Looper.prepare(). I chopped down the activity and pasted it below.
 What am I doing wrong here? I have just a vague idea of what might be
 happening.

 By the way, everything works when I take out the threaded stuff, it
 just looks like the app freezes for a couple seconds.

 Ken

 /

 /

 public class ListingThing extends ListActivity implements Runnable {
public static final String PREF_NAME = PlaylistAlarmPreferences;
static final private int CONFIGURE_PLAYLIST = Menu.FIRST;
static final private int DELETE_LIST = Menu.FIRST+1;
static final private int DELETE_SONG = Menu.FIRST;
static final private int LOAD_ALL = Menu.FIRST+2;
String playlistName, CURRENT_PLAYLIST;
SharedPreferences settings;
String[] items, subitems, fullpath;
int DRILL_DOWN_LEVEL, resultCount;
MediaPlayer mMediaPlayer;
ProgressDialog myProgressDialog;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mMediaPlayer = new MediaPlayer();

getListOfPlaylists();
setListAdapter(new MySpecialAdapter(this));
// you need this for the contextmenu
registerForContextMenu(getListView());
}

public void getListOfPlaylists(){
// query db for list of songs
}

class MySpecialAdapter extends ArrayAdapter {
Activity context;

MySpecialAdapter(Activity context) {
super(context, R.layout.double_list_item, items);
this.context=context;
}

public View getView(int position, View convertView, ViewGroup
 parent) {
View row=convertView;

if (row==null) {
LayoutInflater inflater=context.getLayoutInflater();
row=inflater.inflate(R.layout.double_list_item,
 null);
}

TextView text1 = (TextView)row.findViewById(R.id.maintext);
text1.setText(items[position]);
TextView text2 = (TextView)row.findViewById(R.id.subtext);
text2.setText(subitems[position]);
row.setSoundEffectsEnabled(true);

return row;
}
}

// This handles a context menu item click
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo)
 item.getMenuInfo();
Object n = this.getListAdapter().getItemId((int)info.id);
final String pos = n.toString();// get the item number of
 selection

myProgressDialog = ProgressDialog.show(this,
  One moment..., Refreshing list of songs in
 playlist., true);
CURRENT_PLAYLIST = items[Integer.parseInt(pos)];
Thread t = new Thread(this);
t.start();

return super.onContextItemSelected(item);
}

public void run(){
loadsongs(CURRENT_PLAYLIST);
handler.sendEmptyMessage(0);
}

private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg){
myProgressDialog.dismiss();
// refresh the listing of playlists
getListOfPlaylists();
setListAdapter(new MySpecialAdapter(ListingThing.this));

}
};

// delete all songs in playlist and then reload all songs into it
private void loadsongs(String pl){
try{
Uri media =
 MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
DBAdapter db_songs = new
 DBAdapter(ListingThing.this);

String[] projection = {
 // The columns we want
MediaStore.Audio.Media._ID,
 // 0
MediaStore.Audio.Media.ARTIST,
// 1 artist
MediaStore.Audio.Media.TITLE,
 // 2 song
 

[android-developers] Data Recovery

2010-02-18 Thread olipolus
Data recovery is a tricky thing, and if you've somehow deleted or had
your important files corrupted or lost due to human error, business
espionage, faulty hardware or software or any other reason; the good
news is that your lost data is probably recoverable.
http://computers-olipolus.blogspot.com/

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


Re: [android-developers] Re: Is it possible to launch an activity on a certain key sequence?

2010-02-18 Thread Mark Murphy
BillS wrote:
 So I would need to write an activity that listens for a certain key
 sequence and then launches a second activity?

Yes.

I suspect you're trying to get it such that arbitrary other
applications, or the operating system, will register the key events and
start up your activity for you. That is not supported.

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

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

-- 
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: Need Samsung Moment user to help troubleshoot problems

2010-02-18 Thread shaun
Ernest,

Your response is helpful.  I am not using
android.opengl.GLSurfaceView, but I did try to get my EGL config
chooser routine to look like what is provided therein.  Are you saying
that if I did use GLSurfaceView from Android I would not have the
issue?  If so, is there any specific parameters I would need to pass
in for initialization of the GLSurfaceView or the Renderer in order
for EGL config to be chosen properly?

I thank you and look forward to any findings if you take a look at
ongPay!

On Feb 18, 1:00 am, ernestw ernest...@gmail.com wrote:
 Dan, thanks for the reply but I was able to get my hands on a Samsung
 Moment, confirm the issue, and provide a fix.  This particular problem
 was caused by a call to glDrawArrays.  In FRG, I use glDrawArrays with
 GL_LINES to draw parts of the in-game UI.  One of the calls to
 glDrawArrays passed an odd number for the 3rd parameter of
 glDrawArrays.  Effectively I was asking to draw a number of lines plus
 one point.  Apparently this doesn't cause issues on a HTC Dream,
 Magic, Hero, Nexus One, or Moto Droid.  On the Samsung Moment, the
 phone display freezes probably due to the CPU being pegged (I
 confirmed that when freeze occurs, logcat still logs CPU pegged?
 messages).

 Definitely a bad error on my part.  Dan, if you wish to see the bug in
 action, search Android Market for FRG Lite.  Watch out you'll have
 to pull the phone battery once it freezes.

 Shaun, a while ago I ran into one other crash bug on the Samsung
 Moment which was caused by my EGLConfig selection routine.  FRG tests
 available EGLConfigs by creating a small GLSurfaceView in the splash
 screen.  In it, I run a custom EGLConfig chooser and check if the
 resulting config is hardware accelerated or not.  If software
 rendering is used, I display a warning for the user and disable sound
 and music in hopes that the game will still run adequately.

 My original EGLConfig selection resulted in EGL_SLOW_CONFIGs (i.e.
 software renderer) being chosen for the Moment.  After the splash
 screen is finished, FRG would crash with a segfault.  My guess is the
 Moment fails horribly in cleaning up a software-rendered surface.  To
 fix this issue I had to make sure my EGLConfig routine didn't ignore
 unknown EGL_CONFIG_CAVEAT values, i.e., for hardware acceleration on
 the Samsung Moment, you must choose the EGLConfig that has
 EGL_CONFIG_CAVEAT that is not EGL_NONE, EGL_SLOW_CONFIG, nor
 EGL_NON_CONFORMANT_CONFIG.

 Not sure if you'd have this problem as your game would segfault
 without fail upon cleaning up any OpenGL surface.  You also have to be
 using your own EGLConfig chooser for the bug to possibly happen.  I
 have limited time with the Samsung Moment tomorrow but after I test
 out my fixes for awhile, I'll take a look at ongPay! and see how it
 behaves.

 On Feb 16, 11:07 pm, dan raaka danra...@gmail.com wrote:



  what game is this ? can you give the class name of your app for me to search

  -Dan

  On Sat, Feb 13, 2010 at 6:28 PM, ernestw ernest...@gmail.com wrote:
   Hi all - I'm currently getting some problem comments from people
   claiming that my game FRG crashes on the Samsung Moment immediately
   when a bullet hits an enemy.  Anybody have a Samsung Moment who could
   help me figure out the issue?  I'd use DeviceAnywhere but their
   Samsung Moment has been offline for the past 1.5 weeks.  :-\

   Thanks in advance.

    Ernest Woo
    Woo Games
    http://www.woogames.com

   --
   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.comandroid-developers%2bunsubs­cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en- Hide quoted text -

 - Show quoted text -

-- 
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: Why is all the spam suddenly appearing?

2010-02-18 Thread Disconnect
Course, some of it -is- just spammers. EG olipo...@gmail.com (http://
groups.google.com/groups/search?
hl=enq=olipol66%40gmail.comqt_s=Search) Spams everywhere, hasn't
been shut down yet. Fun :/

On Feb 17, 8:36 pm, Disconnect dc.disconn...@gmail.com wrote:
 Its not a forum. Its an email list with a web archive that allows posting.
 Different animal.

 For example, unless you look at the mail headers you won't know if this
 message came from the gmail web UI, a pop client/cellphone/etc, my fios
 connection or even a random mail relay. Because of that problem, they can't
 just boot someone who got spoofed.

 (On the technical-solution side, they could hold unexpected
 outside-origination posts for moderation, but I doubt that feature is
 available, or will be. It'd require changes to the profile system to
 determine what source a user generally posts from and flag messages from
 other sources. And then you get into the nightmare of explaining how it
 works to all the random google-groups admins in some sort of reasonable
 way.)

 On Wed, Feb 17, 2010 at 7:16 PM, ian stilbit...@gmail.com wrote:
  Are you sure? I wouldn't think the sources could be easily spoofed in
  the forum, but I don;t know much about that sort of thing.

  On Feb 17, 3:00 pm, Disconnect dc.disconn...@gmail.com wrote:
   The spam is appearing because the sources are generally spoofed. Already
   several upstanding members have been kicked off various lists that way,
  for
   no reason.

   On Tue, Feb 16, 2010 at 11:25 PM, ian stilbit...@gmail.com wrote:
I don't like the spam on our discussion group and it seems to be
getting worse in the last week or so. Maybe the sources could be
tracked and lose their accounts

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Is it possible to launch an activity on a certain key sequence?

2010-02-18 Thread TreKing
I don't know if this will help your situation at all, but note that there is
the option for users to set keyboard shortcuts, so you could set a shortcut
for yourself for your own app.

On Thu, Feb 18, 2010 at 12:51 PM, Mark Murphy mmur...@commonsware.comwrote:

 BillS wrote:
  So I would need to write an activity that listens for a certain key
  sequence and then launches a second activity?

 Yes.

 I suspect you're trying to get it such that arbitrary other
 applications, or the operating system, will register the key events and
 start up your activity for you. That is not supported.

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

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.3 Available!

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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] access android.R.string values from xml layout file

2010-02-18 Thread fry
Hello,

I can access android.R.string.ok value from java code, but can't see
how to do the same in layout xml file - I only have @string/xxx in
autocompletion list which does not have system string values.

thank's

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


Re: [android-developers] Re: Is it possible to launch an activity on a certain key sequence?

2010-02-18 Thread Mark Murphy
TreKing wrote:
 I don't know if this will help your situation at all, but note that
 there is the option for users to set keyboard shortcuts, so you could
 set a shortcut for yourself for your own app.

*smacks forehead*

I keep forgetting about that, particularly now that I'm using a
keyboard-less device, so the Quick Launch options aren't available.

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

_Android Programming Tutorials_ Version 1.9 Available!

-- 
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: Is there a normal human way to copy image from one folder to another?

2010-02-18 Thread Streets Of Boston
No. You have to do this all yourself :(

1. Query from the mediastore all the info for your original image,
including its file-path (DATA column).
2. Query from the thumbnail mediastore the info of all the thumbnails
(can have more than one) for the given image.

3. Copy your image-file to another location. Remember this location
for the new DATA column of your new image.

4. Insert into the mediastore all the data obtained from point (1.)
but set your DATA to the new file-path of your new image (from point
3.).
5. Insert into the thumbnail mediastore the thumbnails of this new
image. Use the data from point (2.), but update the IMAGE_ID with the
new image-id from point (4.) and make also copies of each thumbnail
file (DATA column).



On Feb 17, 9:19 pm, benderillo alex.vep...@gmail.com wrote:
 Hi everybody,

 Here is the problem:
 I'm trying to figure out the best way to copy exisitng jpeg image on
 SD card from one folder to another with MediaStore database properly
 updated.

 First approach I tried:
 1) Open IN and OUT streams; 2) Copy file to a new location as byte
 stream; 3) Use MediaScannerConnection.scanFile() to update MediaStore
 DB.
 This way works fine except one problem: image thumbnail is not
 generated (MediaStore.Images.Thumbnails is empty). I looked inside
 scanFile method; it doesn't seem to have any code for thumbnail
 generation.

 Second approach:
 Try to use Images.Media.insertImage() - with this approach I don't
 know how to chose the physical location of the new file. You can't
 control this. You just get an Uri to a copy of the image which is
 copied (re-encoded) to some place but not the folder you need it to be
 in.

 In other words, my question is: Is there any way to give MediaStore an
 image file and say Please, take this file and fill up your database
 with all the information it should have, including thumbnail?

-- 
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] Building the sdk (.jar file) with calendar app

2010-02-18 Thread arnoldl
Hello all, newbie question...

I want my android.jar to include the calendar provider class..this is
not in the normal .jar
It's hidden for the sdk build by @hidden lines in the source.

i have read somewhere that by removing some @hidden's i can build a
android.jar with the calendar class..
But i can't find out how...

I just keep solving errors and dependencies when i remove the @hidden
in the calendarprovider.

any help is welcome.

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


Re: [android-developers] Building the sdk (.jar file) with calendar app

2010-02-18 Thread Mark Murphy
arnoldl wrote:
 I want my android.jar to include the calendar provider class.

Please don't do that.

 this is
 not in the normal .jar
 It's hidden for the sdk build by @hidden lines in the source.

Correct. It is not for SDK developer use at this time. It is subject to
modification by the core Android team and device manufacturers.

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

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

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


Re: [android-developers] access android.R.string values from xml layout file

2010-02-18 Thread TreKing
On Thu, Feb 18, 2010 at 1:13 PM, fry bender...@gmail.com wrote:

 I can access android.R.string.ok value from java code, but can't see
 how to do the same in layout xml file


Try @android:string/ok - though even if that works, note that that's
probably discouraged, as the value of that resource may change or be removed
altogether across platforms. You're better off just adding your own,
especially if it's just OK.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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: Is it possible to launch an activity on a certain key sequence?

2010-02-18 Thread Abhi
On that note, Can I launch an activity from the called 'Camera App'
within my own activity on the press of Capture button?

Abhi

On Feb 18, 2:13 pm, Mark Murphy mmur...@commonsware.com wrote:
 TreKing wrote:
  I don't know if this will help your situation at all, but note that
  there is the option for users to set keyboard shortcuts, so you could
  set a shortcut for yourself for your own app.

 *smacks forehead*

 I keep forgetting about that, particularly now that I'm using a
 keyboard-less device, so the Quick Launch options aren't available.

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

 _Android Programming Tutorials_ Version 1.9 Available!

-- 
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] Calling activity from inside a thread?

2010-02-18 Thread Abhi
Hi,

I want to either use WiFiManager to toggle wifi from inside a thread
or call another activity to do this, whichever is possible. I tried
using the wifimanager class inside the thread but it didn't work.
Could anyone tell me how to call an activity using Intents from inside
a thread?

Thanks,

Abhi

-- 
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] KEYCODE for headset button press

2010-02-18 Thread Porting beginner
Hi,

I am trying from few days but don't get any information related to issue as
below.

Which  KEYCODE to send to input dev ( /dev/input/event2 here ) on headset
button press event from my
headset driver so can answer / hang-up call ?

Please let me know if I am missing something here.

-- 
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 Using lisview

2010-02-18 Thread DonFrench
Have you read the tutorial?  
http://developer.android.com/intl/de/resources/tutorials/views/hello-listview.html

On Feb 17, 7:07 pm, Reno Akbar robotijo.be...@gmail.com wrote:
 Hai Guys

 any body share with me how to use lisview ?

 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


Re: [android-developers] TranslateAnimation z-order problem

2010-02-18 Thread Dianne Hackborn
The Z adjustment only works for window animations.  I thought this was
documented, but apparently not.

On Thu, Feb 18, 2010 at 8:25 AM, mc_sunw mlcaun...@googlemail.com wrote:

 I've come across a curious problem:

 I have a simple horizontal LinearLayout: Button A - ViewGroup
 (vertical LinearLayout containing TextViews) - Button B
 It's important to note that the views are defined in the XML in the
 above order i.e. Button A, ViewGroup, Button B.

 I have a simple TranslateAnimation:
 1. Press Button A and the ViewGroup gets animated off the screen to
 the right, past Button B.
 2. Press Button B and the ViewGroup gets animated off the screen to
 the left, past Button A.

 In the case of #1, the animation happens with the ViewGroup being
 animated *behind* Button B.
 In the case of #2, the animation happens with the ViewGroup being
 animated *above* Button A.

 This happens specifically because Button A was defined before the
 ViewGroup in the layout XML.  I've tried changing the Z adjustment for
 the animation but this has no effect.

 What I want is to have both animations happen behind the buttons (i.e
 #2 same as #1).  I don't want to have to re-arrange my layout to have
 to define the ViewGroup first and I've tried bringing Button A to the
 front but that messes with the overall layout when the ViewGroup is
 off the screen, with Button A ending up next to Button B on the right.

 Any ideas?  It seems like the Z adjustment isn't doing what it should.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  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 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: Building the sdk (.jar file) with calendar app

2010-02-18 Thread arnoldl
 Please don't do that.
I understand that it's not the right way to build an app.
And i'm aware that if i link to this class , any change by the android
team will break my app.

her comes the but :-)
- i want to make a app only for personal use..so i take the change of
failing with code update.
- it would help me to learn better android programming..
it's to much for me to code the idea i have from nothing..
but if i can build the calender app in the sdk , i can work from
that...
(already got parts working , by editing in source and rebuilding the
sdk emulator image after every change...
but that's a little bit time consuming :-)

If it's possible without to much problems , it would help me out.



On 18 feb, 20:30, Mark Murphy mmur...@commonsware.com wrote:
 arnoldl wrote:
  I want my android.jar to include the calendar provider class.

 Please don't do that.

  this is
  not in the normal .jar
  It's hidden for the sdk build by @hidden lines in the source.

 Correct. It is not for SDK developer use at this time. It is subject to
 modification by the core Android team and device manufacturers.

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

 _The Busy Coder's Guide to *Advanced* Android Development_
 Version 1.3 Available!

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


Re: [android-developers] Tab Bar in Android

2010-02-18 Thread TreKing
On Wed, Feb 17, 2010 at 11:25 PM, Sasikumar.S sasikumar.it1...@gmail.comwrote:

 I need like that tab  bar in android .
 How to do that?

 Any suggestions ?


Yes.

1 - Get a book or two or three on Android.
2 - Read the online documentation.
3 - Read through the samples.
4 - (This one is important) ... TRY TO GET WHAT YOU WANT ON YOUR OWN.
5 - If you get stuck on a SPECIFIC problem, post here with a SPECIFIC
question.
6 - Stop posting here's a picture of what I want, how do I do it?
questions, because no one is going to do your work for you.

Seriously, a tab bar like that can be EASILY achieved if you put as much
time into trying it for yourself as you do posting here trying to get people
to give you answers.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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: Multiple Gallery Widgets won't scroll

2010-02-18 Thread racx182
I am stacking two galleries on top of each other... I know no other
way to do this than to include two galleries in a layout. The one
that's last added is the one that will properly scroll. Work around?


On Feb 18, 11:51 am, social hub shubem...@gmail.com wrote:
 I am also having the same issue

 But do u need multiple galleries in a layout can you create a view that
 encompasses all your child and give that to the gallery view in such a case
 u need only one gallery.



 On Thu, Feb 18, 2010 at 10:20 AM, racx182 drobe...@gmail.com wrote:
  Does anyone have any solution for placing multiple Galleries on a
  layout? The problem is only one Gallery will scroll with multiple
  Galleries on a layout. The other Galleries won't work. Anyone know a
  workaround ?

  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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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: TranslateAnimation z-order problem

2010-02-18 Thread mc_sunw
Ok, so it's not me doing something stupid. :)

Any thoughts as to the best solution?

I wrote a simple test whereby I created a RelativeLayout rather than a
LinearLayout and defined the ViewGroup first and the buttons after,
relative to the ViewGroup, which seemed to work ok in the test.  So
did calling buttonA.bringToFront() before starting the animation
(although it screwed up the layout after the animation was complete by
putting the Button A on the far right next to Button B).  Neither seem
a very elegant solution to what must be quite a common problem (I
really don't want to have to re-define my whole layout again as that
has implications for the whole app).

On Feb 18, 7:45 pm, Dianne Hackborn hack...@android.com wrote:
 The Z adjustment only works for window animations.  I thought this was
 documented, but apparently not.





 On Thu, Feb 18, 2010 at 8:25 AM, mc_sunw mlcaun...@googlemail.com wrote:
  I've come across a curious problem:

  I have a simple horizontal LinearLayout: Button A - ViewGroup
  (vertical LinearLayout containing TextViews) - Button B
  It's important to note that the views are defined in the XML in the
  above order i.e. Button A, ViewGroup, Button B.

  I have a simple TranslateAnimation:
  1. Press Button A and the ViewGroup gets animated off the screen to
  the right, past Button B.
  2. Press Button B and the ViewGroup gets animated off the screen to
  the left, past Button A.

  In the case of #1, the animation happens with the ViewGroup being
  animated *behind* Button B.
  In the case of #2, the animation happens with the ViewGroup being
  animated *above* Button A.

  This happens specifically because Button A was defined before the
  ViewGroup in the layout XML.  I've tried changing the Z adjustment for
  the animation but this has no effect.

  What I want is to have both animations happen behind the buttons (i.e
  #2 same as #1).  I don't want to have to re-arrange my layout to have
  to define the ViewGroup first and I've tried bringing Button A to the
  front but that messes with the overall layout when the ViewGroup is
  off the screen, with Button A ending up next to Button B on the right.

  Any ideas?  It seems like the Z adjustment isn't doing what it should.

  --
  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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  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 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


Re: [android-developers] Re: Multiple Gallery Widgets won't scroll

2010-02-18 Thread social hub
sorry stack u mean in z axis or one below the other. I may have solution for
the one below the other not the other case i guess.

On Thu, Feb 18, 2010 at 1:59 PM, racx182 drobe...@gmail.com wrote:

 I am stacking two galleries on top of each other... I know no other
 way to do this than to include two galleries in a layout. The one
 that's last added is the one that will properly scroll. Work around?


 On Feb 18, 11:51 am, social hub shubem...@gmail.com wrote:
  I am also having the same issue
 
  But do u need multiple galleries in a layout can you create a view that
  encompasses all your child and give that to the gallery view in such a
 case
  u need only one gallery.
 
 
 
  On Thu, Feb 18, 2010 at 10:20 AM, racx182 drobe...@gmail.com wrote:
   Does anyone have any solution for placing multiple Galleries on a
   layout? The problem is only one Gallery will scroll with multiple
   Galleries on a layout. The other Galleries won't work. Anyone know a
   workaround ?
 
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


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

Re: [android-developers] How to implement UI for re-ordering a list?

2010-02-18 Thread TreKing
On Thu, Feb 18, 2010 at 10:08 AM, Luke Meyer luke.rt.me...@gmail.comwrote:

 The best I can think of is to use a long click and context
 menu to move up or move down. Any better ideas?


This is what I do and it works well enough for small lists. I would like to
do drag-n-drop at some point but it's probably more trouble than it's worth
at this point for me so I'll look into that later.

Another idea is to have a reorder mode in your app where you let the user
click the item they want to move and then do a second click on the item
that's at the point they want to move it to, repeating as necessary to move
all items.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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: access android.R.string values from xml layout file

2010-02-18 Thread fry
Thank's for hint - this works.

On Feb 18, 10:30 pm, TreKing treking...@gmail.com wrote:
 On Thu, Feb 18, 2010 at 1:13 PM, fry bender...@gmail.com wrote:
  I can access android.R.string.ok value from java code, but can't see
  how to do the same in layout xml file

 Try @android:string/ok - though even if that works, note that that's
 probably discouraged, as the value of that resource may change or be removed
 altogether across platforms. You're better off just adding your own,
 especially if it's just OK.

 -
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
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] Landscape orientation of Intent

2010-02-18 Thread Tatyana Ulyanova
Hi, friends!

I have got a problem and hope you could help me:)

I have application in landscape orientation, I set it as
android:screenOrientation=landscape in AndroidManifest.xml. But
when my app starts another activity - default internet browser - it
starts in portrait orientation.

Any ideas?

Thank you:)

-- 
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: singleTask + activity stack not preserved?

2010-02-18 Thread Mark Wyszomierski
Hi jotobjects, that would be really helpful if you could post your
example. My simple example is below. Behavior I am seeing is:

 -App Tray
 -ActivityA
 -btn click, start ActivityB
 -home button
 -resume
 -ActivityA is shown



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activitya);

Button btn = (Button)findViewById(R.id.btn);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent intent = new Intent();
intent.setClass(ActivityA.this, ActivityB.class);
startActivity(intent);
}
});
}
}



import android.app.Activity;
import android.os.Bundle;

public class ActivityB extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activityb);
}
}




activity android:name=.ActivityA
  android:label=@string/app_name
  android:launchMode=singleTask
  intent-filter
action android:name=android.intent.action.MAIN /
category android:name=android.intent.category.LAUNCHER /
  /intent-filter
/activity

activity android:name=.ActivityB
  android:label=@string/app_name
  intent-filter
action android:name=android.intent.action.VIEW /
category android:name=android.intent.category.DEFAULT /
  /intent-filter
/activity



Thanks


On Feb 18, 10:18 am, jotobjects jotobje...@gmail.com wrote:
 Just curious since you and others have asked similar questions in the
 past.  I just wrote a simple App with ActivityA and ActivityB where A
 issingleTasklaunchMode.  If I go A-b-Home-relaunch I get gack to
 B.  So I cannot replicate the scenario you describe.  The code and all
 files for the app are just a couple of dozen lines so I can post if
 here if that would be helpful to figure out what you are doing
 differently than my test.

 On Feb 18, 7:09 am, Mark Wyszomierski mar...@gmail.com wrote:



  Hi,

  I have an activity, ActivityA, and its launchMode is set to
  singleTask.

  I start the application from the app tray. ActivityA launches
  ActivityB from a button click. ActivityB is a normal activity with no
  launchMode set (standard).

  With ActivityB on top of the activity stack, I hit the home button,
  then resume the app, I see ActivityA instead of ActivityB when
  resumed.

  Shouldn't the history stack be preserved in this case, and B be
  showing? When I resume, I see A get onNewIntent() called, and I'm not
  sure why this is happening. I thought the stack would be preserved.

  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: Weird stuff - help!

2010-02-18 Thread nikhil
Has any one seen this?

02-18 14:31:49.159: ERROR/AndroidRuntime(23066): Uncaught handler:
thread android.server.ServerThread exiting due to uncaught exception
02-18 14:31:49.159: ERROR/AndroidRuntime(23066): *** EXCEPTION IN
SYSTEM PROCESS.  System will crash.
02-18 14:31:49.169: ERROR/AndroidRuntime(23066):
java.lang.IndexOutOfBoundsException: index=1 count=0
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.view.ViewGroup.addInArray(ViewGroup.java:1935)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.view.ViewGroup.addViewInner(ViewGroup.java:1879)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.view.ViewGroup.addView(ViewGroup.java:1756)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.view.ViewGroup.addView(ViewGroup.java:1713)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
com.android.server.status.StatusBarService.addNotificationView(StatusBarService.java:
875)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
com.android.server.status.StatusBarService.performAddUpdateIcon(StatusBarService.java:
673)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
com.android.server.status.StatusBarService
$H.handleMessage(StatusBarService.java:618)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.os.Handler.dispatchMessage(Handler.java:99)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
android.os.Looper.loop(Looper.java:123)
02-18 14:31:49.169: ERROR/AndroidRuntime(23066): at
com.android.server.ServerThread.run(SystemServer.java:428)


On Feb 10, 5:36 pm, nikhil nik...@gmail.com wrote:
 Do we have any one from google on this forum? I connected the mobile
 phone to the machine remove my app and started the default google car
 home app and it shows this in the logcat.

 02-10 15:19:18.717: INFO/dalvikvm(20930): Uncaught exception thrown by
 finalizer (will be discarded):
 02-10 15:19:18.717:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@447d7c70 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.717:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.717:
 INFO/dalvikvm(20930):     at dalvik.system.NativeStart.run(Native
 Method)
 02-10 15:19:18.717:
 INFO/dalvikvm(20930): Uncaught exception thrown by finalizer (will be
 discarded):
 02-10 15:19:18.717:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@44803170 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.717:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.717:
 INFO/dalvikvm(20930):     at dalvik.system.NativeStart.run(Native
 Method)
 02-10 15:19:18.727:
 INFO/dalvikvm(20930): Uncaught exception thrown by finalizer (will be
 discarded):
 02-10 15:19:18.727:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@44af3658 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.727:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.727:
 INFO/dalvikvm(20930):     at dalvik.system.NativeStart.run(Native
 Method)
 02-10 15:19:18.727: INFO/dalvikvm(20930): Uncaught exception thrown by
 finalizer (will be discarded):
 02-10 15:19:18.727:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@44b04dd8 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.727:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.727:
 INFO/dalvikvm(20930):     at dalvik.system.NativeStart.run(Native
 Method)
 02-10 15:19:18.737:
 INFO/dalvikvm(20930): Uncaught exception thrown by finalizer (will be
 discarded):
 02-10 15:19:18.737:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@449aba58 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.737:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.737: I
 NFO/dalvikvm(20930):     at dalvik.system.NativeStart.run(Native
 Method)
 02-10 15:19:18.737:
 INFO/dalvikvm(20930): Uncaught exception thrown by finalizer (will be
 discarded):
 02-10 15:19:18.737:
 INFO/dalvikvm(20930): Ljava/lang/IllegalStateException;: Finalizing
 cursor android.database.sqlite.sqlitecur...@44b38b98 on suggestions
 that has not been deactivated or closed
 02-10 15:19:18.737:
 INFO/dalvikvm(20930):     at
 android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
 02-10 15:19:18.737: INFO/dalvikvm(20930):     at
 dalvik.system.NativeStart.run(Native Method)

 When I run Car Home alongwith my app some of the exception 

[android-developers] JetPlayer keeps logging write blocked for X msecs - is this normal?

2010-02-18 Thread kk
Hello all,

I'm trying to add audio to my game and following the jetboy tutorial
and dev pages I'm doing it as follows:

I'm initialising like this:

JetPlayer JET_PLAYER = JetPlayer.getJetPlayer();
JET_PLAYER.clearQueue();
JET_PLAYER.loadJetFile(p_resources.openRawResourceFd(R.raw.ingame1));
byte sSegmentID = 0;
JET_PLAYER.queueJetSegment(0, -1, 0, 0, 0, sSegmentID);

then doing:

JET_PLAYER.play();

ingame1.jet only contains 1 segment, which is the track I'm trying to
play.
The audio plays ok but I keep getting these in logcat:

W/AudioFlinger(   31): write blocked for 49 msecs
W/AudioFlinger(   31): write blocked for 50 msecs
W/AudioFlinger(   31): write blocked for 54 msecs

They are quite frequent...3-4 of those per second. Is this normal or
am I doing something wrong?

cheers,
kk.

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


Re: [android-developers] Landscape orientation of Intent

2010-02-18 Thread Mark Murphy
Tatyana Ulyanova wrote:
 I have got a problem and hope you could help me:)
 
 I have application in landscape orientation, I set it as
 android:screenOrientation=landscape in AndroidManifest.xml. But
 when my app starts another activity - default internet browser - it
 starts in portrait orientation.
 
 Any ideas?

Ask the user to turn their phone.

What you are asking for is the right to dictate to other applications
how they are displayed. I imagine you would not like that if other
developers did that to you -- overriding your landscape request, for
example.

If you want to force landscape Web browsing, you can embed WebView in
your app and implement it that way. And, you are welcome to force as
many of your own activities to be landscape that you want.

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

_Android Programming Tutorials_ Version 1.9 Available!

-- 
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: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
I wasn't able to get the AsyncTask to work (although I have used it
successfully in another app). What I did was use the Looper.prepare();
in my run() method:

public void run(){
Looper.prepare();

loadsongs(CURRENT_PLAYLIST);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg){
// refresh the listing of playlists
}
};

Looper.loop();
}

It doesn't crash, but it doesn't show the refresh of the listview
either -- but I think the listview is being refreshed. I have to leave
the activity and return to it to see the update.

On Feb 18, 10:43 am, Frank Weiss fewe...@gmail.com wrote:
 Use AsyncTask instead od Java threads. I'm not kidding, it's that simple.



 On Thu, Feb 18, 2010 at 10:21 AM, Ken H hunt1...@gmail.com wrote:
  What am I doing wrong here? I have a listview of items (songs on the
  sd card). The user has an option to load all the songs on the sd card
  to into a current playlist -- those songs are what is displayed in the
  listview. Because this can take few seconds to load if they have a lot
  of songs on the card, I want to display a progress dialog to just tell
  the user One moment... until the list refresh is done.

  I launch a thread to do this. I've done this successfully on another
  app I have (which just updates a database in the background but
  doesn't update any display), but this one fails with this error
  message, Can't create handler inside thread that has not called
  Looper.prepare(). I chopped down the activity and pasted it below.
  What am I doing wrong here? I have just a vague idea of what might be
  happening.

  By the way, everything works when I take out the threaded stuff, it
  just looks like the app freezes for a couple seconds.

  Ken

  /

  *** 
  */

  public class ListingThing extends ListActivity implements Runnable {
         public static final String PREF_NAME = PlaylistAlarmPreferences;
     static final private int CONFIGURE_PLAYLIST = Menu.FIRST;
     static final private int DELETE_LIST = Menu.FIRST+1;
     static final private int DELETE_SONG = Menu.FIRST;
     static final private int LOAD_ALL = Menu.FIRST+2;
         String playlistName, CURRENT_PLAYLIST;
     SharedPreferences settings;
     String[] items, subitems, fullpath;
     int DRILL_DOWN_LEVEL, resultCount;
     MediaPlayer mMediaPlayer;
     ProgressDialog myProgressDialog;

         /** Called when the activity is first created. */
    �...@override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

                 mMediaPlayer = new MediaPlayer();

                 getListOfPlaylists();
         setListAdapter(new MySpecialAdapter(this));
                 // you need this for the contextmenu
                 registerForContextMenu(getListView());
     }

     public void getListOfPlaylists(){
         // query db for list of songs
     }

     class MySpecialAdapter extends ArrayAdapter {
         Activity context;

         MySpecialAdapter(Activity context) {
                 super(context, R.layout.double_list_item, items);
                 this.context=context;
         }

         public View getView(int position, View convertView, ViewGroup
  parent) {
                 View row=convertView;

                 if (row==null) {
                         LayoutInflater inflater=context.getLayoutInflater();
                         row=inflater.inflate(R.layout.double_list_item,
  null);
                 }

                 TextView text1 = (TextView)row.findViewById(R.id.maintext);
                 text1.setText(items[position]);
                 TextView text2 = (TextView)row.findViewById(R.id.subtext);
                 text2.setText(subitems[position]);
                 row.setSoundEffectsEnabled(true);

                         return row;
         }
     }

         // This handles a context menu item click
    �...@override
         public boolean onContextItemSelected(MenuItem item) {
                 AdapterContextMenuInfo info = (AdapterContextMenuInfo)
  item.getMenuInfo();
                 Object n = this.getListAdapter().getItemId((int)info.id);
         final String pos = n.toString();        // get the item number of
  selection

         myProgressDialog = ProgressDialog.show(this,
                   One moment..., Refreshing list of songs in
  playlist., true);
                 CURRENT_PLAYLIST = items[Integer.parseInt(pos)];
         Thread t = new Thread(this);
         t.start();

                 return super.onContextItemSelected(item);
         }

     public void run(){
                 loadsongs(CURRENT_PLAYLIST);
                 handler.sendEmptyMessage(0);
     }

     private Handler handler = new Handler() {
        �...@override
         public void 

Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Mark Murphy
Ken H wrote:
 I wasn't able to get the AsyncTask to work (although I have used it
 successfully in another app). 

Here's an example of using AsyncTask to asynchronously populate a ListView:

http://github.com/commonsguy/cw-android/tree/master/Threads/Asyncer/

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

Android App Developer Training: http://commonsware.com/training

-- 
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: OnActivityResult passing a null intent

2010-02-18 Thread Cog
Thank you very much. That's made it much clearer for me.
Cog

-- 
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: singleTask + activity stack not preserved?

2010-02-18 Thread jotobjects
On quick inspection your app looks almost like the one I tested. My
test is with the emulator with Android 2.0.1.  I am NOT running this
from eclipse.   Any difference from your scenario?

What do you mean by resume in your scenario?  Do you mean pulling
down the tray and clicking on the App icon again?

On Feb 18, 12:53 pm, Mark Wyszomierski mar...@gmail.com wrote:
 Hi jotobjects, that would be really helpful if you could post your
 example. My simple example is below. Behavior I am seeing is:

  -App Tray
  -ActivityA
  -btn click, start ActivityB
  -home button
  -resume
  -ActivityA is shown

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;

 public class ActivityA extends Activity {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activitya);

         Button btn = (Button)findViewById(R.id.btn);
         btn.setOnClickListener(new OnClickListener() {
             public void onClick(View arg0) {
                 Intent intent = new Intent();
                 intent.setClass(ActivityA.this, ActivityB.class);
                 startActivity(intent);
             }
         });
     }

 }

 import android.app.Activity;
 import android.os.Bundle;

 public class ActivityB extends Activity {
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activityb);
     }

 }

 activity android:name=.ActivityA
   android:label=@string/app_name
   android:launchMode=singleTask
   intent-filter
     action android:name=android.intent.action.MAIN /
     category android:name=android.intent.category.LAUNCHER /
   /intent-filter
 /activity

 activity android:name=.ActivityB
   android:label=@string/app_name
   intent-filter
     action android:name=android.intent.action.VIEW /
     category android:name=android.intent.category.DEFAULT /
   /intent-filter
 /activity

 Thanks

 On Feb 18, 10:18 am, jotobjects jotobje...@gmail.com wrote:

  Just curious since you and others have asked similar questions in the
  past.  I just wrote a simple App with ActivityA and ActivityB where A
  issingleTasklaunchMode.  If I go A-b-Home-relaunch I get gack to
  B.  So I cannot replicate the scenario you describe.  The code and all
  files for the app are just a couple of dozen lines so I can post if
  here if that would be helpful to figure out what you are doing
  differently than my test.

  On Feb 18, 7:09 am, Mark Wyszomierski mar...@gmail.com wrote:

   Hi,

   I have an activity, ActivityA, and its launchMode is set to
   singleTask.

   I start the application from the app tray. ActivityA launches
   ActivityB from a button click. ActivityB is a normal activity with no
   launchMode set (standard).

   With ActivityB on top of the activity stack, I hit the home button,
   then resume the app, I see ActivityA instead of ActivityB when
   resumed.

   Shouldn't the history stack be preserved in this case, and B be
   showing? When I resume, I see A get onNewIntent() called, and I'm not
   sure why this is happening. I thought the stack would be preserved.

   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: Intent.ACTION_SYNC no docs or resolveInfo

2010-02-18 Thread Alex Corbi
HI,

is there a way for an app to know when a data sync happens?

It would be just great to be able to Register a BroadcastReceiver and
handle that action, in my case instead of fire a data synchronization
i would like to detect when it happens.

is it possible?

On Jan 25, 6:59 pm, Dianne Hackborn hack...@android.com wrote:
 You don't need to force a sync, when data changes on the servers the device
 is told and will get it.

 This action probably should never have been made public, and I don't think
 it does anything at this point.

 On Mon, Jan 25, 2010 at 9:44 AM, Vikas1976 vikas.shah.1...@gmail.comwrote:





  I am on board with this.  I have an app that sends a new entry to
  Google Calendar in the cloud; I would like to be able to force a sync
  with Google after adding the entry so that the entry shows up in the
  user's calendar on the device shortly after being added.  Is there
  anyone who has experience using ACTION_SYNC to let us know what sort
  of other information e.g. category or data that needs to be passed to
  the resolver in the intent to let the phone know to sync with Google?
  Does anyone know if the AccountManager is a way to get this done?

  Vikas

  On Jan 20, 12:20 pm, Arno den Hond arnodenh...@gmail.com wrote:
   i would like to trigger the synchronize now feature (in the sync
   settings screen) from my app.
   i have found Intent.ACTION_SYNCbut the documentation states

   Activity Action: Perform a data synchronization.
   Input: ?
   Output: ?

   after creating the intent according to the action name, i used
   PackageManager's queryIntentActivities method (with flag
   GET_INTENT_FILTERS) and found that no ResolveInfo objects are returned

   ideas on how to perform a data synchronization would be greatly
   appreciated

  --
  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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  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 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: Custom locking screen

2010-02-18 Thread Clément Lecigne
Hi,

We are looking to add a new android locking screen (a password based
one) with the same behaviour of the current unlock pattern but we did not
found any documentation about that.

With some ugly hacks we have been able to create a custom locking
screen but we haven't found a way to disable the home key.

Any ideas ?

Cheers
Clément

-- 
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] How can I create TextAppearanceSpan which looks like an anchor

2010-02-18 Thread n179911
Hi,

Can you please tell me how can I create a TextAppearanceSpan which
looks like an anchor (a blue text with a blue underline under the
text)?

Thank you.

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


Re: [android-developers] Re: Custom locking screen

2010-02-18 Thread TreKing
2010/2/18 Clément Lecigne plo...@gmail.com

 With some ugly hacks we have been able to create a custom locking
 screen but we haven't found a way to disable the home key.


You can't do this. See this
threadhttp://groups.google.com/group/android-developers/browse_thread/thread/379744ef80b3cb56/21287ac09244d6ca#
.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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: Socket is not connected

2010-02-18 Thread nikhil
This is what logcat shows.

02-18 16:39:19.505: WARN/System.err(25664):
java.net.SocketTimeoutException: Socket is not connected
02-18 16:39:19.505: WARN/System.err(25664): at
org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native
Method)
02-18 16:39:19.515: WARN/System.err(25664): at
org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocket(OSNetworkSystem.java:
131)
02-18 16:39:19.515: WARN/System.err(25664): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
247)
02-18 16:39:19.525: WARN/System.err(25664): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
535)
02-18 16:39:19.525: WARN/System.err(25664): at
java.net.Socket.connect(Socket.java:1054)
02-18 16:39:19.525: WARN/System.err(25664): at
org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:
317)
02-18 16:39:19.535: WARN/System.err(25664): at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:
129)
02-18 16:39:19.535: WARN/System.err(25664): at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:
164)
02-18 16:39:19.535: WARN/System.err(25664): at
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:
119)
02-18 16:39:19.545: WARN/System.err(25664): at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
348)
02-18 16:39:19.545: WARN/System.err(25664): at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
555)
02-18 16:39:19.545: WARN/System.err(25664): at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
487)
02-18 16:39:19.555: WARN/System.err(25664): at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
465)
02-18 16:39:19.555: WARN/System.err(25664): at
com.project.myproj.ClassA.Method1(ClassA.java:205)
02-18 16:39:19.555: WARN/System.err(25664): at
com.project.myproj.MyService.Method2(MyService.java:182)
02-18 16:39:19.555: WARN/System.err(25664): at
com.project.myproj.MyService$2$1.run(MyService.java:101)
02-18 16:39:19.555: WARN/System.err(25664): at java.util.Timer
$TimerImpl.run(Timer.java:290)



On Feb 17, 5:39 pm, nikhil nik...@gmail.com wrote:
 I am trying to use httpclient to hit a http link. For some reason I
 keep on geting this socket is not connected error.
 I am not sure about the reason for this error.

 Can any one help?

 This error also occurs when I start using the car navigation app or
 whenever I try to forward calls.

-- 
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: username and password for sample sync adapter

2010-02-18 Thread Megha
Hi,

I have uploaded the zipped source files for this sample at:
http://code.google.com/p/apps-for-android/downloads/list

Sorry about the server related python source files not being visible
on developer.android.com. We will fix it soon.
This sample source will be available with the next sdk package, we are
working on making zipped samples downloadable from
developer.android.com itself in future.

Regarding password issue, please use account user1/test on
samplesyncadapter server.

I would recommend that to add new accounts, download the server code,
modify it as you want and host it on a separate app engine instance.
If you look at dashboard.py and app.yaml in server code it should be
pretty clear how to do this..giving a short overview below:
1) Add a new Sample SyncAdapter account @:
http://yoursamplesyncadapter_server.appspot.com/add_user
For example I have added user1:
http://yoursamplesyncadapter_server.appspot.com/edit_user?user=1
2) Enter username/password @
http://yoursamplesyncadapter_server.appspot.com/add_credentials
The password for user1 is test.
3) Modify the android code to use your server instance.


Sorry for the confusion so far, please let me know if you have more
questions.


Thanks,
Megha






On Feb 18, 10:28 am, HCH hayeshau...@gmail.com wrote:
 Could someone on the android team please tell us what we should use
 for the password when connecting to the SampleSyncAdapter server?

 On Feb 16, 4:19 pm, HCH hayeshau...@gmail.com wrote:



  as for 1)

  - The source tree is not available for download that I can tell.  You
  have to cut and paste each individual file from the html and
  reconstruct the source tree locally.
  - The source to the server has a directory but is not actually there.
  - What to use as a password isn't clear and I can't find one (tried
  all values in the user account I created plus 'password', etc.).

  So even though there is now an example months after the OS shipped
  with this feature it isn't complete and was seemingly put up without
  much care.

  On Feb 16, 3:50 am, Sameer AM sam2...@gmail.com wrote:

   Hello,

   I just got thesamplesyncadaptercode running on the emulator, but
   how do I add account in it when it asks for username and password?

   And I have the following questions

   1) SampleSyncAdapter is for 2.0 and in 2.0 emulator I don't see the
   Accounts Syncoptions in the Settings, am I missing anything?
    -- so for this I compiled this app in 2.1 and ran on 2.1 emulator

   2) In 2.0 emulator when I launch Accounts option from Contact app, it
   crashes? I saw this a raised bug, is this solved?

-- 
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: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
But what if you're using a custom ArrayAdapter? Also, I *think*
AsyncTask is meant for one shot type tasks. A user of this app may
update this listview multiple times.

But here is something I've discovered: if I change the orientation of
the screen, the list is properly updated. Question: how can I mimic
that screen orientation change? What is actually happening when you
flip the phone? It's restarting that activity right?

Another question (I'm hitting this problem from multiple angles), how
do you tell is a thread has ended? If I can tell when the thread ends
I can do this listview update in the main thread -- which I know
works.

Ken

On Feb 18, 1:33 pm, Mark Murphy mmur...@commonsware.com wrote:
 Ken H wrote:
  I wasn't able to get the AsyncTask to work (although I have used it
  successfully in another app).

 Here's an example of using AsyncTask to asynchronously populate a ListView:

 http://github.com/commonsguy/cw-android/tree/master/Threads/Asyncer/

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

 Android App Developer Training:http://commonsware.com/training

-- 
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: username and password for sample sync adapter

2010-02-18 Thread HCH
Thank you!


On Feb 18, 3:18 pm, Megha mjo...@google.com wrote:
 Hi,

 I have uploaded the zipped source files for this sample 
 at:http://code.google.com/p/apps-for-android/downloads/list

 Sorry about the server related python source files not being visible
 on developer.android.com. We will fix it soon.
 This sample source will be available with the next sdk package, we are
 working on making zipped samples downloadable from
 developer.android.com itself in future.

 Regarding password issue, please use account user1/test on
 samplesyncadapter server.

 I would recommend that to add new accounts, download the server code,
 modify it as you want and host it on a separate app engine instance.
 If you look at dashboard.py and app.yaml in server code it should be
 pretty clear how to do this..giving a short overview below:
 1) Add a new Sample SyncAdapter account @:
 http://yoursamplesyncadapter_server.appspot.com/add_user
 For example I have added user1:
 http://yoursamplesyncadapter_server.appspot.com/edit_user?user=1
 2) Enter username/password @
 http://yoursamplesyncadapter_server.appspot.com/add_credentials
 The password for user1 is test.
 3) Modify the android code to use your server instance.

 Sorry for the confusion so far, please let me know if you have more
 questions.

 Thanks,
 Megha

 On Feb 18, 10:28 am, HCH hayeshau...@gmail.com wrote:



  Could someone on the android team please tell us what we should use
  for the password when connecting to the SampleSyncAdapter server?

  On Feb 16, 4:19 pm, HCH hayeshau...@gmail.com wrote:

   as for 1)

   - The source tree is not available for download that I can tell.  You
   have to cut and paste each individual file from the html and
   reconstruct the source tree locally.
   - The source to the server has a directory but is not actually there.
   - What to use as a password isn't clear and I can't find one (tried
   all values in the user account I created plus 'password', etc.).

   So even though there is now an example months after the OS shipped
   with this feature it isn't complete and was seemingly put up without
   much care.

   On Feb 16, 3:50 am, Sameer AM sam2...@gmail.com wrote:

Hello,

I just got thesamplesyncadaptercode running on the emulator, but
how do I add account in it when it asks for username and password?

And I have the following questions

1) SampleSyncAdapter is for 2.0 and in 2.0 emulator I don't see the
Accounts Syncoptions in the Settings, am I missing anything?
 -- so for this I compiled this app in 2.1 and ran on 2.1 emulator

2) In 2.0 emulator when I launch Accounts option from Contact app, it
crashes? I saw this a raised bug, is this solved?

-- 
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] mail to group

2010-02-18 Thread Porting beginner
Hi,

I don't see my mails sent to these groups. is that any issue ?

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

Re: [android-developers] mail to group

2010-02-18 Thread Jason Proctor
if you have a gmail address, you won't see the copy coming back. 
gmail swallows it thinking it's its own copy it uses for conversation 
tracking. at least i *think* that's what's going on, i've never heard 
a peep out of google after asking many times. this used to work 
properly up until last april or so IME.







Hi,

I don't see my mails sent to these groups. is that any issue ?

--
Thanks



--
jason.vp.engineering.particle

--
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: Restarting a MediaPlayer

2010-02-18 Thread Steeler
Would those buffers' memory space be able to be reallocated when the
activity dies, or the process, or on a total OS shutdown? This
particularly is something I was wondering about on a broader scope
than MediaPlayers.

Thanks for your answers.

On Feb 18, 7:08 am, Mark Murphy mmur...@commonsware.com wrote:
 Steeler wrote:
  But is the GC deleting the old ones?

 Eventually, presumably, yes. Bear in mind that MediaPlayer probably
 holds onto some buffers outside of the GC-able space. Also, bear in mind
 that GC is not necessarily immediate.

  And if not, are they clogging a
  page file?

 I am not aware of Android having a page file.

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

 Android Training...At Your Office:http://commonsware.com/training

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


Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Mark Murphy
Ken H wrote:
 But what if you're using a custom ArrayAdapter? 

And that matters...how, exactly?

 Also, I *think*
 AsyncTask is meant for one shot type tasks. A user of this app may
 update this listview multiple times.

:: shrug ::

Fire new instances of the AsyncTask. It uses a thread pool. It is
designed for the specific purpose we are telling you to put it to.

 What is actually happening when you
 flip the phone? It's restarting that activity right?

By default, yes.

 Another question (I'm hitting this problem from multiple angles), how
 do you tell is a thread has ended? If I can tell when the thread ends
 I can do this listview update in the main thread -- which I know
 works.

Step #1: You implement the AsyncTask

Step #2: You override onPostExecute(), which is called on the main
application (UI) thread when the background work is completed

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

Android Training in US: 14-18 June 2010: http://bignerdranch.com

-- 
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] Set style one by one in TextView

2010-02-18 Thread 中村修太
Hi,all.

I want to set Bold-style or TextColor one by one in TextView.
Can I do it?

I thought use InputFilter, but the Class could not set style.(may be..)

Please teach if it is good idea.

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


Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Jason Proctor

Fire new instances of the AsyncTask. It uses a thread pool. It is
designed for the specific purpose we are telling you to put it to.


or you could use AsyncTasks's progress reporting mechanism to 
communicate the loading of each list entry.


AsyncTask is *fab*

--
jason.vp.engineering.particle

--
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: Can't show ProgressDialog during listview update

2010-02-18 Thread Bob Kerns
Using a custom ArrayAdapter doesn't seem to me to relate to your
question, unless your problem is that it's broken. For example, if
yours doesn't notify the registered DataSetObservers that the data has
changed.

As for async tasks -- what you're describing IS a one-shot task, in
any sense that applies here. sure, you'll have more than one shot. But
in between those shots, with an ASyncTask, that thread and all the
memory required for its stack, will be available for use by OTHER
AsyncTasks, including ones possibly launched by the SDK. You do have
to create a new AsyncTask each time -- but that's a small price to pay
for significantly smaller memory usage.

So it's going to be more efficient than creating your own thread. Use
your own thread if you have something that has continuously evolving
state -- say some recursive process. Even then, you can generally
modify it to work with an ASync task.

I've read, on this list, I think, that early versions of ASyncTask
limit the pool of threads it uses to one. If that's the case, and you
run very long tasks, they may prevent other tasks from running. I
wouldn't worry about that unless you run into it as a problem; then
would be a time to either move your task into its own thread, or to
split your task up so it operates as a series of smaller pieces. And
it's my understanding that the pool is no longer limited to one
thread, so this is a limitation that will fade.

Still, if you are usually consuming one of those ASyncTask threads,
you're really not getting any benefit from using an ASyncTask other
than a convenient interface to moving that final action back to the UI
thread. But it's not hard to do that yourself, either.

If you DO run it on your own thread, you can post a message back to
the main thread, using a Handler aimed at the main thread's Looper,
which you can get via getMainLooper() on any Activity or Application
or Service, or the static method Looper.getMainLooper(). If you just
call Handler(), it picks up the Looper for the current thread -- I
believe that's why AsyncTask states in its threading rules: The task
instance must be created on the UI thread.. Basically, you'll be
doing what AsyncTask does - but you'll have the flexibility to direct
it t the UI thread even if you create it elsewhere. It seems like a
character flaw that ASyncTask's default constructor isn't hardwired to
send things to the UI thread -- it would prevent a lot of preventable
bugs.

Just put any code you'd have put in the onPostExecute(Result) method
into the runnable you post to your handler.

By default, when you flip the orientation, indeed, your activity is
destroyed and recreated. But you can specify in the manifest what
configuration change events you're prepared to handle yourself, and
handle them in onCofigurationChanged(Configuration). If all that's
needed is a layout change, you may not need to do anything at all in
this method other than call  super.onConfugrationChanged(newConfig) --
which, of course, means you don't really need to define the method at
all. I recommend doing so, however, to flag that you're actually doing
this, and that here's where any configuration change happens. If you
have elements of your UI that scroll, you may need to reset the scroll
position here. I've seen a number of apps that appear not to do this,
and it's annoying.

While you can tell that a Thread has ended by checking its state,
that's not how you SHOULD be doing things. In Android, use a Handler
and post whatever action you want to perform when the thread is ended.

At a lower Java level, use the wait/notify protocol to synchronize.
There's a clear and reliable usage pattern you can use, but it's a bit
complicated to describe, and doing it wrong results in subtle bugs.

You may want to consider using a try block, and posting your final
action from the finally clause. Declare a variable 'ok' at the start
of your function, and set it to  true when you reach the end of your
code. Choose what code to run in the success and error/failure case
based on the flag. This is a good way to communicate errors back to
the main thread.

I hope all that makes sense...

On Feb 18, 4:03 pm, Ken H hunt1...@gmail.com wrote:
 But what if you're using a custom ArrayAdapter? Also, I *think*
 AsyncTask is meant for one shot type tasks. A user of this app may
 update this listview multiple times.

 But here is something I've discovered: if I change the orientation of
 the screen, the list is properly updated. Question: how can I mimic
 that screen orientation change? What is actually happening when you
 flip the phone? It's restarting that activity right?

 Another question (I'm hitting this problem from multiple angles), how
 do you tell is a thread has ended? If I can tell when the thread ends
 I can do this listview update in the main thread -- which I know
 works.

 Ken

 On Feb 18, 1:33 pm, Mark Murphy mmur...@commonsware.com wrote:



  Ken H wrote:
   I wasn't able to get the AsyncTask to work 

[android-developers] spreadsheets.google.com using raw http/xml

2010-02-18 Thread dan raaka
It looks like my example refuses to work with spreadsheets.google.com list
worksheet feed.

Here is the code snippet
authenticate() succeeds and I get the proper auth token.
However getWorksheetContents() fails with 404 Not found error.

I have double check the URL (worksheetsheetURL) using curl (it works fine on
curl), I have checked the tcpdump of both curl and my sample program -
nothing seems out of the place - but i am at loss to understand, why I am
getting 404 error.

Any Gdata gurus here who can help?? I am using this raw approach since there
is no gdata apis for android yet.

public void authenticate() {
HttpClient hClient = new DefaultHttpClient();
HttpPost hPost = new HttpPost(
https://www.google.com/accounts/ClientLogin;);

ListNameValuePair nameValuePairs = new
ArrayListNameValuePair(5);
nameValuePairs.add(new BasicNameValuePair(Email,
xx...@gmail.com));
nameValuePairs.add(new BasicNameValuePair(Passwd,xx));
nameValuePairs.add(new BasicNameValuePair(accountType,GOOGLE));
nameValuePairs.add(new BasicNameValuePair(source,ExampleTest));
nameValuePairs.add(new BasicNameValuePair(service,wise));
try {
hPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

HttpResponse response = hClient.execute(hPost);

int status = response.getStatusLine().getStatusCode();
if(status == HttpStatus.SC_OK) {
String temp = EntityUtils.toString(response.getEntity());
authToken=getAuthString(temp);
}

} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


public void getWorksheetContents() {
HttpClient hClient = new DefaultHttpClient();
HttpResponse response;

HttpGet hGet = new HttpGet(worksheetsheetURL);
hGet.addHeader(Authorization,GoogleLogin auth=+authToken);


try {
response = hClient.execute(hGet);

int status = response.getStatusLine().getStatusCode();
Log.d(TAG,getWorksheetContents : +response.getStatusLine());
if(status == HttpStatus.SC_OK) {
String temp = EntityUtils.toString(response.getEntity());
Log.d(TAG, getWorksheetContents+temp);
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public String getAuthString(String content) {
int index=content.indexOf(Auth=);
Log.d(TAG, index = +index);
return content.substring(index+5);
}

-Dan

-- 
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: Need Samsung Moment user to help troubleshoot problems

2010-02-18 Thread shaun
I just read you other post and it covers pretty much the same subject
matter:
http://groups.google.com/group/android-developers/browse_thread/thread/26f577bca4cee64d#

I will try to step through to determine what EGL config is choosen.

I find is strange in my case because I have one user who comments that
...all I see are floating words that say 'Low Ding'  then the screen
goes black.  Since the words Low Ding are displayed using the same
code as all other image-backed sprites, it seems the EGL config was
chosen correctly and perhaps another error is occurring, maybe
when .. oh yeah, maybe it is the sounds...  I say sounds because
the Low Ding is displayed just before starting loading sounds.  Well,
now that just night be it.  Although, I would also expect the Yakoin
logo to be displayed along with Low Ding because the logo is loaded
and added to the scene just before Low Ding.



On Feb 18, 1:54 pm, shaun shashepp...@gmail.com wrote:
 Ernest,

 Your response is helpful.  I am not using
 android.opengl.GLSurfaceView, but I did try to get my EGL config
 chooser routine to look like what is provided therein.  Are you saying
 that if I did use GLSurfaceView from Android I would not have the
 issue?  If so, is there any specific parameters I would need to pass
 in for initialization of the GLSurfaceView or the Renderer in order
 for EGL config to be chosen properly?

 I thank you and look forward to any findings if you take a look at
 ongPay!

 On Feb 18, 1:00 am, ernestw ernest...@gmail.com wrote:



  Dan, thanks for the reply but I was able to get my hands on a Samsung
  Moment, confirm the issue, and provide a fix.  This particular problem
  was caused by a call to glDrawArrays.  In FRG, I use glDrawArrays with
  GL_LINES to draw parts of the in-game UI.  One of the calls to
  glDrawArrays passed an odd number for the 3rd parameter of
  glDrawArrays.  Effectively I was asking to draw a number of lines plus
  one point.  Apparently this doesn't cause issues on a HTC Dream,
  Magic, Hero, Nexus One, or Moto Droid.  On the Samsung Moment, the
  phone display freezes probably due to the CPU being pegged (I
  confirmed that when freeze occurs, logcat still logs CPU pegged?
  messages).

  Definitely a bad error on my part.  Dan, if you wish to see the bug in
  action, search Android Market for FRG Lite.  Watch out you'll have
  to pull the phone battery once it freezes.

  Shaun, a while ago I ran into one other crash bug on the Samsung
  Moment which was caused by my EGLConfig selection routine.  FRG tests
  available EGLConfigs by creating a small GLSurfaceView in the splash
  screen.  In it, I run a custom EGLConfig chooser and check if the
  resulting config is hardware accelerated or not.  If software
  rendering is used, I display a warning for the user and disable sound
  and music in hopes that the game will still run adequately.

  My original EGLConfig selection resulted in EGL_SLOW_CONFIGs (i.e.
  software renderer) being chosen for the Moment.  After the splash
  screen is finished, FRG would crash with a segfault.  My guess is the
  Moment fails horribly in cleaning up a software-rendered surface.  To
  fix this issue I had to make sure my EGLConfig routine didn't ignore
  unknown EGL_CONFIG_CAVEAT values, i.e., for hardware acceleration on
  the Samsung Moment, you must choose the EGLConfig that has
  EGL_CONFIG_CAVEAT that is not EGL_NONE, EGL_SLOW_CONFIG, nor
  EGL_NON_CONFORMANT_CONFIG.

  Not sure if you'd have this problem as your game would segfault
  without fail upon cleaning up any OpenGL surface.  You also have to be
  using your own EGLConfig chooser for the bug to possibly happen.  I
  have limited time with the Samsung Moment tomorrow but after I test
  out my fixes for awhile, I'll take a look at ongPay! and see how it
  behaves.

  On Feb 16, 11:07 pm, dan raaka danra...@gmail.com wrote:

   what game is this ? can you give the class name of your app for me to 
   search

   -Dan

   On Sat, Feb 13, 2010 at 6:28 PM, ernestw ernest...@gmail.com wrote:
Hi all - I'm currently getting some problem comments from people
claiming that my game FRG crashes on the Samsung Moment immediately
when a bullet hits an enemy.  Anybody have a Samsung Moment who could
help me figure out the issue?  I'd use DeviceAnywhere but their
Samsung Moment has been offline for the past 1.5 weeks.  :-\

Thanks in advance.

 Ernest Woo
 Woo Games
 http://www.woogames.com

--
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.comandroid-developers%2Bunsubs
 ­cr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en-Hide quoted text 
   -

  - Show quoted text -

-- 
You 

Re: [android-developers] Re: Intent.ACTION_SYNC no docs or resolveInfo

2010-02-18 Thread Dianne Hackborn
There is really no such thing as a global data sync.  You can write a
SyncAdapter to take care of syncing with a particular content provider, and
decide when to sync.  You can register a ContentObserver to see when the
data inside of a content provider changes.  A global concept of sync isn't
really there.

On Thu, Feb 18, 2010 at 2:09 PM, Alex Corbi a.co...@gmail.com wrote:

 HI,

 is there a way for an app to know when a data sync happens?

 It would be just great to be able to Register a BroadcastReceiver and
 handle that action, in my case instead of fire a data synchronization
 i would like to detect when it happens.

 is it possible?

 On Jan 25, 6:59 pm, Dianne Hackborn hack...@android.com wrote:
  You don't need to force a sync, when data changes on the servers the
 device
  is told and will get it.
 
  This action probably should never have been made public, and I don't
 think
  it does anything at this point.
 
  On Mon, Jan 25, 2010 at 9:44 AM, Vikas1976 vikas.shah.1...@gmail.com
 wrote:
 
 
 
 
 
   I am on board with this.  I have an app that sends a new entry to
   Google Calendar in the cloud; I would like to be able to force a sync
   with Google after adding the entry so that the entry shows up in the
   user's calendar on the device shortly after being added.  Is there
   anyone who has experience using ACTION_SYNC to let us know what sort
   of other information e.g. category or data that needs to be passed to
   the resolver in the intent to let the phone know to sync with Google?
   Does anyone know if the AccountManager is a way to get this done?
 
   Vikas
 
   On Jan 20, 12:20 pm, Arno den Hond arnodenh...@gmail.com wrote:
i would like to trigger the synchronize now feature (in the sync
settings screen) from my app.
i have found Intent.ACTION_SYNCbut the documentation states
 
Activity Action: Perform a data synchronization.
Input: ?
Output: ?
 
after creating the intent according to the action name, i used
PackageManager's queryIntentActivities method (with flag
GET_INTENT_FILTERS) and found that no ResolveInfo objects are
 returned
 
ideas on how to perform a data synchronization would be greatly
appreciated
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  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 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  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 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

Re: [android-developers] Tab Bar in Android

2010-02-18 Thread Sasikumar.S
ok...

On Fri, Feb 19, 2010 at 1:16 AM, TreKing treking...@gmail.com wrote:

 On Wed, Feb 17, 2010 at 11:25 PM, Sasikumar.S 
 sasikumar.it1...@gmail.comwrote:

 I need like that tab  bar in android .
 How to do that?

 Any suggestions ?


 Yes.

 1 - Get a book or two or three on Android.
 2 - Read the online documentation.
 3 - Read through the samples.
 4 - (This one is important) ... TRY TO GET WHAT YOU WANT ON YOUR OWN.
 5 - If you get stuck on a SPECIFIC problem, post here with a SPECIFIC
 question.
 6 - Stop posting here's a picture of what I want, how do I do it?
 questions, because no one is going to do your work for you.

 Seriously, a tab bar like that can be EASILY achieved if you put as much
 time into trying it for yourself as you do posting here trying to get people
 to give you answers.


 -
 TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thanks  Regards
Sasikumar.S

-- 
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: Deprecated Absolute layout ?

2010-02-18 Thread NoraBora
AFAIK, AbsoluteLayout does not support variable screen size like WVGA.

On Feb 16, 6:59 am, Mina Samyhttp://android-pro.blogspot.com;
m.s.ra...@gmail.com wrote:
 Hi all
 the absolute layout class is deprecated
 but still can write it in code and it works.
 will there be any problems if I use this class ? will the application
 work correctly after I deploy it on a phone ?
 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: rotate progress bar

2010-02-18 Thread NoraBora
To use vertical progressbar, you have to make your own widget
extending View, not ProgressBar.

the source of ProgressBar widget may help.

On Feb 16, 6:24 am, Jonathan jonathanmschm...@gmail.com wrote:
 HI, I am extending the normal android.widget.ProgressBar. I want to
 make it vertical. This is my current onDraw Method

         @Override
         protected synchronized void onDraw(Canvas canvas) {

                 canvas.save();
                  canvas.rotate(90);
                 canvas.translate(0,-50);
                 super.onDraw(canvas);
                 canvas.restore();
         }

 This rotates it fine, however I am having alot of sizing issues. It
 seems as though I have to set the width and the height of the control
 to be the same thing or else I run into alot of clipping issues.
 Basically, I want to have a progress bar that, once rotated, is 50dip
 wide and fills the screen vertically. Can anyone think of a way to do
 this?

 Also, it doesn't seem to be actually drawing the progress properly,
 but I will revisit that once I get the clipping sorted out.

 Thanks

 Jon

-- 
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: Simple Cursor Adapter - Listview Example

2010-02-18 Thread NoraBora
See ApiDemos in SDK

On Feb 16, 9:33 pm, Sasikumar.S sasikumar.it1...@gmail.com wrote:
 Hi,

 Any simple cursor adapter with listview example ?

 --
 Thanks  Regards
 Sasikumar.S

-- 
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: Deciding which method to call when intent is received

2010-02-18 Thread Babasaheb
Hi TreKing,

Thank you for the prompt reply.. :)
I will try your solution to see how it solves the problem..

Thanks

On Feb 18, 9:17 pm, TreKing treking...@gmail.com wrote:
 On Thu, Feb 18, 2010 at 8:47 AM, Babasaheb babadam...@gmail.com wrote:
  Is it possible to send an intent so that a specific action is taken at
  receiver side without broadcasting the intent?
  Is this correct method?
  How can I do that?
  Is there any other solution?

 I would recommend you look at the action portion of intents in the
 documentation. You can specify an action for an intent (using a default one
 or your own) and base what you do on that.

 --- 
 --
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

-- 
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: username and password for sample sync adapter

2010-02-18 Thread Sameer AM
Thanks a lot megha.. this is a relief, I'd try this and get back

-- 
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] Two processes are created some times at the time app starting?

2010-02-18 Thread pink 444
Hi,

   Some times at the time of application starting  up two processes
are created one has default process as parent and second has first as
parent.

  In this  scenario neither activity nor application is coming up.But
application code is being executed.

Any idea.

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: username and password for sample sync adapter

2010-02-18 Thread Sameer AM
Okay, I tried the user1/test on emulator and it added account
succesfully, and on the web side I added few handles and added few
friends on the same handle, and tried syncing the same on emulator,
and I am getting 500 internal server error, is there still something
wrong? I added one more user on the server and authenticated same from
emulator, it the accounts get added fine.

As far as hosting the python files for personal contact server is
concerned I'm afraid it might take time for me, as I'd have get
approval from my manager. So I wished if I could see the working with
the already existing db on server.

Thanks again

On Feb 19, 4:18 am, Megha mjo...@google.com wrote:
 Hi,

 I have uploaded the zipped source files for this sample 
 at:http://code.google.com/p/apps-for-android/downloads/list

 Sorry about the server related python source files not being visible
 on developer.android.com. We will fix it soon.
 This sample source will be available with the next sdk package, we are
 working on making zipped samples downloadable from
 developer.android.com itself in future.

 Regardingpasswordissue, please use account user1/test on
 samplesyncadapter server.

 I would recommend that to add new accounts, download the server code,
 modify it as you want and host it on a separate app engine instance.
 If you look at dashboard.py and app.yaml in server code it should be
 pretty clear how to do this..giving a short overview below:
 1) Add a new Sample SyncAdapter account @:
 http://yoursamplesyncadapter_server.appspot.com/add_user
 For example I have added user1:
 http://yoursamplesyncadapter_server.appspot.com/edit_user?user=1
 2) Enterusername/password@
 http://yoursamplesyncadapter_server.appspot.com/add_credentials
 Thepasswordfor user1 is test.
 3) Modify the android code to use your server instance.

 Sorry for the confusion so far, please let me know if you have more
 questions.

 Thanks,
 Megha

 On Feb 18, 10:28 am, HCH hayeshau...@gmail.com wrote:



  Could someone on the android team please tell us what we should use
  for thepasswordwhen connecting to the SampleSyncAdapter server?

  On Feb 16, 4:19 pm, HCH hayeshau...@gmail.com wrote:

   as for 1)

   - The source tree is not available for download that I can tell.  You
   have to cut and paste each individual file from the html and
   reconstruct the source tree locally.
   - The source to the server has a directory but is not actually there.
   - What to use as apasswordisn't clear and I can't find one (tried
   all values in the user account I created plus 'password', etc.).

   So even though there is now an example months after the OS shipped
   with this feature it isn't complete and was seemingly put up without
   much care.

   On Feb 16, 3:50 am, Sameer AM sam2...@gmail.com wrote:

Hello,

I just got thesamplesyncadaptercode running on the emulator, but
how do I add account in it when it asks forusernameandpassword?

And I have the following questions

1) SampleSyncAdapter is for 2.0 and in 2.0 emulator I don't see the
Accounts Syncoptions in the Settings, am I missing anything?
 -- so for this I compiled this app in 2.1 and ran on 2.1 emulator

2) In 2.0 emulator when I launch Accounts option from Contact app, it
crashes? I saw this a raised bug, is this solved?

-- 
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: Calling activity from inside a thread?

2010-02-18 Thread Steeler
Do you have a reference to the activity's context in your thread? If
so, I think you could do something like this:

Intent _intent = new Intent(yourContext, yourActivity.class);
yourContext.startActivity(_intent);

provided that yourActivity was declared in your manifest.

On Feb 18, 1:39 pm, Abhi abhishek.r.sha...@gmail.com wrote:
 Hi,

 I want to either use WiFiManager to toggle wifi from inside a thread
 or call another activity to do this, whichever is possible. I tried
 using the wifimanager class inside the thread but it didn't work.
 Could anyone tell me how to call an activity using Intents from inside
 a thread?

 Thanks,

 Abhi

-- 
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: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
Wow, dude...thanks! That was a thorough answer. Usually get a vague,
one sentence response that leaves me more confused than before.

I don't know why I said that thing about the custom adapter...I think
because I don't truly understand what it's doing and this activity
revolves around it.

Well, I need to digest all this and try it out. Thanks again.

Ken

On Feb 18, 5:24 pm, Bob Kerns r...@acm.org wrote:
 Using a custom ArrayAdapter doesn't seem to me to relate to your
 question, unless your problem is that it's broken. For example, if
 yours doesn't notify the registered DataSetObservers that the data has
 changed.

 As for async tasks -- what you're describing IS a one-shot task, in
 any sense that applies here. sure, you'll have more than one shot. But
 in between those shots, with an ASyncTask, that thread and all the
 memory required for its stack, will be available for use by OTHER
 AsyncTasks, including ones possibly launched by the SDK. You do have
 to create a new AsyncTask each time -- but that's a small price to pay
 for significantly smaller memory usage.

 So it's going to be more efficient than creating your own thread. Use
 your own thread if you have something that has continuously evolving
 state -- say some recursive process. Even then, you can generally
 modify it to work with an ASync task.

 I've read, on this list, I think, that early versions of ASyncTask
 limit the pool of threads it uses to one. If that's the case, and you
 run very long tasks, they may prevent other tasks from running. I
 wouldn't worry about that unless you run into it as a problem; then
 would be a time to either move your task into its own thread, or to
 split your task up so it operates as a series of smaller pieces. And
 it's my understanding that the pool is no longer limited to one
 thread, so this is a limitation that will fade.

 Still, if you are usually consuming one of those ASyncTask threads,
 you're really not getting any benefit from using an ASyncTask other
 than a convenient interface to moving that final action back to the UI
 thread. But it's not hard to do that yourself, either.

 If you DO run it on your own thread, you can post a message back to
 the main thread, using a Handler aimed at the main thread's Looper,
 which you can get via getMainLooper() on any Activity or Application
 or Service, or the static method Looper.getMainLooper(). If you just
 call Handler(), it picks up the Looper for the current thread -- I
 believe that's why AsyncTask states in its threading rules: The task
 instance must be created on the UI thread.. Basically, you'll be
 doing what AsyncTask does - but you'll have the flexibility to direct
 it t the UI thread even if you create it elsewhere. It seems like a
 character flaw that ASyncTask's default constructor isn't hardwired to
 send things to the UI thread -- it would prevent a lot of preventable
 bugs.

 Just put any code you'd have put in the onPostExecute(Result) method
 into the runnable you post to your handler.

 By default, when you flip the orientation, indeed, your activity is
 destroyed and recreated. But you can specify in the manifest what
 configuration change events you're prepared to handle yourself, and
 handle them in onCofigurationChanged(Configuration). If all that's
 needed is a layout change, you may not need to do anything at all in
 this method other than call  super.onConfugrationChanged(newConfig) --
 which, of course, means you don't really need to define the method at
 all. I recommend doing so, however, to flag that you're actually doing
 this, and that here's where any configuration change happens. If you
 have elements of your UI that scroll, you may need to reset the scroll
 position here. I've seen a number of apps that appear not to do this,
 and it's annoying.

 While you can tell that a Thread has ended by checking its state,
 that's not how you SHOULD be doing things. In Android, use a Handler
 and post whatever action you want to perform when the thread is ended.

 At a lower Java level, use the wait/notify protocol to synchronize.
 There's a clear and reliable usage pattern you can use, but it's a bit
 complicated to describe, and doing it wrong results in subtle bugs.

 You may want to consider using a try block, and posting your final
 action from the finally clause. Declare a variable 'ok' at the start
 of your function, and set it to  true when you reach the end of your
 code. Choose what code to run in the success and error/failure case
 based on the flag. This is a good way to communicate errors back to
 the main thread.

 I hope all that makes sense...

 On Feb 18, 4:03 pm, Ken H hunt1...@gmail.com wrote:



  But what if you're using a custom ArrayAdapter? Also, I *think*
  AsyncTask is meant for one shot type tasks. A user of this app may
  update this listview multiple times.

  But here is something I've discovered: if I change the orientation of
  the screen, the list is properly updated. Question: how can I 

[android-developers] Re: Stop Surface View being destroyed

2010-02-18 Thread Steeler
One thing that comes to mind is using an AlertDialog for the name
prompt instead of a View.

On Feb 18, 4:39 am, Adrian Hirst adrian.hi...@gmail.com wrote:
 Hi,

 I have created a game that uses SurfaceView and need input for player
 to enter there name so I created a View xml that allows the player to
 enter there name with the virtual keyboard.

 The problem I have is when I call setContentView(nameView) it destroys
 the surfaceview and everything associated with it is there away to
 preserve the SurfaceView as it gets rid of all the gfx that have been
 loaded.

 Thanks

 Adrian

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


RE: [android-developers] Re: Google Chart API

2010-02-18 Thread Tommy
Ah ok thank you!!

-Original Message-
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Shrenik Vikam
Sent: Thursday, February 18, 2010 12:52 AM
To: Android Developers
Subject: [android-developers] Re: Google Chart API

You can use google chart api ,
 but u need to use it with WebView   also you need internet
connectivity to see the chart.

On Feb 18, 5:26 am, Tommy droi...@gmail.com wrote:
 Anyone??

 -Original Message-
 From: android-developers@googlegroups.com

 [mailto:android-develop...@googlegroups.com] On Behalf Of Tommy
 Sent: Tuesday, February 16, 2010 10:55 PM
 To: Android Developers
 Subject: [android-developers] Google Chart API

 Can I use the google chart API in an android project? If so can anyone
 link some examples?

 Thanks for your time!

 --
 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
athttp://groups.google.com/group/android-developers?hl=en

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

-- 
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] Cannot get textAppearance to inherit/cascade from theme

2010-02-18 Thread Walt Armour
I have a simple style like this:

style parent=android:Theme.Light.NoTitleBar name=MyTheme
item name=android:colorBackground#FF/item
item name=android:textAppearance@style/PrimaryText/
item
/style

And a simple style like this:

style parent=@android:style/TextAppearance name=PrimaryText
item name=android:textColor#FF/item
item name=android:textSize14sp/item
/style

Now, I would expect (from reading everything that is documented) that
if I set the theme for my application like so:

application android:icon=@drawable/app_icon
android:name=.MyApp
android:theme=@style/MyTheme 

then anything in my app that has a textAppearance attribute (like a
TextView) would inherit the attributes from MyTheme (and thus the
attributes from PrimaryText).

But they don't.  I tried setting the theme on the specific activity
(in the manifest) and that did not work.  I set the style attribute on
the containing layout like this:

LinearLayout
  android:id=@+id/myLayout
  android:orientation=vertical
  android:layout_width=fill_parent
  android:layout_height=fill_parent
  android:layout_margin=5sp
  style=@style/MyTheme
  android:background=@drawable/round_border

and that did nothing (which I believe is expected since this cascading
inheritance should only work when applied as a 'theme').

Am I missing something obvious here?  Right now I have to set the
textAppearance (or style) attribute on every single TextView to get
the style.  The pain is great.  Does anyone have a suggestion on a way
to get this to work?

While working this I also hit another oddity that may or may not be
related.  If I take the specific attributes (like textColor and
textSize) and put them in MyTheme then they do correctly cascade and
apply to all my text.  The problem is that they then cannot be
overridden by a style.  If I set textAppearance on a TextView it
appears to be ignored.  However, if I explicitly set textColor or
textSize then it will be honored and override the theme setting for
that TextView.

In general it feels like there is some missing wiring or a bit of
inconsistency in the application of themes and styling attributes.

-- 
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] CursorAdapter Listview Text Filter

2010-02-18 Thread Sasikumar.S
Hi,,\


I'm using a listview with cursoradapter. How to set Text filter for that
listview ?.

-- 
Thanks  Regards
Sasikumar.S

-- 
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 get current time accurately?

2010-02-18 Thread ko5tik


On Feb 18, 9:44 am, Yoshinori yoshinori...@gmail.com wrote:
 Hi

 I want to get current time accurately.
 I tried to get the time by System.currentTimeMillis() but it has the
 effect on the modificaion by User. So it is not useful for me.

 Could you kindly tell me how to get current time accurately?

Use System.nanoTime() if you need accurate intervals

-- 
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: Retrieving data from portrait to landscape

2010-02-18 Thread ivar
you have to save the necessary data as part of the bundle in the
method, onSaveInstanceState and onCreate(bundle), you should if there
is any data in the bundle. if there is get the data from the bundle
and use that data.

-Ravi

On Feb 18, 1:29 pm, sid wakeupsi...@gmail.com wrote:
 Hi All,

 For changing from portrait to landscape mode i have done some changes
 in manifest.xml and included some code in test.java file

 In manifest.xml i have included activity_name
 android:configChanges=orientation/

 i entered some data in portrait mode.
 but when i rotate my mobile from portrait to landscape the control
 goes to onConfigurationChanged() method.

 public void onConfigurationChanged(Configuration newConfig)
 {
         super.onConfigurationChanged(newConfig);
         setContentView(R.layout.screen1_landscape);

 }

 in the above method im displaying one more new screen..
 here is the problem that the data entered in portrait mode is not
 retrieving in landscape mode..

 Please let me know where am going wrong???

-- 
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: Intent.ACTION_SYNC no docs or resolveInfo

2010-02-18 Thread Alex Corbi
Ok Thanks Dianne,

What interest me is detecting when new GMail is being received.

Wich is the uri of the Gmail content provider?

content://gmail-ls ???

is there any documentation somewhere about how the information is
being stored in this Content-Provider.

On Feb 19, 4:03 am, Dianne Hackborn hack...@android.com wrote:
 There is really no such thing as a global data sync.  You can write a
 SyncAdapter to take care of syncing with a particular content provider, and
 decide when to sync.  You can register a ContentObserver to see when the
 data inside of a content provider changes.  A global concept of sync isn't
 really there.





 On Thu, Feb 18, 2010 at 2:09 PM, Alex Corbi a.co...@gmail.com wrote:
  HI,

  is there a way for an app to know when a data sync happens?

  It would be just great to be able to Register a BroadcastReceiver and
  handle that action, in my case instead of fire a data synchronization
  i would like to detect when it happens.

  is it possible?

  On Jan 25, 6:59 pm, Dianne Hackborn hack...@android.com wrote:
   You don't need to force a sync, when data changes on the servers the
  device
   is told and will get it.

   This action probably should never have been made public, and I don't
  think
   it does anything at this point.

   On Mon, Jan 25, 2010 at 9:44 AM, Vikas1976 vikas.shah.1...@gmail.com
  wrote:

I am on board with this.  I have an app that sends a new entry to
Google Calendar in the cloud; I would like to be able to force a sync
with Google after adding the entry so that the entry shows up in the
user's calendar on the device shortly after being added.  Is there
anyone who has experience using ACTION_SYNC to let us know what sort
of other information e.g. category or data that needs to be passed to
the resolver in the intent to let the phone know to sync with Google?
Does anyone know if the AccountManager is a way to get this done?

Vikas

On Jan 20, 12:20 pm, Arno den Hond arnodenh...@gmail.com wrote:
 i would like to trigger the synchronize now feature (in the sync
 settings screen) from my app.
 i have found Intent.ACTION_SYNCbut the documentation states

 Activity Action: Perform a data synchronization.
 Input: ?
 Output: ?

 after creating the intent according to the action name, i used
 PackageManager's queryIntentActivities method (with flag
 GET_INTENT_FILTERS) and found that no ResolveInfo objects are
  returned

 ideas on how to perform a data synchronization would be greatly
 appreciated

--
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.comandroid-developers%2Bunsubs
 cr...@googlegroups.comandroid-developers%2Bunsubs
  cr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   Note: please don't send private questions to me, as I don't have time to
   provide private support, and so won't reply to such e-mails.  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 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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  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 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: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
Just tried the asynctask again, and it works. Basically I put the time
consuming part in doInBackground(), and then launched a progressDialog
in onProgressUpdate() to let users know nothing froze, and finally
dismissed the progrssDialog in onPostExecute(). Also added the final
refresh of the listview there.

Thanks again guys.

Ken

On Feb 18, 10:10 pm, Ken H hunt1...@gmail.com wrote:
 Wow, dude...thanks! That was a thorough answer. Usually get a vague,
 one sentence response that leaves me more confused than before.

 I don't know why I said that thing about the custom adapter...I think
 because I don't truly understand what it's doing and this activity
 revolves around it.

 Well, I need to digest all this and try it out. Thanks again.

 Ken

 On Feb 18, 5:24 pm, Bob Kerns r...@acm.org wrote:



  Using a custom ArrayAdapter doesn't seem to me to relate to your
  question, unless your problem is that it's broken. For example, if
  yours doesn't notify the registered DataSetObservers that the data has
  changed.

  As for async tasks -- what you're describing IS a one-shot task, in
  any sense that applies here. sure, you'll have more than one shot. But
  in between those shots, with an ASyncTask, that thread and all the
  memory required for its stack, will be available for use by OTHER
  AsyncTasks, including ones possibly launched by the SDK. You do have
  to create a new AsyncTask each time -- but that's a small price to pay
  for significantly smaller memory usage.

  So it's going to be more efficient than creating your own thread. Use
  your own thread if you have something that has continuously evolving
  state -- say some recursive process. Even then, you can generally
  modify it to work with an ASync task.

  I've read, on this list, I think, that early versions of ASyncTask
  limit the pool of threads it uses to one. If that's the case, and you
  run very long tasks, they may prevent other tasks from running. I
  wouldn't worry about that unless you run into it as a problem; then
  would be a time to either move your task into its own thread, or to
  split your task up so it operates as a series of smaller pieces. And
  it's my understanding that the pool is no longer limited to one
  thread, so this is a limitation that will fade.

  Still, if you are usually consuming one of those ASyncTask threads,
  you're really not getting any benefit from using an ASyncTask other
  than a convenient interface to moving that final action back to the UI
  thread. But it's not hard to do that yourself, either.

  If you DO run it on your own thread, you can post a message back to
  the main thread, using a Handler aimed at the main thread's Looper,
  which you can get via getMainLooper() on any Activity or Application
  or Service, or the static method Looper.getMainLooper(). If you just
  call Handler(), it picks up the Looper for the current thread -- I
  believe that's why AsyncTask states in its threading rules: The task
  instance must be created on the UI thread.. Basically, you'll be
  doing what AsyncTask does - but you'll have the flexibility to direct
  it t the UI thread even if you create it elsewhere. It seems like a
  character flaw that ASyncTask's default constructor isn't hardwired to
  send things to the UI thread -- it would prevent a lot of preventable
  bugs.

  Just put any code you'd have put in the onPostExecute(Result) method
  into the runnable you post to your handler.

  By default, when you flip the orientation, indeed, your activity is
  destroyed and recreated. But you can specify in the manifest what
  configuration change events you're prepared to handle yourself, and
  handle them in onCofigurationChanged(Configuration). If all that's
  needed is a layout change, you may not need to do anything at all in
  this method other than call  super.onConfugrationChanged(newConfig) --
  which, of course, means you don't really need to define the method at
  all. I recommend doing so, however, to flag that you're actually doing
  this, and that here's where any configuration change happens. If you
  have elements of your UI that scroll, you may need to reset the scroll
  position here. I've seen a number of apps that appear not to do this,
  and it's annoying.

  While you can tell that a Thread has ended by checking its state,
  that's not how you SHOULD be doing things. In Android, use a Handler
  and post whatever action you want to perform when the thread is ended.

  At a lower Java level, use the wait/notify protocol to synchronize.
  There's a clear and reliable usage pattern you can use, but it's a bit
  complicated to describe, and doing it wrong results in subtle bugs.

  You may want to consider using a try block, and posting your final
  action from the finally clause. Declare a variable 'ok' at the start
  of your function, and set it to  true when you reach the end of your
  code. Choose what code to run in the success and error/failure case
  based on the flag. This 

<    1   2