[android-developers] Re: Check for internet connection

2009-08-21 Thread Guru
/**
 * Checks whether the device is able to connect to the network
 * @param context
 * @return
 */
public static boolean isNetworkAvailable(Context context) {

ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
Log.w("tag", "couldn't get connectivity manager");

} else {
NetworkInfo[] info = connectivity.getAllNetworkInfo();

if (info != null) {

for (int i = 0; i < info.length; i++) {

if (info[i].getState() == NetworkInfo.State.CONNECTED) {

return true;

}

}

}
}
return false;
}

On Fri, Aug 21, 2009 at 3:54 AM, cafffiene  wrote:

>
> What is the simplest way to check whether my app can access the
> internet?  I am using some APIs that use the internet, but they crash
> if there is no connectivity.  So I just want to check if there is
> internet access by any means.  thanks
> >
>


-- 
Thanks and Regards
Gurudutt P.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] unable to add a new layout.xml

2009-08-21 Thread phil

using eclipse 3.4.1 and also 3.5 and I cannot seem to add a new
layout .xml file.

i tried adding it externally using windows explorer, but got all these
errors.

[2009-08-21 00:01:54 - SlackerRadioAndroid] (skipping index file
'C:\workspace\TestProject\res\drawable\Thumbs.db')
[2009-08-21 00:01:54 - SlackerRadioAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]
[2009-08-21 00:01:54 - SlackerRadioAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]



then i tried right click on the layout folder, selected new Android
XML file and I got this --

The selected wizard could not be started.
  Plug-in com.android.ide.eclipse.adt was unable to load class
com.android.ide.eclipse.editors.wizards.NewXmlFileWizard.
  com.android.ide.eclipse.editors.wizards.NewXmlFileWizard

I tried both versions of eclipse, I tried uninstalling and
reinstalling the ADT plugin.  Nothing seems to be working!



tia.
--~--~-~--~~~---~--~~
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] unable to add a new layout xml file.

2009-08-21 Thread phil

using eclipse 3.4.1 and also 3.5 and I cannot seem to add a new
layout .xml file.

i tried adding it externally using windows explorer, but got all these
errors.

[2009-08-21 00:01:54 - TestAndroid] (skipping index file
'C:\workspace\TestProject\res\drawable\Thumbs.db')
[2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]
[2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
Invalid file name: must contain only [a-z0-9_.]

then i tried right click on the layout folder, selected new Android
XML file and I got this --

The selected wizard could not be started.
  Plug-in com.android.ide.eclipse.adt was unable to load class
com.android.ide.eclipse.editors.wizards.NewXmlFileWizard.
  com.android.ide.eclipse.editors.wizards.NewXmlFileWizard

I tried both versions of eclipse, I tried uninstalling and
reinstalling the ADT plugin.  Nothing seems to be working!

tia.
--~--~-~--~~~---~--~~
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 force Activity in landscape mode without Activity restart

2009-08-21 Thread String

On Aug 21, 5:36 am, yoshitaka tokusho  wrote:

> I have a problem to start/create Activity in landscape mode. My
> Activity need to start in landscape mode and be used in landscape mode
> by users.

Are you able to use android:screenOrientation="landscape" in your
manifest's activity tag? I don't know if that's mutable at runtime, or
if you need it to be. But it might be an option for you.

String
--~--~-~--~~~---~--~~
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: Where do we have to close the DB in a ContentProvider?

2009-08-21 Thread S. Mccoy

Hi all,

I have seen that if we use an AbstractSyncableContentProvider (other
providers like ContactProvider use it), a “close()” method is
implemented:
public void close(){
if(mOpenHelper != null)
mOpenHelper.close();
}
In this case, the helper seems to be closed (and also de DB), the same
helper that remains open in a ContentProvider. I can’t understand the
lifecycle of the ContentProvider without a method to release all the
things. Any ideas ?.-Thanks in advance.

S.

On 18 ago, 18:00, "S. Mccoy"  wrote:
> Maybe it’s an easy question, but I’ve tried to understand why all the
> content providers seem not to close the DB that they use. In the
> NotePadProvider example (in other providers is similar), it’s used a
> Helper to manage the DB (that extends of SQLiteOpenHelper). This
> helper has a method to close the DB (http://developer.android.com/
> reference/android/database/sqlite/SQLiteOpenHelper.html#close%28%29),
> but in all the providers that I have seen (even in the example), this
> method is never used.
>
> For example, in the query method of the NotPadProvider we use the
> helper to open a DB
>
> // Get the database and run the query         SQLiteDatabase db =
> mOpenHelper.getReadableDatabase();         Cursor c = qb.query(db,
> projection, selection, selectionArgs, null, null,
> orderBy);          // Tell the cursor what uri to watch, so it knows
> when its source data changes         c.setNotificationUri(getContext
> ().getContentResolver(), uri);         return c;
>
> the mOpenHelper is create in the “onCreate()” method, but there is no
> reference to a mOpenHelper.close() in all the provider (maybe because
> there is no “close()” method in ContentProvider).
>
> Do we need to close the SQLiteOpenHelper object? When we use it inside
> a ContentProvider, where is the right place to close it?
>
> Thanks in advance.
> 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: unable to add a new layout xml file.

2009-08-21 Thread phil

weird.  changed it so that the file did not have capital letters and
it worked.  not sure why capital letters in the filename would throw
it for a loop *sigh*

On Aug 21, 12:12 am, phil  wrote:
> using eclipse 3.4.1 and also 3.5 and I cannot seem to add a new
> layout .xml file.
>
> i tried adding it externally using windows explorer, but got all these
> errors.
>
> [2009-08-21 00:01:54 - TestAndroid]     (skipping index file
> 'C:\workspace\TestProject\res\drawable\Thumbs.db')
> [2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
> Invalid file name: must contain only [a-z0-9_.]
> [2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
> Invalid file name: must contain only [a-z0-9_.]
>
> then i tried right click on the layout folder, selected new Android
> XML file and I got this --
>
> The selected wizard could not be started.
>   Plug-in com.android.ide.eclipse.adt was unable to load class
> com.android.ide.eclipse.editors.wizards.NewXmlFileWizard.
>   com.android.ide.eclipse.editors.wizards.NewXmlFileWizard
>
> I tried both versions of eclipse, I tried uninstalling and
> reinstalling the ADT plugin.  Nothing seems to be working!
>
> tia.
--~--~-~--~~~---~--~~
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 i use RotateAnimation to make a Drawable rotate?

2009-08-21 Thread lucky4me

Look at API Demos AnimationDrawable.java sample

http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.html

On Aug 21, 10:40 am, bear tung  wrote:
> I want to draw some Drawables in a view, for example like Rect. Then I want
> to make a totate animation for each Rect when it's be clicked.
> I try to use RotateAnimation, but it not work. It look likes only can make a
> View rotating.
>
> so, how can I make this work?
>
> thanks a lot
>
> Bear
--~--~-~--~~~---~--~~
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] if current android supports 3GPP Rel-8 SMS extended character table?

2009-08-21 Thread rtm

As title,
If yes, how to verify it?

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] unsubscribe to group mot working

2009-08-21 Thread Ehab Bassilli
Hi,

I cannot unsubscribe to this group. When sending an email to the unsubscribe
account, it is being rejected.

If google are reading this could you fix it? Also your ADC2 rules are
unfair. Just for your information.

Thanks

On Aug 21, 2009 6:40 AM, "bear tung"  wrote:

I want to draw some Drawables in a view, for example like Rect. Then I want
to make a totate animation for each Rect when it's be clicked.
I try to use RotateAnimation, but it not work. It look likes only can make a
View rotating.

so, how can I make this work?

thanks a lot


Bear


--~--~-~--~~~---~--~~
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: Where do we have to close the DB in a ContentProvider?

2009-08-21 Thread jiaoni

Hi S,

I use a DBHelper class which extends the SQLiteOpenHelper class, and I
close it in the onDestroy() function of the Activity class.

Jiaoni

On Aug 21, 3:15 pm, "S. Mccoy"  wrote:
> Hi all,
>
> I have seen that if we use an AbstractSyncableContentProvider (other
> providers like ContactProvider use it), a “close()” method is
> implemented:
> public void close(){
>     if(mOpenHelper != null)
>         mOpenHelper.close();}
>
> In this case, the helper seems to be closed (and also de DB), the same
> helper that remains open in a ContentProvider. I can’t understand the
> lifecycle of the ContentProvider without a method to release all the
> things. Any ideas ?.-Thanks in advance.
>
> S.
>
> On 18 ago, 18:00, "S. Mccoy"  wrote:
>
> > Maybe it’s an easy question, but I’ve tried to understand why all the
> > content providers seem not to close the DB that they use. In the
> > NotePadProvider example (in other providers is similar), it’s used a
> > Helper to manage the DB (that extends of SQLiteOpenHelper). This
> > helper has a method to close the DB (http://developer.android.com/
> > reference/android/database/sqlite/SQLiteOpenHelper.html#close%28%29),
> > but in all the providers that I have seen (even in the example), this
> > method is never used.
>
> > For example, in the query method of the NotPadProvider we use the
> > helper to open a DB
>
> > // Get the database and run the query         SQLiteDatabase db =
> > mOpenHelper.getReadableDatabase();         Cursor c = qb.query(db,
> > projection, selection, selectionArgs, null, null,
> > orderBy);          // Tell the cursor what uri to watch, so it knows
> > when its source data changes         c.setNotificationUri(getContext
> > ().getContentResolver(), uri);         return c;
>
> > the mOpenHelper is create in the “onCreate()” method, but there is no
> > reference to a mOpenHelper.close() in all the provider (maybe because
> > there is no “close()” method in ContentProvider).
>
> > Do we need to close the SQLiteOpenHelper object? When we use it inside
> > a ContentProvider, where is the right place to close it?
>
> > Thanks in advance.
> > 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] populating a ListView in xml...

2009-08-21 Thread sdphil

I want to create a list view with limited set of items that isn't
really going to change.

Each row is going to have an image on the left and right and text in
the middle.

Can I populate that in XML (i.e. avoid writing code) ?




tia.
--~--~-~--~~~---~--~~
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] My emulator is running 100% CPU, it's annoying..

2009-08-21 Thread jiaoni

Hi,

Many times (not all the times), my emulator is running 100% of one of
my two CPUs on the machine.

Can anyone tell me why it is so, and how can I reduce the cpu usage?

Thanks a lot,
Jiaoni
--~--~-~--~~~---~--~~
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] just renaming the file seems to help.

2009-08-21 Thread sdphil

i have an incredibly weird issue --

I have an image button --



The button doesn't show up.

If i copy the file in the drawable directory to "btn2" (the exact same
file) and change the src in the xml to point to the new file "btn2",
it shows up.  if i rename it back to btn1, it doesn't show up again.

then some time later, after adding some other buttons, btn1 reappears,
but a later button I've added goes missing again.  Then I do the same
trick of copying the file to another copy, rename it, and change the
src in the xml and it appears again!!

very unusual.  any ideas on what could be happening?

tia.
--~--~-~--~~~---~--~~
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 JUnitReports via android.test.InstrumentationTestRunner

2009-08-21 Thread Binesy

Thanks i'll look into that :)

Binesy

On Aug 20, 5:45 pm, Brett Chabot  wrote:
> I'm not familiar with JUnitReports, but one way you could do this is
> to parse the results outputted by 'adb shell am instrument -r -w ...",
> and convert it into whatever XML format you needed.
>
> There is existing parsing code in the Android open source project at
> development/testrunner and
> development/tools/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner
> you could use as a library.
>
> Brett.
>
>
>
> On Thu, Aug 20, 2009 at 3:40 AM, Binesy wrote:
>
> > Hi
>
> > I am trying to get my unit test output in XML format so I can plug it
> > into a Hudson build server.  From my research I should be using
> > JUnitReports, but how can I get these via the
> > android.test.InstrumentationTestRunner?
>
> > Many Thanks
>
> > Binesy
--~--~-~--~~~---~--~~
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: Where do we have to close the DB in a ContentProvider?

2009-08-21 Thread S. Mccoy

Hi,

  With an Activity there is no problem, the lifecycle is clear and we
have to realease all the resources in that method. The problem is that
I use this helper inside a ContentProvider. In this case there is
neither clear lifecycle (almost for me) nor a “close()” or “onDestroy
()” method where release the resources.

S.


On 21 ago, 09:54, jiaoni  wrote:
> Hi S,
>
> I use a DBHelper class which extends the SQLiteOpenHelper class, and I
> close it in the onDestroy() function of the Activity class.
>
> Jiaoni
>
> On Aug 21, 3:15 pm, "S. Mccoy"  wrote:
>
> > Hi all,
>
> > I have seen that if we use an AbstractSyncableContentProvider (other
> > providers like ContactProvider use it), a “close()” method is
> > implemented:
> > public void close(){
> >     if(mOpenHelper != null)
> >         mOpenHelper.close();}
>
> > In this case, the helper seems to be closed (and also de DB), the same
> > helper that remains open in a ContentProvider. I can’t understand the
> > lifecycle of the ContentProvider without a method to release all the
> > things. Any ideas ?.-Thanks in advance.
>
> > S.
>
> > On 18 ago, 18:00, "S. Mccoy"  wrote:
>
> > > Maybe it’s an easy question, but I’ve tried to understand why all the
> > > content providers seem not to close the DB that they use. In the
> > > NotePadProvider example (in other providers is similar), it’s used a
> > > Helper to manage the DB (that extends of SQLiteOpenHelper). This
> > > helper has a method to close the DB (http://developer.android.com/
> > > reference/android/database/sqlite/SQLiteOpenHelper.html#close%28%29),
> > > but in all the providers that I have seen (even in the example), this
> > > method is never used.
>
> > > For example, in the query method of the NotPadProvider we use the
> > > helper to open a DB
>
> > > // Get the database and run the query         SQLiteDatabase db =
> > > mOpenHelper.getReadableDatabase();         Cursor c = qb.query(db,
> > > projection, selection, selectionArgs, null, null,
> > > orderBy);          // Tell the cursor what uri to watch, so it knows
> > > when its source data changes         c.setNotificationUri(getContext
> > > ().getContentResolver(), uri);         return c;
>
> > > the mOpenHelper is create in the “onCreate()” method, but there is no
> > > reference to a mOpenHelper.close() in all the provider (maybe because
> > > there is no “close()” method in ContentProvider).
>
> > > Do we need to close the SQLiteOpenHelper object? When we use it inside
> > > a ContentProvider, where is the right place to close it?
>
> > > Thanks in advance.
> > > 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 share datas between tabs in a TabActivity

2009-08-21 Thread Tom

Thanks for the answer.

No problem for putting data into bundle property.
But, I don't know how retrieve that property when I do getParent in my
tab1?
Can you explain me?
Thanks

Tom

On 7 août, 10:10, Tinuz  wrote:
> What i did is the following:
> You have tab1 and tab2 which reside in a tab activity.
> In tab1 runs activity1 and in tab2 runs activity2.
>
> When you finish your operation in tab1, you retreive the parent
> activity which is the tab activity.
> In this tab activity you have a Bundle property. You put the data
> which you want tosharein the Bundle property.
> Now when  you goto tab2 with activity2, you also retreive the parent
> activity (tab activity) and read out the Bundle property.
>
> Works for me!
>
> When
>
> On Jun 16, 12:11 pm, Tom  wrote:
>
> > I'm going to precise my question :
>
> > In one of the tab, I've a ListActivity.
> > I would like to retrieve data from ListActivity from the TabActivity.
> > Is it possible?
>
> > Best regards
> > Tom
>
> > On 15 juin, 17:35, Tom  wrote:
>
> > > Hi,
>
> > > I created a TabActivity with contains 3 tabs. Each tab's content sets
> > > different Intents. All these Intents extended ListActivity.
>
> > > Is it possible to retrieve informations from these three activities in
> > > the main TabActivity?
>
> > > Here are some of my codes :
>
> > > public class Temp extends TabActivity{
>
> > >         �...@override
> > >             protected void onCreate(Bundle savedInstanceState) {
> > >                 super.onCreate(savedInstanceState);
> > >                 final TabHost tabHost =  getTabHost();
>
> > >                 // First tab
> > >                 TabHost.TabSpec userTab = tabHost.newTabSpec();
> > >                 secTab.setIndicator(this.getString("Activity2"));
> > >                 secTab.setContent(new Intent(this,Activity2.class));
>
> > >                 // Second tab
> > >                 TabHost.TabSpec secTab = tabHost.newTabSpec();
> > >                 secTab.setIndicator(this.getString("Activity2"));
> > >                 secTab.setContent(new Intent(this,Activity2.class));
>
> > >                 // Third tab
> > >                 TabHost.TabSpec thirdTab = tabHost.newTabSpec();
> > >                 thirdTab.setIndicator(this.getString("Activity3"));
> > >                 thirdTab.setContent(new Intent(this,Activity3.class));
> > >         }
>
> > > }
>
> > > Precisely, I would like to getdatasfrom "Activity1", "Activity2" and
> > > "Activity3".
>
> > > Thanks
> > > Best regards
> > > Tom
--~--~-~--~~~---~--~~
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: Playing a video file from resource.

2009-08-21 Thread Zeeshan Muhammad
this might help you
AssetFileDescriptor afd = getResources().openRawResourceFd(R.raw.video);


// Create a new media player and set the listeners
mMediaPlayer = new MediaPlayer();

mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());


On Fri, Aug 21, 2009 at 4:46 AM, rizwan  wrote:

>
> Hi All,
>
> From weeeks i m trying to play a video file from raw folder .but no
> success. I have used this code
>
>   setContentView(R.layout.mediaplayer_2);
>mPreview = (SurfaceView) findViewById(R.id.surface);
>holder = mPreview.getHolder();
>
> // Create a new media player and set the listeners
>mMediaPlayer = MediaPlayer.create(this, R.raw.lucky);
>mMediaPlayer.setDisplay(holder);
>mMediaPlayer.prepare();
>mMediaPlayer.setOnBufferingUpdateListener(this);
>mMediaPlayer.setOnCompletionListener(this);
>mMediaPlayer.setOnPreparedListener(this);
>mMediaPlayer.setAudioStreamType
> (AudioManager.STREAM_MUSIC);
>
> } catch (Exception e) {
>
>Log.e(TAG, "error: " + e.getMessage(), e);
>}
>
> }
>
> public void onBufferingUpdate(MediaPlayer arg0, int percent) {
> Log.d(TAG, "onBufferingUpdate percent:" + percent);
>
> }
>
> public void onCompletion(MediaPlayer arg0) {
> Log.d(TAG, "onCompletion called");
>
> }
>
> public void onPrepared(MediaPlayer mediaplayer) {
>Log.d(TAG, "onPrepared called");
> mVideoWidth = mMediaPlayer.getVideoWidth();
> mVideoHeight = mMediaPlayer.getVideoHeight();
> if (mVideoWidth != 0 && mVideoHeight != 0) {
>  holder.setFixedSize(mVideoWidth, mVideoHeight);
>  mMediaPlayer.start();
>
> }
>
> while I try to run the above I can hear the audio of video file but no
> video. please advise .
> I m trying to play http://www.mp4mail.com/docs/files/disney_128v_16a.mp4
> (mp4 )
> but having no luck please advise me .
>
> Thanks
> Rizwan
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: ParseException: At line 1, column 0: not well-formed (invalid token)

2009-08-21 Thread Zeeshan Muhammad
can anybody help?

On Thu, Aug 20, 2009 at 4:58 PM, zeeshan  wrote:

>
> Hi Dear,
>
> i am totally lost in this error:
>
> org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column
> 0: not well-formed (invalid token)
>
> i have spent the whole day trying to figure out why i am getting this
> error but not seems to have any luck
>
> here is the faulty code android doesn't like
>
> Xml.parse(is, Xml.findEncodingByName("UTF-8"), handler);
>
>
>
> as far as i know, nothing wrong in the xml below in my sdcard.
>
> 
> 
>  
>  
>  
> 
>
>
>
>
> please anybody help me out
> >
>

--~--~-~--~~~---~--~~
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: Playing a video file from resource.

2009-08-21 Thread Panut Sunyakorn

VideoView video = (VideoView) this.findViewById(R.id.VideoViewIntro);

Uri uri = Uri.parse("android.resource://);
video.setVideoURI(uri);
video.setMediaController(new MediaController(this));
video.requestFocus();
video.setOnCompletionListener(this);
video.start();



2009/8/21 Zeeshan Muhammad :
> this might help you
> AssetFileDescriptor afd = getResources().openRawResourceFd(R.raw.video);
>
>     // Create a new media player and set the listeners
>     mMediaPlayer = new MediaPlayer();
>
>     mMediaPlayer.setDataSource(afd.getFileDescriptor(),
> afd.getStartOffset(), afd.getLength());
>
>
> On Fri, Aug 21, 2009 at 4:46 AM, rizwan  wrote:
>>
>> Hi All,
>>
>> From weeeks i m trying to play a video file from raw folder .but no
>> success. I have used this code
>>
>>               setContentView(R.layout.mediaplayer_2);
>>                mPreview = (SurfaceView) findViewById(R.id.surface);
>>                holder = mPreview.getHolder();
>>
>> // Create a new media player and set the listeners
>>                mMediaPlayer = MediaPlayer.create(this, R.raw.lucky);
>>                mMediaPlayer.setDisplay(holder);
>>                mMediaPlayer.prepare();
>>                mMediaPlayer.setOnBufferingUpdateListener(this);
>>                mMediaPlayer.setOnCompletionListener(this);
>>                mMediaPlayer.setOnPreparedListener(this);
>>                mMediaPlayer.setAudioStreamType
>> (AudioManager.STREAM_MUSIC);
>>
>> } catch (Exception e) {
>>
>>        Log.e(TAG, "error: " + e.getMessage(), e);
>>        }
>>
>> }
>>
>> public void onBufferingUpdate(MediaPlayer arg0, int percent) {
>> Log.d(TAG, "onBufferingUpdate percent:" + percent);
>>
>> }
>>
>> public void onCompletion(MediaPlayer arg0) {
>> Log.d(TAG, "onCompletion called");
>>
>> }
>>
>> public void onPrepared(MediaPlayer mediaplayer) {
>>                Log.d(TAG, "onPrepared called");
>> mVideoWidth = mMediaPlayer.getVideoWidth();
>> mVideoHeight = mMediaPlayer.getVideoHeight();
>> if (mVideoWidth != 0 && mVideoHeight != 0) {
>>  holder.setFixedSize(mVideoWidth, mVideoHeight);
>>  mMediaPlayer.start();
>>
>> }
>>
>> while I try to run the above I can hear the audio of video file but no
>> video. please advise .
>> I m trying to play http://www.mp4mail.com/docs/files/disney_128v_16a.mp4
>> (mp4)
>> but having no luck please advise me .
>>
>> Thanks
>> Rizwan
>>
>>
>>
>>
>>
>
>
> >
>



-- 

Panut Sunyakorn
086-334-1616

--~--~-~--~~~---~--~~
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] text won't center.

2009-08-21 Thread sdphil

I have this xml --









The text will not center.  What am I doing wrong.

tia.
--~--~-~--~~~---~--~~
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: text won't center.

2009-08-21 Thread Mark Murphy

sdphil wrote:
> I have this xml --
> 
>  android:layout_centerVertical="true"
>   android:layout_width="fill_parent"
>   android:layout_height="35px">
> 
>   android:layout_width="wrap_content"
>android:layout_height="fill_parent"
>android:src="@drawable/btn1"
>android:background="@color/transparent"/>
> 
>android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:layout_gravity="center_horizontal"
> android:layout_centerHorizontal="true"
> android:background="@color/red"
> android:text="Text1"/>
> 
>   

Use android:gravity="center_horizontal".

First, android:layout_centerHorizontal="true" is only valid if the
parent is a RelativeLayout, and in your case, you are using LinearLayout.

Second, android:layout_gravity="center_horizontal" might work, if you
used android:layout_width="wrap_content". Since you used
android:layout_width="fill_parent", you are saying that the TextView is
to fill up all remaining space in the row, so there is nothing to be
centered. If you use the hierarchyviewer tool, you will see this effect
in the wireframe diagram in the lower right.

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

Need Android talent? Ask on HADO! http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
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 force Activity in landscape mode without Activity restart

2009-08-21 Thread yoshitaka tokusho

Hi String,

> Are you able to use android:screenOrientation="landscape"

It works perfectly fine!! Thanks for your comment! I really
appreciated!!

Y.T.

On Aug 21, 3:11 am, String  wrote:
> On Aug 21, 5:36 am, yoshitaka tokusho  wrote:
>
> > I have a problem to start/create Activity in landscape mode. My
> > Activity need to start in landscape mode and be used in landscape mode
> > by users.
>
> Are you able to use android:screenOrientation="landscape" in your
> manifest's activity tag? I don't know if that's mutable at runtime, or
> if you need it to be. But it might be an option for you.
>
> String
--~--~-~--~~~---~--~~
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: ADC 2 - can I update my app after the 1. round

2009-08-21 Thread mgpc

So this means that an app cannot be updated during the ADC? So if I
discover a bug on 2nd September, I have to leave my app unpatched
until mid-November? Even if it was going to be on TechCrunch the next
day?

Maybe it will be possible to release two versions of the app, one
within the ADC which stays unpatched, and another one on the general
Market which can be fixed?

On Aug 17, 8:41 pm, migo  wrote:
> According tohttp://code.google.com/android/adc/adc2_terms.htmlyou
> can't - see 9(a):
>
> "... There is no opportunity to improve or modify an application
> between the First and Second Rounds of Judging."
>
> On Aug 17, 9:29 pm, fhucho  wrote:
>
> > Hi,
> > if I submit my app toADC2, can I then submit an updated version
> > later, e.g. after the 1. round ended?
>
> > 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] Catch Android Exceptions

2009-08-21 Thread Pedro Fraca

Hi I want to listen the android standard exceptions to manage it. But
I don't put try/cath in all my code. Anyone knows if i can redirect
the error output to my code.

I've seen this System.setErr method, but It doens't works for this
purpouse.

Any suggestions.

Cheers.
--~--~-~--~~~---~--~~
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] problem using progress dialog with usertask

2009-08-21 Thread Sundar

Hi,

I have an application that downloads some content from the network,
processes it and displays it.
When any link is clicked, the user task(async task) is used to
download and process the content and the content is shown in the new
activity.

I want to show a progress dialog until the content gets downloaded and
processed. But when i call the progessdialog.show() method I am
getting the following error.

'android.view.WindowManager$BadTokenException: Unable to add window --
token android.os.binderpr...@435904d8 is not valid; is your activity
running'

I use the get method to get the result from the user task. I make the
main thread to wait until the usertask
completes its work. I know this is a bad way, but the normal handler
does not work here.I think it is not good idea to start a new activity
in the onPostExecute method.

Please tell me how to do this.

Thanks in advance.

V. Sundar
--~--~-~--~~~---~--~~
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: unsubscribe to group mot working

2009-08-21 Thread Casper Bang

While we're pointing out things that do not work:

The link to the FAQ section sniffs out my locale and directs me to a
non-existing: http://developer.android.com/intl/da/guide/appendix/faq/index.html

Same thing happens when clicking the "Groups overview":
http://developer.android.com/intl/da/community/index.html

/Casper

On 21 Aug., 09:47, Ehab Bassilli  wrote:
> Hi,
>
> I cannot unsubscribe to this group. When sending an email to the unsubscribe
> account, it is being rejected.
>
> If google are reading this could you fix it? Also your ADC2 rules are
> unfair. Just for your information.
>
> Thanks
>
> On Aug 21, 2009 6:40 AM, "bear tung"  wrote:
>
> I want to draw some Drawables in a view, for example like Rect. Then I want
> to make a totate animation for each Rect when it's be clicked.
> I try to use RotateAnimation, but it not work. It look likes only can make a
> View rotating.
>
> so, how can I make this work?
>
> thanks a lot
>
> Bear
--~--~-~--~~~---~--~~
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: ADC 2 - can I update my app after the 1. round

2009-08-21 Thread String

On Aug 21, 11:24 am, mgpc  wrote:

> So this means that an app cannot be updated during the ADC? So if I
> discover a bug on 2nd September, I have to leave my app unpatched
> until mid-November?

Not necessarily. I'd hope that ADC2 apps are served to "judges" from a
different location than the Market; if so, then you can update your
Market version all you like. The updates just won't affect your ADC2
entry.

Of course, here's hoping you don't find a serious bug on Sep 2,
because your ADC2 entry will have to remain unpatched. :^/

String


--~--~-~--~~~---~--~~
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] System time update : NTP server

2009-08-21 Thread Julien Dupouy

I find my droid doesn't update its clock itself, even if I ask it to
automatically update it from network, I am still 2 min late since I
ask it to automatically use network values (15 days ago). I need a
better time for some data synchronization. So I dove into the Android
API and I found the SntpClient class declared as internal, it seems to
be used during the GPS localisation protocol. I extracted it.

First, I was (and i'm still) unable to set up my Android device clock,
the method SystemClock.setCurrentTimeMillis() is locked as described
in the doc. Is there a way to unlock it or get round this to set the
current time myself ?

Second, when I was using the SntpClient class and doing some simple
tests with it by getting time from a NTP server, I found that there
was a difference between the real time and the received time (2 or
3s). It appears that the implementation of SntpClient doesn't look in
accordance with the RFC 2030, after changing the SntpClient as
described in the RFC, the time obtained was correct.

long originateTime = readTimeStamp(buffer,
ORIGINATE_TIME_OFFSET);
long receiveTime = readTimeStamp(buffer,
RECEIVE_TIME_OFFSET);
long transmitTime = readTimeStamp(buffer,
TRANSMIT_TIME_OFFSET);
long destinationTime = requestTime + (responseTicks -
requestTicks);

long clockOffset = (receiveTime - originateTime +
transmitTime - destinationTime)/2;
long roundTripTime = destinationTime - originateTime -
transmitTime + receiveTime;

Only the clock offset value and the round-trip time where changed, the
destination time was added as the time of arrival according to the
device clock.

I don't know which way the phone uses to update the time but I would
be grateful to know.

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: Catch Android Exceptions

2009-08-21 Thread Mark Murphy

Pedro Fraca wrote:
> Hi I want to listen the android standard exceptions to manage it. But
> I don't put try/cath in all my code. Anyone knows if i can redirect
> the error output to my code.
> 
> I've seen this System.setErr method, but It doens't works for this
> purpouse.

Try Thread.setDefaultUncaughtExceptionHandler().

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

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android 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: problem using progress dialog with usertask

2009-08-21 Thread Mark Murphy

Sundar wrote:
> I want to show a progress dialog until the content gets downloaded and
> processed. But when i call the progessdialog.show() method I am
> getting the following error.
> 
> 'android.view.WindowManager$BadTokenException: Unable to add window --
> token android.os.binderpr...@435904d8 is not valid; is your activity
> running'

Call show() from onPreExecute() or before starting your AsyncTask, then
call dismiss() in onPostExecute().

> I use the get method to get the result from the user task.

I have no idea what this means.

> I make the
> main thread to wait until the usertask
> completes its work. I know this is a bad way, but the normal handler
> does not work here.

Then you need to rewrite your code. Blocking the main thread is a
prescription for disaster.

> I think it is not good idea to start a new activity
> in the onPostExecute method.

Why do you think this?

You might consider taking the approach of passing download instructions
to the second activity (via extras) and having it display the progress
dialog, arrange for the download, and dismiss the progress dialog.

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

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android 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: just renaming the file seems to help.

2009-08-21 Thread Peli

Try to clean your project and rebuild all if that happens.

Peli
www.openintents.org

On Aug 21, 10:14 am, sdphil  wrote:
> i have an incredibly weird issue --
>
> I have an image button --
>
>               android:layout_width="wrap_content"
>              android:layout_height="fill_parent"
>              android:src="@drawable/btn1"
>              android:background="@color/transparent"/>
>
> The button doesn't show up.
>
> If i copy the file in the drawable directory to "btn2" (the exact same
> file) and change the src in the xml to point to the new file "btn2",
> it shows up.  if i rename it back to btn1, it doesn't show up again.
>
> then some time later, after adding some other buttons, btn1 reappears,
> but a later button I've added goes missing again.  Then I do the same
> trick of copying the file to another copy, rename it, and change the
> src in the xml and it appears again!!
>
> very unusual.  any ideas on what could be happening?
>
> tia.
--~--~-~--~~~---~--~~
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: Problem saving bitmap in JPEG format

2009-08-21 Thread karthikr

Guys,

Any help or suggesstions on the same?

Regards,
R.Karthik
--~--~-~--~~~---~--~~
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 use the RotationMatrix, actually how to get it

2009-08-21 Thread Peli

>  = event.values.clone();

Note that this creates new objects constantly that have to be garbage
collected later. Depending on the kind of application, it may be
better to just copy the values into a persisting array.

Peli
www.openintents.org

On Aug 21, 4:06 am, mscwd01  wrote:
> Heres my code, which works:
>
> public void onSensorChanged(SensorEvent event) {
>
>         Sensor sensor = event.sensor;
>         int type = sensor.getType();
>         switch (type) {
>                 case Sensor.TYPE_MAGNETIC_FIELD:
>                         mags = event.values.clone();
>                         isReady = true;
>                     break;
>                 case Sensor.TYPE_ACCELEROMETER:
>                     accels = event.values.clone();
>                     break;
>                 case Sensor.TYPE_ORIENTATION:
>                     orients = event.values.clone();
>                     break;
>             }
>
>             if (mags != null && accels != null && isReady) {
>                 isReady = false;
>
>                     SensorManager.getRotationMatrix(R, I, accels, mags);
>                     SensorManager.remapCoordinateSystem(R,
> SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, outR);
>                     SensorManager.getOrientation(outR, values);
>
>                                 azimuth = 
> getAzimuth(-convert.radToDeg(values[0]));
>                                 pitch= convert.radToDeg(values[1]);
>                                 roll = -convert.radToDeg(values[2]);
>
>             }
>
>         }
>
> On Aug 21, 2:39 am, Mike Collins  wrote:
>
> > I have a sensor event handler that gets fired and I have no problem
> > getting and processing acceleration readings. However this code
> > always fails.
>
> >                 if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
> >                 {
> >                         float[] geomagnetic = new float[3];
> >                         geomagnetic[0] = geomagnetic[1] = geomagnetic[2] = 
> > 0;
>
> >                         float[] r = new float[9];
> >                         float[] I = new float[9];
> >                         boolean b = SensorManager.getRotationMatrix(r, I, 
> > event.values.clone
> > (), event.values.clone());
> >                         if ( ! b)
> >                         {
> >                                 Log.e(LOG_TAG, "getRotationMatrix failed");
> >                                 return;
> >                         }
> > ...
>
> > tia,
> >   mike
--~--~-~--~~~---~--~~
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: Check for internet connection

2009-08-21 Thread Mark Murphy

Guru wrote:
> /**
>  * Checks whether the device is able to connect to the network
>  * @param context
>  * @return
>  */
> public static boolean isNetworkAvailable(Context context) {
> 
> ConnectivityManager connectivity = (ConnectivityManager) context
> .getSystemService(Context.CONNECTIVITY_SERVICE);
> if (connectivity == null) {
> Log.w("tag", "couldn't get connectivity manager");
> 
> } else {
> NetworkInfo[] info = connectivity.getAllNetworkInfo();
> 
> if (info != null) {
> 
> for (int i = 0; i < info.length; i++) {
> 
> if (info[i].getState() == NetworkInfo.State.CONNECTED) {
> 
> return true;
> 
> }
> 
> }
> 
> }
> }
> return false;
> }

I have been using:

ConnectivityManager
connMgr=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info=connMgr.getActiveNetworkInfo();

return(info!=null && info.isConnected());


Are there scenarios where a NetworkInfo other than
getActiveNetworkInfo() might be connected?

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

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

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

2009-08-21 Thread Mika

Hi,

I have started to have strange problems that make the whole OS to
restart. I have this stack trace:

08-21 14:43:15.128: WARN/dalvikvm(11513): threadid=15: thread exiting
with uncaught exception (group=0x4000fe70)
08-21 14:43:15.128: ERROR/AndroidRuntime(11513): Uncaught handler:
thread android.server.ServerThread exiting due to uncaught exception
08-21 14:43:15.128: ERROR/AndroidRuntime(11513): *** EXCEPTION IN
SYSTEM PROCESS.  System will crash.
08-21 14:43:15.228: ERROR/AndroidRuntime(11513):
java.lang.IndexOutOfBoundsException: index=1 count=0
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.view.ViewGroup.addInArray(ViewGroup.java:1890)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.view.ViewGroup.addViewInner(ViewGroup.java:1834)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.view.ViewGroup.addView(ViewGroup.java:1711)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.view.ViewGroup.addView(ViewGroup.java:1668)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
com.android.server.status.StatusBarService.addNotificationView
(StatusBarService.java:871)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
com.android.server.status.StatusBarService.performAddUpdateIcon
(StatusBarService.java:670)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
com.android.server.status.StatusBarService$H.handleMessage
(StatusBarService.java:615)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
android.os.Looper.loop(Looper.java:123)
08-21 14:43:15.228: ERROR/AndroidRuntime(11513): at
com.android.server.ServerThread.run(SystemServer.java:357)
08-21 14:43:15.438: INFO/Process(11513): Sending signal. PID: 11513
SIG: 9


Any ideas is this a bug in the platform, or is it possible that the
application I'm developing (or some other app in the device) is doing
something that makes the whole system crash. I'm using 1.1 SDK but the
device has 1.5. Could those compatibility issues be the reason for the
crash??

-Mika

--~--~-~--~~~---~--~~
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] onCreate -Prob?

2009-08-21 Thread Chaoz1336

Hi guys,
my prob is the following:

-my android application has the class TestActivity (entrypoint)
-my app uses "library.jar" wich contains J2ME classes, used as library
-library.jar also includes "UIActivity" [can spawn several dialogs]
wich is called by a (j2me) class of library.jar
-I only have the .class files of the j2me-lib stuff, so I cant modify
them, but I can do so on Android-classes

so... the short form:

TestActivity (Entrypoint)

~Uses function of~
Library.jar (J2ME Lib)

~Uses function of~
UIActivity (also in Library.jar, spawns different dialogs)


finally I get the error:

" -6812675448313451206SetDef java.lang.IllegalStateException: [b]
System services not available to Activities before onCreate()[/b]"

Do I have to use Services instead of Activities?
But afaik I have to give a reference of an activity to spawn dialogs.

I need help... its urgent... any tip would be very great =)=)=)
thx a lot 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] what permission to us "ContentResolver cr = getContentResolver();" ???

2009-08-21 Thread Dany BREARD

Hi

I try to use a lot of permission to use

ContentResolver cr = getContentResolver();

but i always have an  ERROR Exception: java.lang.NullPointerException

my code is just :



try {
ContentResolver cr = getContentResolver();
}
catch(Exception e){
 Log.v(TAG, "ERROR Exception: " + e);
}

and i try to use :














Do you know what kind of permission I have to use ?
--~--~-~--~~~---~--~~
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: TextView and not common characters?

2009-08-21 Thread twan

A little bump for me ;-)

On Aug 20, 5:41 pm, twan  wrote:
> Good afternoon,
>
> I've got a little problem with encoding and displaying a not common
> characters. The following word comes from a html page which i
> download:
>
> Brüno
>
> Shows as followed in my browser:
>
> Brüno
>
> I use unescapeHtml 
> (http://commons.apache.org/lang/api/org/apache/commons/lang/StringEsca...
> ) to convert the ü character into something meaning full.
>
> But when i try to display the result on a widget for example a
> TextView it shows like:
>
> Br?no
>
> (where the ? is a image of a question mark)
>
> I suspect i'm missing one step. Can anyone give me a helping hand?
>
> Kind regards,
> Twan
--~--~-~--~~~---~--~~
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 know if some email client is configured?

2009-08-21 Thread Atif Gulzar
How can I know if some email client is configured on device. Actually I want
to compose an email_message.

But if no email account is configured Android treat it as simple message.
But I want to prompt user that no email client is configured, please
configure one.

That is why I need to know how to check if some email client is configured.

Thanks

--
Best Regards,
Atif Gulzar

I  Unicode, ɹɐzlnƃ ɟıʇɐ

--~--~-~--~~~---~--~~
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: ADC 2 - can I update my app after the 1. round

2009-08-21 Thread Sebastian

The problem here is that you can only install one app with the same
signature.

So either the judging app will let you judge the app using the
currently installed version, instead of downloading the "contest
version", or it will not let you judge apps you already have
installed.

I hope they'll go with "use the installed one", even if it means a
little bit of unfairness, seeing how apps will be judged based on
different versions in some circumstances.

Preventing users from judging applications they have installed would
seriously punish popular apps.

Both scenarios create unfairness, but the first one rewards good
developers instead of punishing them.

If I get some kind of confirmation on the second scenario, I'll have
to submit my app under a separate signature. Otherwise, I'll just
submit the one in the Market.


On Aug 21, 7:08 am, String  wrote:
> On Aug 21, 11:24 am, mgpc  wrote:
>
> > So this means that an app cannot be updated during the ADC? So if I
> > discover a bug on 2nd September, I have to leave my app unpatched
> > until mid-November?
>
> Not necessarily. I'd hope that ADC2 apps are served to "judges" from a
> different location than the Market; if so, then you can update your
> Market version all you like. The updates just won't affect your ADC2
> entry.
>
> Of course, here's hoping you don't find a serious bug on Sep 2,
> because your ADC2 entry will have to remain unpatched. :^/
>
> String
--~--~-~--~~~---~--~~
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 know the length of the character using Graphics?

2009-08-21 Thread manoj

Hi friends,

How can I know the length of the each character of word.

Actually, I am trying some thing like this:

I will show some set of lines on the screen. Later after some time, I
would like to set the color to each character in the line at a
frequent interval.

Here I am drawing the txt on canvas c:

p = new paint();
p.setAlpha(0x30);
p.setXfermode(new PorterDuffXfermode
(PorterDuff.Mode.SRC));
p.setTextSize(20);
p.setTextAlign(Paint.Align.LEFT);
c.drawText("some data",x,y,p);

here c and p are Canvas and Paint respectively.

Now I want to set the color to each and every character of the drawn
string.

How can I achieve this.

Please help me.

Thanks,
Manoj.

--~--~-~--~~~---~--~~
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] Getting the file name of the SD Card.

2009-08-21 Thread Mathieu Plourde

Is there any way to get the file name of the SD Card used by the
emulator (like SDCard1.iso).
--~--~-~--~~~---~--~~
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] Camera.setPictureSize not working

2009-08-21 Thread Klaus Kartou
Hi!

I have a problem with setting the picture size of pictures I take with the
camera.
It looks like the values I set are overruled somehow.I am setting the size
both in the "surfaceCreated" and in "onShutter()" according to:
http://groups.google.com/group/android-developers/browse_thread/thread/8ab0cb7a7e243d98

The code I use is:

Camera.Parameters p = camera.getParameters();
p.setPictureSize(CAMERA_WIDTH, CAMERA_HEIGHT);
p.setPictureFormat(PixelFormat.JPEG);
camera.setParameters(p);

Cheers,
Klaus

--~--~-~--~~~---~--~~
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: populating a ListView in xml...

2009-08-21 Thread Jack Ha

You can create the list item template in XML but you still need to
write some code to populate the list.

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

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



On Aug 21, 12:54 am, sdphil  wrote:
> I want to create a list view with limited set of items that isn't
> really going to change.
>
> Each row is going to have an image on the left and right and text in
> the middle.
>
> Can I populate that in XML (i.e. avoid writing code) ?
>
>                            android:layout_width="fill_parent"
>                   android:layout_height="fill_parent"
>                   android:choiceMode="singleChoice">
>         
>
> tia.
--~--~-~--~~~---~--~~
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: odd issues with port 80

2009-08-21 Thread christoph widulle

i had similar problems with my mapview-app which is loading marker
from a webserver (port 80).
it is throwing exceptions hat the httpclient has no open socket
connection.
after switching to port 8080, everything is ok.
but this only occurs in the emulator.
so i test it on the phone or change to port 8080 during development.



On 20 Aug., 10:46, Holden Karau  wrote:
> I'm trying to do some raw socket stuff with port 80, but things seem
> to be behaving oddly in the emulator. I get similar issues using the
> connectbot application. I can connect to things on port 25 just fine,
> but it can't seem to connect to anything on port 80. Has anyone else
> had this experience and or know any work arounds?
--~--~-~--~~~---~--~~
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: MediaRecorder API: preview is not happening and audio sounds muffled

2009-08-21 Thread Greivin Lopez


Hi, sreeram.

A lot of people here is facing problems with video capture! There is a
thread about the video capture topic which has a lot of information,
but seems to be only one person that has succeeded doing video
capture. Check this out:
http://groups.google.com/group/android-developers/browse_thread/thread/ef4ce0506bf52f67?hl=en

Maybe you could join as in that discussion for feedback and
suggestions.

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 slow down SensorEventListener ?

2009-08-21 Thread DaminouU

Hi,

I am currently using sensors and I would like to know if I can slow
down the sampling rate.
Indeed, I register my listener with the constant
"SensorManager.SENSOR_DELAY_UI"
(is it the slowest one of the four constants mentionned in the
documentation?)
but the rate is still quite high. I would like to be able to define
the time before giving the new value (For example, I would like to
wait two seconds before update).

Does someone have any idea to do that?

Thanks,

D.
--~--~-~--~~~---~--~~
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] button - centered text - button

2009-08-21 Thread sdphil

i want a button on the left hand side, a button on the right hand side
and some text centered in the middle -- seems so straightforward! :)
I never see the button on the right hand side.










--~--~-~--~~~---~--~~
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] Security of application

2009-08-21 Thread engin

Hi, I want to learn that how google android market provides security
of application.That is, I realize that, when user downloads
application, market downloads and install application atomically to
phone. I am designing market and security is important issue so I
wonder that how google achieve this? How is application installed
phone?
1) Is the apk downloaded sdcard and deleted after installation? In the
case of this how can market guarantee that when apk downloaded to
sdcard, program finishes unexpectedly  and installation- deletion of
apk cannot be done?
2) Or installation is done from server?
3) I think that there exists  security not to copy apk. how do they do
this?  Maybe they use phone id to install application, by this way
even if anyone copy apk they cannot install it other phone?

As I said above I am trying to desing market.
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: button - centered text - button

2009-08-21 Thread sdphil

hm...  i think i'm missing something here.  how do i specify
layout_width as "the rest of the space that's left"

I have a button of fixed size (or wrap_content) on the left, a
textview in the middle, and another button of fixed size on the
right.  i want to tell the text view that its layout_width should be
the space that's left between the two fixed size buttons.  not sure
how specifying "layout_toRightOf" would help in this scenario...

I can get it to work if I hard code the dimensions, but I'd rather do
something a little bit more flexible.

On Aug 21, 9:12 am, Mark Murphy  wrote:
> sdphil wrote:
> > i want a button on the left hand side, a button on the right hand side
> > and some text centered in the middle -- seems so straightforward! :)
> > I never see the button on the right hand side.
>
> >      >                   android:layout_centerVertical="true"
> >                   android:layout_width="fill_parent"
> >                   android:layout_height="35px">
>
> >          >                      android:layout_width="wrap_content"
> >                      android:layout_height="fill_parent"
> >                      android:src="@drawable/btn1"
> >                      android:background="@color/transparent"/>
>
> >          >                   style="@style/top_title"
> >                   android:layout_width="fill_parent"
>
> In the preceding line, you have told Android to have this TextView take
> up the whole rest of the row. I suspect that is not what you want, since
> that will mean the following ImageButton will not display.
>
> >                   android:layout_height="wrap_content"
> >                   android:gravity="center_horizontal"
> >                   android:text="CENTERED TEXT"/>
>
> >          >                      android:layout_width="wrap_content"
> >                      android:layout_height="fill_parent"
> >                      android:src="@drawable/btn2"
> >                      android:background="@color/transparent"/>
>
> >     
>
> Consider using RelativeLayout. It has attributes specifically for your
> scenario (attaching items to the left, right, and center of the parent
> container).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Looking for Android opportunities?http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
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: where can I find the posts that I posted

2009-08-21 Thread chinchin

I would just search your name, but seeing as this is the only post you
made to this group, you sure you didn't post it to another group?

On Aug 20, 1:28 pm, Abhinav  wrote:
> Hello I can not find the post I posted yesterday? No help is available
> also!!
>
> Regards
--~--~-~--~~~---~--~~
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: unable to add a new layout xml file.

2009-08-21 Thread Jack Ha

The wizard issue that you encountered is already in the bug database.

http://code.google.com/p/android/issues/detail?id=3508

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

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


On Aug 21, 12:12 am, phil  wrote:
> using eclipse 3.4.1 and also 3.5 and I cannot seem to add a new
> layout .xml file.
>
> i tried adding it externally using windows explorer, but got all these
> errors.
>
> [2009-08-21 00:01:54 - TestAndroid]     (skipping index file
> 'C:\workspace\TestProject\res\drawable\Thumbs.db')
> [2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
> Invalid file name: must contain only [a-z0-9_.]
> [2009-08-21 00:01:54 - TestAndroid] res\layout\Test1.xml:
> Invalid file name: must contain only [a-z0-9_.]
>
> then i tried right click on the layout folder, selected new Android
> XML file and I got this --
>
> The selected wizard could not be started.
>   Plug-in com.android.ide.eclipse.adt was unable to load class
> com.android.ide.eclipse.editors.wizards.NewXmlFileWizard.
>   com.android.ide.eclipse.editors.wizards.NewXmlFileWizard
>
> I tried both versions of eclipse, I tried uninstalling and
> reinstalling the ADT plugin.  Nothing seems to be working!
>
> tia.
--~--~-~--~~~---~--~~
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: My emulator is running 100% CPU, it's annoying..

2009-08-21 Thread Jack Ha

Which platform are you running your emulator on?

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

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


On Aug 21, 12:57 am, jiaoni  wrote:
> Hi,
>
> Many times (not all the times), my emulator is running 100% of one of
> my two CPUs on the machine.
>
> Can anyone tell me why it is so, and how can I reduce the cpu usage?
>
> Thanks a lot,
> Jiaoni
--~--~-~--~~~---~--~~
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: Security of application

2009-08-21 Thread Dianne Hackborn
The official way to do this is to put the .apk somewhere, and launch the app
installer on it.  This will copy the .apk into a secure place, analyze it,
present the confirmation dialog (with the app's identity and permissions) to
the user, and once confirmed proceed with the install.

If your app is being built into the system, you can do a flow like market
does: get the information about the app from the server first to present the
confirmation dialog, then download the .apk and directly call the package
manager to install it.  This of course requires that the app be extremely
careful about its implementation to avoid holes (ensure it has a secure
connection with its server, is correctly parsing all relevant data out of
the .apk on the server, is retrieving the .apk into its private storage
before installing, etc).  I believe the market also makes use of the
download manager for downloading the .apk (which has access to the cache
partition as a secure area for temporary download storage), which is not yet
a public API but again if you are being bundled with a system you can use.

That all said, there is nothing fundamental here that market is doing that
regular apps can't.  It is just able to do a different flow (permission
check before download) because the system trust things built into it to
directly install apps, and is able to use private APIs like the download
manager instead of doing that work itself.

Anyway, you probably don't want to download the .apk to the SD card, though
from the system's perspective this is not a security hole, since it will
copy the .apk into its own secure area before proceeding with the install.

On Fri, Aug 21, 2009 at 7:44 AM, engin  wrote:

>
> Hi, I want to learn that how google android market provides security
> of application.That is, I realize that, when user downloads
> application, market downloads and install application atomically to
> phone. I am designing market and security is important issue so I
> wonder that how google achieve this? How is application installed
> phone?
> 1) Is the apk downloaded sdcard and deleted after installation? In the
> case of this how can market guarantee that when apk downloaded to
> sdcard, program finishes unexpectedly  and installation- deletion of
> apk cannot be done?
> 2) Or installation is done from server?
> 3) I think that there exists  security not to copy apk. how do they do
> this?  Maybe they use phone id to install application, by this way
> even if anyone copy apk they cannot install it other phone?
>
> As I said above I am trying to desing market.
> Thanks...
> >
>


-- 
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: My emulator is running 100% CPU, it's annoying..

2009-08-21 Thread Dianne Hackborn
What do you see in "adb shell top"?

On Fri, Aug 21, 2009 at 12:57 AM, jiaoni  wrote:

>
> Hi,
>
> Many times (not all the times), my emulator is running 100% of one of
> my two CPUs on the machine.
>
> Can anyone tell me why it is so, and how can I reduce the cpu usage?
>
> Thanks a lot,
> Jiaoni
> >
>


-- 
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: what permission to us "ContentResolver cr = getContentResolver();" ???

2009-08-21 Thread Dianne Hackborn
There is no permission for that (notice the error you are getting is NOT
SecurityException).  My guess is you are calling this on an Activity or
Service before onCreate() is called.

On Fri, Aug 21, 2009 at 7:16 AM, Dany BREARD  wrote:

>
> Hi
>
> I try to use a lot of permission to use
>
> ContentResolver cr = getContentResolver();
>
> but i always have an  ERROR Exception: java.lang.NullPointerException
>
> my code is just :
>
>
>
>try {
>ContentResolver cr = getContentResolver();
>}
>catch(Exception e){
> Log.v(TAG, "ERROR Exception: " + e);
>}
>
> and i try to use :
>
> 
>
> android:name="android.permission.SUBSCRIBED_FEEDS_WRITE"/>
>
> android:name="android.permission.SUBSCRIBED_FEEDS_READ"/>
>
> android:name="android.permission.WRITE_OWNER_DATA"/>
>
> >
>
> android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"/>
>
>
> Do you know what kind of permission I have to use ?
> >
>


-- 
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: Where do we have to close the DB in a ContentProvider?

2009-08-21 Thread Dianne Hackborn
A content provider is created when its hosting process is created, and
remains around for as long as the process does, so there is no need to close
the database -- it will get closed as part of the kernel cleaning up the
process's resources when the process is killed.

On Fri, Aug 21, 2009 at 2:02 AM, S. Mccoy  wrote:

>
> Hi,
>
>  With an Activity there is no problem, the lifecycle is clear and we
> have to realease all the resources in that method. The problem is that
> I use this helper inside a ContentProvider. In this case there is
> neither clear lifecycle (almost for me) nor a “close()” or “onDestroy
> ()” method where release the resources.
>
> S.
>
>
> On 21 ago, 09:54, jiaoni  wrote:
> > Hi S,
> >
> > I use a DBHelper class which extends the SQLiteOpenHelper class, and I
> > close it in the onDestroy() function of the Activity class.
> >
> > Jiaoni
> >
> > On Aug 21, 3:15 pm, "S. Mccoy"  wrote:
> >
> > > Hi all,
> >
> > > I have seen that if we use an AbstractSyncableContentProvider (other
> > > providers like ContactProvider use it), a “close()” method is
> > > implemented:
> > > public void close(){
> > > if(mOpenHelper != null)
> > > mOpenHelper.close();}
> >
> > > In this case, the helper seems to be closed (and also de DB), the same
> > > helper that remains open in a ContentProvider. I can’t understand the
> > > lifecycle of the ContentProvider without a method to release all the
> > > things. Any ideas ?.-Thanks in advance.
> >
> > > S.
> >
> > > On 18 ago, 18:00, "S. Mccoy"  wrote:
> >
> > > > Maybe it’s an easy question, but I’ve tried to understand why all the
> > > > content providers seem not to close the DB that they use. In the
> > > > NotePadProvider example (in other providers is similar), it’s used a
> > > > Helper to manage the DB (that extends of SQLiteOpenHelper). This
> > > > helper has a method to close the DB (http://developer.android.com/
> > > > reference/android/database/sqlite/SQLiteOpenHelper.html#close%28%29),
> > > > but in all the providers that I have seen (even in the example), this
> > > > method is never used.
> >
> > > > For example, in the query method of the NotPadProvider we use the
> > > > helper to open a DB
> >
> > > > // Get the database and run the query SQLiteDatabase db =
> > > > mOpenHelper.getReadableDatabase(); Cursor c = qb.query(db,
> > > > projection, selection, selectionArgs, null, null,
> > > > orderBy);  // Tell the cursor what uri to watch, so it knows
> > > > when its source data changes c.setNotificationUri(getContext
> > > > ().getContentResolver(), uri); return c;
> >
> > > > the mOpenHelper is create in the “onCreate()” method, but there is no
> > > > reference to a mOpenHelper.close() in all the provider (maybe because
> > > > there is no “close()” method in ContentProvider).
> >
> > > > Do we need to close the SQLiteOpenHelper object? When we use it
> inside
> > > > a ContentProvider, where is the right place to close it?
> >
> > > > Thanks in advance.
> > > > S.
> >
>


-- 
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: button - centered text - button

2009-08-21 Thread Mark Murphy

sdphil wrote:
> i want a button on the left hand side, a button on the right hand side
> and some text centered in the middle -- seems so straightforward! :)
> I never see the button on the right hand side.
> 
>android:layout_centerVertical="true"
>   android:layout_width="fill_parent"
>   android:layout_height="35px">
> 
>   android:layout_width="wrap_content"
>  android:layout_height="fill_parent"
>  android:src="@drawable/btn1"
>  android:background="@color/transparent"/>
> 
>style="@style/top_title"
>   android:layout_width="fill_parent"

In the preceding line, you have told Android to have this TextView take
up the whole rest of the row. I suspect that is not what you want, since
that will mean the following ImageButton will not display.

>   android:layout_height="wrap_content"
>   android:gravity="center_horizontal"
>   android:text="CENTERED TEXT"/>
> 
>   android:layout_width="wrap_content"
>  android:layout_height="fill_parent"
>  android:src="@drawable/btn2"
>  android:background="@color/transparent"/>
> 
> 

Consider using RelativeLayout. It has attributes specifically for your
scenario (attaching items to the left, right, and center of the parent
container).

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

Looking for Android opportunities? http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
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 override ContactsProvider like GoogleContactsProvider

2009-08-21 Thread Dianne Hackborn
Sorry, you can't do this.

On Thu, Aug 20, 2009 at 11:14 PM, Kenny Yu  wrote:

>
> To develop an APK, I want to modify or expand ContactsProvider
> functionality. GoogleContactsProvider is my role model. But I can't
> put my code to Android repository, like GoogleContactsProvider does.
> Mine is a 3rd party APK to develop.
>
>
> http://groups.google.com/group/android-developers/browse_thread/thread/e149bc0212b52f8a/83f2f6070b57c69f#83f2f6070b57c69f
> was the idea.
>
> Just curious how to make a customized provider for Android
> ContactsProvider.
>
> Kenny
> >
>


-- 
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: just renaming the file seems to help.

2009-08-21 Thread sdphil

i did try that, and it didn't help.

On Aug 21, 5:00 am, Peli  wrote:
> Try to clean your project and rebuild all if that happens.
>
> Peliwww.openintents.org
>
> On Aug 21, 10:14 am, sdphil  wrote:
>
> > i have an incredibly weird issue --
>
> > I have an image button --
>
> >  >              android:layout_width="wrap_content"
> >              android:layout_height="fill_parent"
> >              android:src="@drawable/btn1"
> >              android:background="@color/transparent"/>
>
> > The button doesn't show up.
>
> > If i copy the file in the drawable directory to "btn2" (the exact same
> > file) and change the src in the xml to point to the new file "btn2",
> > it shows up.  if i rename it back to btn1, it doesn't show up again.
>
> > then some time later, after adding some other buttons, btn1 reappears,
> > but a later button I've added goes missing again.  Then I do the same
> > trick of copying the file to another copy, rename it, and change the
> > src in the xml and it appears again!!
>
> > very unusual.  any ideas on what could be happening?
>
> > tia.
--~--~-~--~~~---~--~~
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: Prevent menu lock

2009-08-21 Thread kaloer

Okay, I've found out how. It can be done using the powerManger and the
WakeLock..

On 21 Aug., 18:54, kaloer  wrote:
> Hi,
>
> Is it possible to prevent the menu lock while an application is
> running? My application needs to be visible all the time it's running,
> even though the user doesn't use it.
>
> Thank you,
> //Kaloer
--~--~-~--~~~---~--~~
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] Find long/lat distance X from current location

2009-08-21 Thread alexdonnini

Hello,

I can easily find long/lat of my current location. Once I do that, I
would like to find long/lat information for locations at distance X
from y current location.

Does anyone have suggestion(s) on how to do this using Android SDK
methods?

Thanks.

Alex Donnini
--~--~-~--~~~---~--~~
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: populating a ListView in xml...

2009-08-21 Thread chinchin

Hi, I found this example the other day and it does exactly what you
are talking about:
http://www.youtube.com/watch?v=p1mS4ak-Wck
Hope that helps.

On Aug 21, 8:54 am, sdphil  wrote:
> I want to create a list view with limited set of items that isn't
> really going to change.
>
> Each row is going to have an image on the left and right and text in
> the middle.
>
> Can I populate that in XML (i.e. avoid writing code) ?
>
>                            android:layout_width="fill_parent"
>                   android:layout_height="fill_parent"
>                   android:choiceMode="singleChoice">
>         
>
> tia.
--~--~-~--~~~---~--~~
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: Security of application

2009-08-21 Thread Balwinder Kaur (T-Mobile USA)

A few comments about this.
* The Google Android Market App source code is not open source.
* You can learn about installation and the security involved around it
that the platform offers by studying the PackageManagerService and
PackageInstallerActivity in the platform source code
source.android.com
* This is not the best forum for understanding security. Try
http://groups.google.com/group/android-security-discuss

Hope this helps,
Balwinder KaurOpen Source Development Center·T· · ·Mobile· stick
togetherThe views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 21, 7:44 am, engin  wrote:
> Hi, I want to learn that how google android market provides security
> of application.That is, I realize that, when user downloads
> application, market downloads and install application atomically to
> phone. I am designing market and security is important issue so I
> wonder that how google achieve this? How is application installed
> phone?
> 1) Is the apk downloaded sdcard and deleted after installation? In the
> case of this how can market guarantee that when apk downloaded to
> sdcard, program finishes unexpectedly  and installation- deletion of
> apk cannot be done?
> 2) Or installation is done from server?
> 3) I think that there exists  security not to copy apk. how do they do
> this?  Maybe they use phone id to install application, by this way
> even if anyone copy apk they cannot install it other phone?
>
> As I said above I am trying to desing market.
> 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 use adb tool on SAMSUNG GALAXY?

2009-08-21 Thread SAM

Hi,

I tired all mention step above, but adb could not recognize my
device.any other alternative steps.please help

Rg,
Shameem

On Jul 29, 8:37 pm, TaoK  wrote:
> Hi,
>
> I got this working in windows XP (french), but not following any of
> the suggestions I have seen so far exactly:
>
> 1) Set the device in debug mode, under applications (mentioned
> everywhere, clearly required)
>
> 2) Install Samsung New PC Studio (not sure this actually did anything
> useful...)
>
> 3) Install the USB Driver from the Samsung New PC Studio disk (not
> sure this actually did anything useful...)
>
> 4) Modify the "android_usb.inf" file in the android SDK folder (C:
> \Program Files\android-sdk-windows-1.5_r3\usb_driver
> \x86\android_usb.inf, for 32-bit windows), ALMOST exactly as "da yang"
> specified in the first post of this thread:
>
> add under
> [Google.NTx86]:
>
> ; SAMSUNG GALAXY
> %USB\VID_04E8&PID_6640.DeviceDescRelease%=androidusb.Dev, USB
> \VID_04E8&PID_6640
> %USB\VID_04E8&PID_6640&MI_04.DeviceDescRelease%=androidusb.Dev, USB
> \VID_04E8&PID_6640&MI_01
> %USB\VID_04E8&PID_6640.DeviceDescRelease%=androidusb.Dev, USB
> \VID_04E8&PID_6640
>
> and add under [Strings]:
>
> USB\VID_04E8&PID_6640.DeviceDescRelease="SAMSUNG GALAXY"
> USB\VID_04E8&PID_6640&MI_04.DeviceDescRelease="SAMSUNG GALAXY
> Composite ADB Interface"
> USB\VID_04E8&PID_6640.DeviceDescRelease="SAMSUNG GALAXY Bootloader"
>
> NOTE: the only change with respect to "da yang"'s original entries
> were replacing "MI_01" with "MI_04" in all entries. When originally
> trying da yang's suggestions the INF file was not working for me, and
> looking into the unknown device's properties I noticed this
> discrepancy.
>
> 5) plug in the phone, allow all the USB mass storage and standard
> samsung drivers to install, and finally when you are asked for drivers
> for an unknown device, point windows to your "C:\Program Files\android-
> sdk-windows-1.5_r3\usb_driver\x86\" folder with your modified INF file
> (assuming 32-bit windows).
>
> If windows recognizes the device, great! If it complains that the INF
> file does not contain information for the device, or something like
> that, try looking at the properties of the unknown device in device
> manager - you might have a different device signature.
>
> After windows successfully recognized the device, I was able to debug
> in Eclipse connected directly to my phone - very cool. I guess adb
> started recognizing it, but I honestly haven't messed with the command-
> line tools yet - I can just confirm that the fully integrated
> Eclipse / Android SDK / Android Plugin debug environment works
> perfectly.
>
> One other note that might be relevant: I used the "Samsung New PC
> Studio" software to update my Galaxy to the latest image BEFORE I did
> any of this; I suspect that may be what caused the discrepancy in
> terms of device signature with respect to "da yang"'s original notes,
> but I can't be sure.
>
> Hopefully this helps someone out there!
>
> Best regards,
> Tao
>
> On Jul 28, 3:27 am, f_heft  wrote:
>
>
>
> > Hello,
>
> > it seems like most of the users in the german android-hilfe.de board
> > got it running perfectly under nearly every windows operating system
> > (XP, Vista 32/64, Win7 32/64).
> > I thought I were the only one who has still problems. I tried it so
> > many times, uninstalled all old drivers, tried new ones etc., but I
> > ddms or 'adb devices' still doesn't list my galaxy (on Win 7 x64)
>
> > On 26 Jul., 23:55, Akex  wrote:
>
> > > Hi,
>
> > > @Xavier : Seems the adb of r3 doesn't work perfectly for Samsung.
> > > Tried on Xp and seven 
>
> > > After tweaking the .inf file to install drivers for my Samsung i7500
> > > (otherwise Windows doesn't accept the drivers), I can't manage to make
> > > my phone visible under ddms (Under Windows XP). I have the last SDK on
> > > my computer off course (1.5 r3).
>
> > > Is anybody able to see his Samsung phone under ddms on XP ?
>
> > > My build : 76XXCSDCBALUM6375
>
> > > Thanks
>
> > > Akex- Hide quoted text -
>
> > - Show quoted text -- 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] Why i can't find the .db file in the data directory of my application?

2009-08-21 Thread nick.woo

Hi, all,
  I have written a test case to implement a conference contact
management system with Content Provider and SQLite. The launch
activity is a Listactivity and the customized provider is extended
from ContentProvider, u know, actually the sample is so similar to the
Notepad Sample in the official SDK packages. However, i can't find the
created .db file in the /data/data/myapp/ except the /lib directory.
Why?
  I can't find out the reason, any suggestion is 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.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Why i can't find the .db file in the data directory of my application?

2009-08-21 Thread nick.woo

Hi, all,
  I have written a test case to implement a conference contact
management system with Content Provider and SQLite. The launch
activity is a Listactivity and the customized provider is extended
from ContentProvider, u know, actually the sample is so similar to the
Notepad Sample in the official SDK packages. However, i can't find the
created .db file in the /data/data/myapp/ except the /lib directory.
Why?
  I can't find out the reason, any suggestion is 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.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] ListView inside TabActivity

2009-08-21 Thread Anson

hi everyone,

i'm new in android, and i wanner put a "List" inside a TabActivity.
by google and coder's guide, my work out "direction" is to create a
"TabActivity" as MAIN and "ListActivity"
then add it in the "TabHost" and turn out code something like (below)
and fail:

"mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator
(this.getString(R.string.tab_search),getResources().getDrawable
(R.drawable.help)).setContent(new Intent(this, ListViewDemo.class)));"

I know i may need to spend more time on the BOOK and google for
android development, but i also feel that the resource for android is
quit scattered and not detail. (i'm a developer of C# for a few years,
and it's more easilier to search for information)

can anyone give me some information or links for this issue?

many thanks for any of your kindly help


--~--~-~--~~~---~--~~
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 force a picture to be downloaded on SD card ?

2009-08-21 Thread Benoit

Hello all,

i'm a web developper and i must do an adaptation of a website.

At the moment, poeple can go on this website to download pictures
(png, gif, jpg, bmp) and my client ask me to do the same thing with
android (on G1, for example).

I tried on the G1 but i receive an error because the file is not
supported.

How can i download pictures from the website directly to the SD card ?

Thank you for your help.

--~--~-~--~~~---~--~~
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: Getting the file name of the SD Card.

2009-08-21 Thread Balwinder Kaur (T-Mobile USA)

You enter it when you create an AVD. On the Mac, you can go to your
/.android/avd//config.ini and open the file in an
editor. It has the name and path of the sdcard.

Is this what you are looking for ?

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

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


On Aug 21, 7:03 am, Mathieu Plourde  wrote:
> Is there any way to get the file name of the SD Card used by the
> emulator (like SDCard1.iso).
--~--~-~--~~~---~--~~
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 update the UI from service

2009-08-21 Thread Abdula

Need service wich retrive data by http and then return them to
activity for update list view. How i can do this. I don't know return
retrived data. Please help.

public class RequestService extends Service {

private NotificationManager nm;
private Timer timer;
public static final long POLL_INTERVAL = 15000;
public static final long DELAY_EXECUTION = 500;

private static Occ MAIN_ACTIVITY;

private static final String TAG =
RequestService.class.getSimpleName();

private TimerTask task = new TimerTask(){
@Override
public void run()
{
refreshRequests();
}
};

@Override
public void onCreate() {
this.timer = new Timer();
this.timer.schedule(this.task, RequestService.DELAY_EXECUTION,
RequestService.POLL_INTERVAL);
this.nm = (NotificationManager) getSystemService
(Context.NOTIFICATION_SERVICE);
}

public String getInputSream(String uri)
{
String myString = null;
try{
  URL url = new URL(uri);

  URLConnection urlConn = url.openConnection();

  InputStream is = urlConn.getInputStream();
  BufferedInputStream bis = new BufferedInputStream(is);

  ByteArrayBuffer baf = new ByteArrayBuffer(50);
  int current = 0;
  while((current = bis.read()) != -1){
baf.append((byte)current);
  }

  myString = new String(baf.toByteArray());

}catch(Exception e){
   return null;
}
return myString;
}

private void refreshRequests()
{
Prefs pref = new Prefs(this.getBaseContext());
String response = this.getInputSream(pref.getServer().concat("?
action=request"));
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
RequestHandler handler = new RequestHandler
(this.getBaseContext(), null);
xr.setContentHandler(handler);
xr.parse(new InputSource(new StringReader(response)));
List requests = handler.getRequests();
.
.
} catch (Exception e) {
Log.e(TAG, " " + TAG + " ERROR - " + e);
}
}
}

--~--~-~--~~~---~--~~
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: My emulator is running 100% CPU, it's annoying..

2009-08-21 Thread David Wilson

Are you on Linux? You could try this.. From a terminal:

killall -STOP emulator

To pause it while not in use, and:

killall -CONT emulator

To unpause it. Note doing this might screw up the emulator's idea of
the current time, but I've used this lots of times in the past with
other Qemu based emulators and it worked fine.



David

2009/8/21 jiaoni :
>
> Hi,
>
> Many times (not all the times), my emulator is running 100% of one of
> my two CPUs on the machine.
>
> Can anyone tell me why it is so, and how can I reduce the cpu usage?
>
> Thanks a lot,
> Jiaoni
> >
>



-- 
Reality is that which, when you stop believing in it, doesn't go away.
  — Philip K. Dick

--~--~-~--~~~---~--~~
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: adc2 submission site

2009-08-21 Thread hua ming

the site is not opened yet?

--~--~-~--~~~---~--~~
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] Couldn't open fd for content://settings/system/ringtone

2009-08-21 Thread Nandy

Hi,
I am trying to build donut on a reference device. I am using alsa lib
for audio drivers. When any app tries to write audio my device
crashes. From the logs first I saw that no audio files were created in
system/media. That I fixed by enabling the frame work sound makefile
to pick up default android sounds. After that, when any app like
incoming call or alarm is trying to play some default sound, it is
failing.
Before my crash, I see -
D/CallNotifier( 876): RINGING... (new)
D/CallNotifier( 876): onNewRingingConnection(): incoming
D/Ringer ( 876): ring()...
D/Ringer ( 876): mRingHandler: PLAY_RING_ONCE...
D/Ringer ( 876): creating ringtone: content://settings/system/ringtone
I/ActivityManager( 826): Start proc com.android.settings for broadcast
com.android.settings/.widget.SettingsAppWidgetProvider: pid=971
uid=1000 gids={3002, 3001, 3003}
D/MediaPlayer( 876): Couldn't open file on client side, trying server
side
I/ActivityManager( 826): Starting activity: Intent
{ act=android.intent.action.MAIN flg=0x1084
cmp=com.android.phone/.InCallScreen }
I/ActivityManager( 826): processNextBroadcast: waiting for
ProcessRecord{43ac3cc0 971:com.android.settings/1000}
E/MediaPlayerService( 663): Couldn't open fd for 
content://settings/system/ringtone
E/MediaPlayer( 876): Unable to to create media player
E/RingtoneManager( 876): Failed to open ringtone 
content://settings/system/ringtone

Could this be the reason of my crash? It is actually crashing after
this in audioflinger when trying to AudioMixer and Resampler.

Any thoughts?

--~--~-~--~~~---~--~~
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: onCreate -Prob?

2009-08-21 Thread Balwinder Kaur (T-Mobile USA)

J2ME class files are not compatible with the Dalvik VM that Android
uses.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

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


On Aug 21, 7:12 am, Chaoz1336  wrote:
> Hi guys,
> my prob is the following:
>
> -my android application has the class TestActivity (entrypoint)
> -my app uses "library.jar" wich contains J2ME classes, used as library
> -library.jar also includes "UIActivity" [can spawn several dialogs]
> wich is called by a (j2me) class of library.jar
> -I only have the .class files of the j2me-lib stuff, so I cant modify
> them, but I can do so on Android-classes
>
> so... the short form:
>
> TestActivity (Entrypoint)
>
> ~Uses function of~
> Library.jar (J2ME Lib)
>
> ~Uses function of~
> UIActivity (also in Library.jar, spawns different dialogs)
>
> finally I get the error:
>
> " -6812675448313451206SetDef java.lang.IllegalStateException: [b]
> System services not available to Activities before onCreate()[/b]"
>
> Do I have to use Services instead of Activities?
> But afaik I have to give a reference of an activity to spawn dialogs.
>
> I need help... its urgent... any tip would be very great =)=)=)
> thx a lot 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] can anyone use adb after crc37 update (with g1)

2009-08-21 Thread Flurin Rindisbacher

hi there

last week i received the crc37 update for my g1. since then i was not
able to use my phone for developing. USB-Debugging is enabled but "adb
devices" doesn't recognizes the device. not shure whether it's my setup
or the new update. that's why i am asking here.

my setup:
debian sid, kernel 2.6.30-1-686
content of /etc/udev/rules.d/51-android.rules: SUBSYSTEM=="usb",
SYSFS{idVendor}=="0bb4", MODE=="0666"

is anyone of you successfully developing on the g1 with the crc37 build?

best regards,
flurin

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

2009-08-21 Thread Jeremiah

I'm also searching for an answer to this question. We finished our app
today and looked for the submission form, only to not find one. We are
unsure if we should submit it to the Android Market or wait for the
form. Anyone from Google want to help us out?

Also, the fine print states that the apps cannot be updated once
submitted, but implies they should be available for free in the
Android Market. Does that mean that the Android Market will prevent
updating of the application during the competition?


Thanks!

Jeremiah Cohick
http://DigitalDandelion.net



On Aug 3, 2:31 am, Croco  wrote:
> Hi all,
>
> I'm wondering what is the procedure to submit an application entry for
> the competition.
>
> I can't find into the related docs the procedure to submit  a
> candidate application.
>
> Do we need to submit on the Android Market but any android application
> can't participate according the terms and agreements of the cup.
>
> Thanks for your lights  ;)
>
> Croco

--~--~-~--~~~---~--~~
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 update the UI from a timer

2009-08-21 Thread Abdula

Please help. I have a service with code:

public class RequestService extends Service {

private NotificationManager nm;
private Timer timer;
private static final long POLL_INTERVAL = 15000;
private static final long DELAY_EXECUTION = 500;

private static final String TAG =
RequestService.class.getSimpleName();

private TimerTask task = new TimerTask(){
@Override
public void run()
{
refreshRequests();
}
};

@Override
public void onCreate() {
this.timer = new Timer();
this.timer.schedule(this.task, RequestService.DELAY_EXECUTION,
RequestService.POLL_INTERVAL);
}

private void refreshRequests()
{
Prefs pref = new Prefs(this.getBaseContext());
String response = this.getInputSream(pref.getServer().concat("?
action=request"));
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
RequestHandler handler = new RequestHandler
(this.getBaseContext(), null);
xr.setContentHandler(handler);
xr.parse(new InputSource(new StringReader(response)));
List requests = handler.getRequests();

} catch (Exception e) {
Log.e(TAG, " " + TAG + " ERROR - " + e);
}
}

}

How i can return  "List requests"  to activity for update UI.

--~--~-~--~~~---~--~~
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] Software Packaging Problem: How to create an Android installer (apk) ?

2009-08-21 Thread Bryan Lee

HI all,

In Windows, we write "installer script", and user an "installer
compiler" to generate an installer,
let's say .inf for .msi/.cab and .nsi for NSIS.

But when it comes to Android, is there a similiar method?

--~--~-~--~~~---~--~~
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] ListView with multiple buttons, how do I detect which View the buttons were pressed in?

2009-08-21 Thread Croccy22

Hi all,

I am writing  a program where I need a ListView for which I am using a
ListActivity. Each one  of the views within the ListView has four
buttons, (Off, Dim, Bright and On). Each one of these buttons is
configured with it's own OnClickListener when I build the view. This
part seems to work  ok.

However when I have say 5 Views each which has these four buttonns, I
cann tell whether an off,dim,bright or on button was pressed but I
cannot tell from which view it was pressed.

So for example if my views are devices (Light, Heater and Kettle) I
press an "on" button and i know an On button was pressed but how do I
get it to tell me the On button for the Light was pressed?

Any ideas on how to achieve this?

Thanks, Matt

--~--~-~--~~~---~--~~
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: MediaStore.EXTRA_OUTPUT

2009-08-21 Thread Friso

I tried this, but I don't get the full size image back from the
camera, just a 512x384 pixels. I am using the Developer Phone.

My code
final Intent imageCaptureIntent = new Intent
(MediaStore.ACTION_IMAGE_CAPTURE);
imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
"test.jpg")));
startActivityForResult(imageCaptureIntent, 1);


On Jul 15, 8:53 pm, Christine  wrote:
> I have seen a number of posts from people who had trouble retrieving a
> full size image from  MediaStore.EXTRA_OUTPUT with code like
>
>               Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
>               pictureUri = Uri.fromFile(new File("/sdcard/
> picturefile.jpg"));
>               intent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
>               startActivityForResult(i, PICTURE_TAKEN);
>
> Should this code work? I mean, should this result in a file containing
> the picture?

--~--~-~--~~~---~--~~
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] File created by app on sdcard can always be accessed by other apps

2009-08-21 Thread Philip

File created by application on sdcard can always be accessed by other
applications, is that the fact ? For example, use camera capture
pictures which will be saved to sdcard, and my application can access
it.

Tried more, I found File.createNewFile(new File(file_path)) create a
file and set its access permission accroding to different file_path,

e.g. if file_path is "/sdcard/DCIM/Camera/photo.jpg", photo.jpg is
created on sdcard, and is set read&write by all applications.
rw-rw- system   system  16692 2009-08-21 16:25 photo.jpg

 if file_path is "/data/data/com.philip.camera/files/photo.jpg",
photo.jpg will be the private file of the application
com.philip.camera.
-rw--- app_41   app_41  0 2009-08-21 17:03 photo.jpg

it's interested that where android put the control of checking the
path, I think it couldn't be in File.createNewFile, it's better for
the standard library class to be unchanged, so could someone tell me
where to satisfy my curiosity :)

if above description has some errors , please let me know, 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: CONTRACT - ANDROID Developers - Toronto

2009-08-21 Thread David Wilson

.. or rearrange an otherwise crap CV to have half a chance at passing
a hiring manager's muster.


David
(not a recruiter)

2009/8/21 JP :
>
>
> It is highly inconvenient to try to remove your contact information
> and insert a company logo in a PDF.
>
>
> On Aug 20, 1:34 pm, Kent Loobey  wrote:
>> You won't accept a "sound" version?
>>
>> > kevi...@talgroup.net
>> > kevin (dot) b (at) talgroup (dot) net
> >
>



-- 
Reality is that which, when you stop believing in it, doesn't go away.
  — Philip K. Dick

--~--~-~--~~~---~--~~
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 capture and save the image of Google Map(MapView)...

2009-08-21 Thread idoun

Dear Developers!


I'm trying to develop a map application which can save some part of
map inside a phone.

So, refering to the example of google developer site, I created my
activity that using the MapView class to display the location what I
want to see. It works.

And I attached some code to save that view into png format file using
Bitmap and Canvas classes. But it didn't work.

One image file was created but it didn't contain any information of
the map. I don't know the reason why those codes didn't work and
couldn't find any related information on the Web...


code is...


public class AndroidTest extends MapActivity {

MapView mapView;
List mapOverlays;
Drawable drawable;
HelloItemizedOverlay itemizedOverlay;

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

// build map and mark point
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);

mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable
(R.drawable.androidmarker);
itemizedOverlay = new HelloItemizedOverlay(drawable);

GeoPoint point = new GeoPoint(1924, -9912);
OverlayItem overlayitem = new OverlayItem(point, "", "");

itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);

// copy MapView to canvas
Bitmap bitmap = Bitmap.createBitmap(400, 800,
Bitmap.Config.ARGB_);
Canvas canvas = new Canvas(bitmap);
mapView.draw(canvas);

// save it!
FileOutputStream fo = null;

try {
fo = this.openFileOutput("test.png", 
Context.MODE_WORLD_WRITEABLE);
} catch (FileNotFoundException e) {
e.printStackTrace();
}

bitmap.compress(CompressFormat.PNG, 100, fo);

try {
fo.flush();
} catch (IOException e) {
e.printStackTrace();
}

try {
fo.close();
} catch (IOException e) {
e.printStackTrace();
}
}


Please, help!

--~--~-~--~~~---~--~~
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] make adt failed with android source coe in unbuntu

2009-08-21 Thread 何斌斌
hi :
   I can make the whole android source code and sdk , but when I make adt,
it failed . like this(my os is ubuntu 9.0 ) :

### TEST ###

`development/tools/eclipse/plugins/com.android.ide.eclipse.tests/kxml2-2.3.0.jar'
-> `../../../../../out/host/linux-x86/framework/kxml2-2.3.0.jar'
`development/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ddmlib'
->
`../../../../../../../../development/tools/ddms/libs/ddmlib/tests/src/com/android/ddmlib'

### BRIDGE ###


### development/tools/eclipse/scripts/create_all_symlinks.sh done
PWD=/home/hebinbin/myandroid/development/tools/eclipse
ECLIPSE_HOME=/home/hebinbin/androidtool/eclipse
Setting destination directory to /home/hebinbin/tool/myandroid_adt
Setting archivePrefix to android-eclipse
Installation Error: Eclipse build file
org.eclipse.pde.build_.../scripts/build.xml  not detected. Found ''.
Aborting.

so , I hope some people can help me !!!   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: button - centered text - button

2009-08-21 Thread Mark Murphy

sdphil wrote:
> hm...  i think i'm missing something here.  how do i specify
> layout_width as "the rest of the space that's left"

For a LinearLayout, you can use android:layout_width="0px" and
android:layout_weight="1". The non-zero weight indicates that you want
the TextView to absorb any excess space left over in the row, after
calculating all other sizes.

> I have a button of fixed size (or wrap_content) on the left, a
> textview in the middle, and another button of fixed size on the
> right.  i want to tell the text view that its layout_width should be
> the space that's left between the two fixed size buttons.  not sure
> how specifying "layout_toRightOf" would help in this scenario...

You would specify the first button as alignParentLeft="true", the second
button as alightParentRight="true", and the middle button as alignLeftOf
being the left button and alignRightOf being the right button.

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

Looking for Android opportunities? http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
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 launchCount and execution time for applications

2009-08-21 Thread veena

Hi,

i am developing application which displays the recently launched
application. I am able to get the list of apps using
ActivityManager.RecentTaskInfo.

Now i need to keep track of "how many times an application is
launched" and "also execution time of an application"?

In spare parts example, this is done. To achieve this they have used:
PkgUsageStats
public PkgUsageStats(String pkgName, int count, long time) {
 packageName = pkgName;
 launchCount = count;
 usageTime = time;
 }


But in the latest android SDK , PkgUsageStats is been replaced by
PackageStats
and it has only:
public PackageStats(PackageStats pStats) {
packageName = pStats.packageName
codeSize = pStats.codeSize;
dataSize = pStats.dataSize;
cacheSize = pStats.cacheSize;
}

So is there any other way to get the "launchCount"?
What is the alternative for this function?


Regards,
Shruthi

--~--~-~--~~~---~--~~
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] Contacts photos does not work after insert

2009-08-21 Thread Alexander Kazanin

Hello Friends.
I'm writing a small backup application for contacts and i encountering
some weird problems.
Firs of all I retrive data through the content resolver:

contentResolver.query(contentUri, columns, null, null, null);

where content uri and columns are both taken from Contacts.People,
Contacts.People.Phones, Contacts.People.ContactMethods, etc. So I
extract several sets of data and save them. Later on I'm making
restore operation:
for( HashMap row : data )
{
ContentValues values = new ContentValues();
for( String key : columns )
{
String value = row.get( key);
if( null != value && !"".equals( value))
{
values.put( key, value);
}
}
String masterKey = row.get( BaseColumns._ID);
if( null != masterKey && !"".equals( masterKey) )
{
try
{
contentResolver.delete(
Uri.withAppendedPath( 
contentUri, masterKey),
null, null);
}
catch(Throwable t)
{
t.printStackTrace();
//do nothing, to not to crash
}
}

try
{
contentResolver.insert( contentUri, values);
}
catch(Throwable t)
{
t.printStackTrace();
}
}
Such operation done for each ContentProvider I retrieved data at
backup.
I'm not backuping Contacts.Photos, becouse I don't want to do that.
But next, strange thing happenning, when i try to attach photo to a
contact in Contacts application. First of I select a contact i wish to
modify. Then clicking to add icon. Selecting photo, cropping it. And
it appears near the contatc name in contact editing activity. But
after I click "Done" and android says that chages were successfully
changed, icon just dissappears like i never added it to a contact.
And nothing helps after this restore, I tried rebooting my phone,
deleting all contacts, deleting all contacts programaticatlly and all
this doesn't helps. The only thing that helps is factory data reset.
This problem both happens on emulator and on g1 phone. Later i had an
idea so i've taken  contacts.db file from fresh emulator, where photos
feature were still working and saved it. Then i performed backup-
restore operations. And compared the databases. They were identical.
And still photos weren't inserting anymore. And this probleblem also
happens wether I had any photos added to contacts before backup or all
contacts were without photos. So I'm kinda desperate now, becouse I
don't know what to do. And I hope someone here will help me =) So any
help would be appreciated.
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] Re: just renaming the file seems to help.

2009-08-21 Thread Donn Felker
Did you delete your gen folder and then clean/rebuild? If using eclipse this
should recreate the gen folder.

On Fri, Aug 21, 2009 at 11:01 AM, sdphil  wrote:

>
> i did try that, and it didn't help.
>
> On Aug 21, 5:00 am, Peli  wrote:
> > Try to clean your project and rebuild all if that happens.
> >
> > Peliwww.openintents.org
> >
> > On Aug 21, 10:14 am, sdphil  wrote:
> >
> > > i have an incredibly weird issue --
> >
> > > I have an image button --
> >
> > >  > >  android:layout_width="wrap_content"
> > >  android:layout_height="fill_parent"
> > >  android:src="@drawable/btn1"
> > >  android:background="@color/transparent"/>
> >
> > > The button doesn't show up.
> >
> > > If i copy the file in the drawable directory to "btn2" (the exact same
> > > file) and change the src in the xml to point to the new file "btn2",
> > > it shows up.  if i rename it back to btn1, it doesn't show up again.
> >
> > > then some time later, after adding some other buttons, btn1 reappears,
> > > but a later button I've added goes missing again.  Then I do the same
> > > trick of copying the file to another copy, rename it, and change the
> > > src in the xml and it appears again!!
> >
> > > very unusual.  any ideas on what could be happening?
> >
> > > tia.
> >
>


-- 
Donn
http://blog.donnfelker.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] Prevent menu lock

2009-08-21 Thread kaloer

Hi,

Is it possible to prevent the menu lock while an application is
running? My application needs to be visible all the time it's running,
even though the user doesn't use it.

Thank you,
//Kaloer
--~--~-~--~~~---~--~~
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: ListView with multiple buttons, how do I detect which View the buttons were pressed in?

2009-08-21 Thread skink



On Aug 21, 10:18 am, Croccy22  wrote:
> Hi all,
>
> I am writing  a program where I need a ListView for which I am using a
> ListActivity. Each one  of the views within the ListView has four
> buttons, (Off, Dim, Bright and On). Each one of these buttons is
> configured with it's own OnClickListener when I build the view. This
> part seems to work  ok.
>
> However when I have say 5 Views each which has these four buttonns, I
> cann tell whether an off,dim,bright or on button was pressed but I
> cannot tell from which view it was pressed.
>
> So for example if my views are devices (Light, Heater and Kettle) I
> press an "on" button and i know an On button was pressed but how do I
> get it to tell me the On button for the Light was pressed?
>
> Any ideas on how to achieve this?
>
> Thanks, Matt

well,

what method does OnClickListener interface  have?

and what's its only parameter?

pskink

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

2009-08-21 Thread Disconnect

It opened on the first and closed on the fifteenth. You missed it.
That's why nobody else is asking about it. (Actually, there is a lot
of info about the adc2 submissions process at http://is.gd/2s5JH-
Check it out..)

On Thu, Aug 20, 2009 at 11:52 PM, Jeremiah wrote:
>
> I'm also searching for an answer to this question. We finished our app
> today and looked for the submission form, only to not find one. We are
> unsure if we should submit it to the Android Market or wait for the
> form. Anyone from Google want to help us out?
>
> Also, the fine print states that the apps cannot be updated once
> submitted, but implies they should be available for free in the
> Android Market. Does that mean that the Android Market will prevent
> updating of the application during the competition?
>
>
> Thanks!
>
> Jeremiah Cohick
> http://DigitalDandelion.net
>
>
>
> On Aug 3, 2:31 am, Croco  wrote:
>> Hi all,
>>
>> I'm wondering what is the procedure to submit an application entry for
>> the competition.
>>
>> I can't find into the related docs the procedure to submit  a
>> candidate application.
>>
>> Do we need to submit on the Android Market but any android application
>> can't participate according the terms and agreements of the cup.
>>
>> Thanks for your lights  ;)
>>
>> Croco
>

--~--~-~--~~~---~--~~
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: Find long/lat distance X from current location

2009-08-21 Thread Donn Felker
Look up the Great Circle Calculation. That will provide you with the method
for finding x within a given y radius. As for finding other geo coordinates,
you'll need to find a data source for those or make your own set of data to
work with. You might be able to use some Google API for that as well.



On Fri, Aug 21, 2009 at 10:44 AM, alexdonnini  wrote:

>
> Hello,
>
> I can easily find long/lat of my current location. Once I do that, I
> would like to find long/lat information for locations at distance X
> from y current location.
>
> Does anyone have suggestion(s) on how to do this using Android SDK
> methods?
>
> Thanks.
>
> Alex Donnini
> >
>


-- 
Donn
http://blog.donnfelker.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] Re: Prevent menu lock

2009-08-21 Thread kaloer

It's a night clock that needs to be visible all night long..

On 21 Aug., 19:54, Mark Murphy  wrote:
> kaloer wrote:
> > Is it possible to prevent the menu lock while an application is
> > running? My application needs to be visible all the time it's running,
> > even though the user doesn't use it.
>
> If the user doesn't use it, why does it need to be visible?
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Need help for your Android OSS project?http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android 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 use the RotationMatrix, actually how to get it

2009-08-21 Thread Mike Collins

Thanks, that seems to work, the orientation is now relative to the
earth.  The documentation could use a little work...

  mike

On Aug 20, 7:08 pm, mscwd01  wrote:
> Oh and you'll need these:
>
> final int matrix_size = 16;
> float[] R = new float[matrix_size];
> float[] outR = new float[matrix_size];
> float[] I = new float[matrix_size];
> float[] values = new float[3];
>
> On Aug 21, 3:06 am, mscwd01  wrote:
>
>
>
> > Heres my code, which works:
>
> > public void onSensorChanged(SensorEvent event) {
>
> >         Sensor sensor = event.sensor;
> >         int type = sensor.getType();
> >         switch (type) {
> >                 case Sensor.TYPE_MAGNETIC_FIELD:
> >                         mags = event.values.clone();
> >                         isReady = true;
> >                     break;
> >                 case Sensor.TYPE_ACCELEROMETER:
> >                     accels = event.values.clone();
> >                     break;
> >                 case Sensor.TYPE_ORIENTATION:
> >                     orients = event.values.clone();
> >                     break;
> >             }
>
> >             if (mags != null && accels != null && isReady) {
> >                 isReady = false;
>
> >                     SensorManager.getRotationMatrix(R, I, accels, mags);
> >                     SensorManager.remapCoordinateSystem(R,
> > SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, outR);
> >                     SensorManager.getOrientation(outR, values);
>
> >                                 azimuth = 
> > getAzimuth(-convert.radToDeg(values[0]));
> >                                 pitch= convert.radToDeg(values[1]);
> >                                 roll = -convert.radToDeg(values[2]);
>
> >             }
>
> >         }
>
> > On Aug 21, 2:39 am, Mike Collins  wrote:
>
> > > I have a sensor event handler that gets fired and I have no problem
> > > getting and processing acceleration readings. However this code
> > > always fails.
>
> > >                 if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
> > >                 {
> > >                         float[] geomagnetic = new float[3];
> > >                         geomagnetic[0] = geomagnetic[1] = geomagnetic[2] 
> > > = 0;
>
> > >                         float[] r = new float[9];
> > >                         float[] I = new float[9];
> > >                         boolean b = SensorManager.getRotationMatrix(r, I, 
> > > event.values.clone
> > > (), event.values.clone());
> > >                         if ( ! b)
> > >                         {
> > >                                 Log.e(LOG_TAG, "getRotationMatrix 
> > > failed");
> > >                                 return;
> > >                         }
> > > ...
>
> > > tia,
> > >   mike
--~--~-~--~~~---~--~~
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] system privileges on emulator

2009-08-21 Thread Asad Zia

Hi,

There seems to be two levels of uses-permission, user level and system
level. When I declare to use  INTERNET or BATTERY_STATS, in my
AndroidManifest.xml file it works without problem. However when I try
to use INSTALL_PACKAGES, BIND_APPWIDGET  it does not work. According
to a [android-beginner msg11514],

“Whoever signs the system is also going to need to sign any app that
wants system privileges.”

I need to know how do I get System Privileges while debugging my
application on emulator.

Thanks,
Asad

--~--~-~--~~~---~--~~
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 make chat window for IM?

2009-08-21 Thread Yusuf Saib (T-Mobile USA)

What happened when you tried ListView with transcript mode?


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




On Aug 20, 11:57 pm, Gulfam  wrote:
> Hi Yusuf Saib,
>
> Sorry for late response because i was on leave.
>
>    Using TextView for chat window i have get the idea form 
> APIDemos->Text->LogTextBox.
>
> I have modifiy that code just like this replace add button with
> EditText and put it at the bottom of screen with send button same like
> default messaging application (compose new message screen). After
> typing chat message i am getting the text from EditText and apending
> it to TextView its working fine but the problem is this when text
> length or lines reaches at the bottom of screen text in TextView is
> not scrolling  upwards its behavior is same like LogTextBox but i need
> to scroll it upward automatically.For example TextView can show 1 to
> 10 lines at a time but when i add 11th line i need TextView scroll one
> line upward and show me 2 to 11 lines and so on its scrolling upwards
> line by line. How it is possible?
>
> I am saving this text in string array line by line against a userId in
> hash table.Now i moved from chatwindow to contacts list and again
> comeback on chatwindow.For example i have added 100 lines before
> moving to contacts list and when i comeback on chatwindow I need its
> show me last 10 lines form 91 to 100. How I can do it? its right
> approach to make chat window? any useful link or tutorial?
>
> Hopes you understand my problem.
>
> Thanks,
> Gulfam Hassan
>
> On Aug 13, 11:34 pm, "Yusuf Saib (T-Mobile USA)" 
>
>
> Mobile.com> wrote:
> > Can you give more details on the problems you encountered with
> > TextView or ListView?
>
> > Yusuf Saib
> > Android
> > ·T· · ·Mobile· stick together
> > The views, opinions and statements in this email are those of the
> > author solely in their individual capacity, and do not necessarily
> > represent those of T-Mobile USA, Inc.
>
> > On Aug 13, 2:50 am, Gulfam  wrote:
>
> > > Hi,
>
> > >   I have tried way recommended by Jeff but i think its not perfect
> > > solution
> > >  any one can help more regarding this.
> > > Jeff V V Thanks for your response.
>
> > > Regards
> > > Gulfam Hassan
>
> > > On Aug 13, 11:36 am, Jeff Sharkey  wrote:
>
> > > > If you'll be working with long conversations, you should look at using
> > > > a ListView to keep scrolling efficient.  Also, ListView offers
> > > > android:transcriptMode, which will can help automatically scroll back
> > > > to the bottom when new messages arrive.
>
> > > > j
>
> > > > On Wed, Aug 12, 2009 at 7:28 AM, Gulfam wrote:
>
> > > > > Hi every body,
>
> > > > >    I am working on IM and i want to make Chat Window but i don't know
> > > > > how to start it. Currently I am using EditText field, a text view and
> > > > > a button, after entering text in EditText field on pressing send
> > > > > button i am getting text from EditText filed and appending it to
> > > > > TextView its looking good but there are some problems, and i don't
> > > > > know its right approach or not ? Any one can refer me any tutorial or
> > > > > any useful link regarding this or any other help ?.
>
> > > > > Thanks  in advance.
>
> > > > > Gulfam Hassan
>
> > > > --
> > > > Jeff Sharkey
> > > > jshar...@android.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 reuse existing activity?

2009-08-21 Thread AndroidGuy

If my current activity stack is A->B->C, I want it to be like A->B->C-
>A, which the top A is the same instance as the first A.

I tried several approaches, but couldn't get what I want.

1. Before calling startActivity, set intent flag as
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT, which makes the stack like B->C-
>A

2. Trying activity A's launch mode as  "singleTask" or
"singleInstance", still couldn't get expected stack.

It looks like the activity stack per task cannot have duplicate one.

Any solutions will be appreciated.

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: sharing database across applications

2009-08-21 Thread Lukeci


why no accessing contacts.db by ContactsProvider directly?
If any changed , using   ContentObserver to receive changes.


On 8月11日, 下午1時13分, Acchao  wrote:
> What's the most convenient way to share adatabaseacross
> applications?
> For example, I want my application's dbadapter to query theandroid's
> native contactdatabaseso when a contact on the phone is deleted,
> similarly that contact is removed from my application.
>
> Should i use anattachstatement toattachthe table? Or would the
> better/more secure approach be to create a custom contentprovider
> query onCreate of my app to verify all contacts in my application
> still reside on the Contacts.db ?
>
> Any help or suggestions would be appreciated. Thanks in advance.
>
> Best,
> Acchao

--~--~-~--~~~---~--~~
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: Security of application

2009-08-21 Thread Balwinder Kaur (T-Mobile USA)

Thanks Dianne. That was a nice piece of information.  A couple of
questions/comments.
1. Is there any way to retrieve information from the .apk on the
server side other than using the aapt tool ?
2. Just curious, why did you say "you probably don't want to download
the .apk to the SD card".

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

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

On Aug 21, 9:50 am, Dianne Hackborn  wrote:
> The official way to do this is to put the .apk somewhere, and launch the app
> installer on it.  This will copy the .apk into a secure place, analyze it,
> present the confirmation dialog (with the app's identity and permissions) to
> the user, and once confirmed proceed with the install.
>
> If your app is being built into the system, you can do a flow like market
> does: get the information about the app from the server first to present the
> confirmation dialog, then download the .apk and directly call the package
> manager to install it.  This of course requires that the app be extremely
> careful about its implementation to avoid holes (ensure it has a secure
> connection with its server, is correctly parsing all relevant data out of
> the .apk on the server, is retrieving the .apk into its private storage
> before installing, etc).  I believe the market also makes use of the
> download manager for downloading the .apk (which has access to the cache
> partition as a secure area for temporary download storage), which is not yet
> a public API but again if you are being bundled with a system you can use.
>
> That all said, there is nothing fundamental here that market is doing that
> regular apps can't.  It is just able to do a different flow (permission
> check before download) because the system trust things built into it to
> directly install apps, and is able to use private APIs like the download
> manager instead of doing that work itself.
>
> Anyway, you probably don't want to download the .apk to the SD card, though
> from the system's perspective this is not a security hole, since it will
> copy the .apk into its own secure area before proceeding with the install.
>
>
>
> On Fri, Aug 21, 2009 at 7:44 AM, engin  wrote:
>
> > Hi, I want to learn that how google android market provides security
> > of application.That is, I realize that, when user downloads
> > application, market downloads and install application atomically to
> > phone. I am designing market and security is important issue so I
> > wonder that how google achieve this? How is application installed
> > phone?
> > 1) Is the apk downloaded sdcard and deleted after installation? In the
> > case of this how can market guarantee that when apk downloaded to
> > sdcard, program finishes unexpectedly  and installation- deletion of
> > apk cannot be done?
> > 2) Or installation is done from server?
> > 3) I think that there exists  security not to copy apk. how do they do
> > this?  Maybe they use phone id to install application, by this way
> > even if anyone copy apk they cannot install it other phone?
>
> > As I said above I am trying to desing market.
> > Thanks...
>
> --
> 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
-~--~~~~--~~--~--~---



  1   2   >