[android-developers] Re: Portrait/landscape question

2010-04-18 Thread Bob Kerns
Well, actually, it IS explained in another location (http://
developer.android.com/intl/de/guide/topics/manifest/activity-
element.html). You so often have to look in two or three different
pieces of documentation to get the full story...

It amounts to "a suitable default for the device". I guess we could
check the display dimensions and set it to Portrait or Landscape on
entry to the activity. I guess there's more than one place this
decision could be made, with slightly different results, anyway.

On Apr 18, 11:44 pm, Bob Kerns  wrote:
> If you'd like a quick tour of all the options for
> setRequestedOrientation(), my app, SmartVolume Free, does this, and
> lets you control what value to supply to setRequestedOrientation() in
> a preference setting. (The default is to not set it at all, and use
> the system's setting).
>
> Of course, it's not hard to throw the code into your app, but this way
> you can switch back and forth more quickly.
>
> I'm still not clear on how the orientation is chosen for
> ActivvityInfo.SCREEN_ORIENTATION_NOSENSOR. On my device (N1) it seems
> to always come up in Portrait. I don't know if this is intended to be
> "a suitable default for the device", or something else. It doesn't
> appear to be "what orientation the device was in on start", which I
> think would be more useful. I guess I'll go fill a documentation bug.
>
> I put this in for a couple reasons. One is that my app is more usable
> in portrait mode, but switching to portrait mode if you're using it in
> landscape may not be desirable. Another is that before 2.1 update 1,
> the launcher would crash (out of memory) if it was behind a window
> that switched to landscape and you had too many apps...
>
> On Apr 18, 1:27 pm, Mark Murphy  wrote:
>
>
>
>
>
> > Isaac Wagner wrote:
> > > On Sun, Apr 18, 2010 at 3:25 PM, Justin Giles  wrote:
> > >> Why would you want to allow them to set it in settings when Android 
> > >> handles
> > >> the rotation automagically?  All you have to do is have a xml file in 
> > >> your
> > >> "layout" directory, then for landscape have a xml file (with the same 
> > >> name)
> > >> in your "layout-land" directory.  When in portrait mode Android looks to 
> > >> the
> > >> "layout" directory.  When the phone is flipped to its side for landscape,
> > >> Android looks to the "layout-land" directory.
> > >> Justin
>
> > >  why is it that when I ask a simple question I get harassed?
>
> > This discussion list gets a lot of people asking questions where they
> > are barking up the wrong tree. It is commonplace to inquire about their
> > rationale for barking up that tree and steer them in the direction of
> > more common patterns. Sometimes, the barking is indeed up the correct
> > tree, but that may not always be obvious from the question.
>
> > If you consider that to be harassment, you may wish to choose a
> > different means of getting Android developer support.
>
> > > OK, since it appears I can't get a simple answer without a long
> > > explanation My application is one such that the user moves their
> > > phone around a lot.  During this movement I want to keep the
> > > orientation constant -- I DON'T WANT ANDROID TO HANDLE THE ROTATION.
> > > So, in my manifest I set the orientation to portrait to prevent
> > > Android from mucking with the orientation.  However, I am now making
> > > some additions and would like the user to be able to choose portrait
> > > or landscape mode, but whatever they choose needs to stick.  Again, I
> > > don't want Android to handle the rotation.  As the phone is moved
> > > around I want whichever orientation they chose to stick.
>
> > > Does that make sense?  Now, how do I do this?  How do I force the
> > > orientation to my preference?
>
> > You can try the combination of setRequestedOrientation() in onCreate()
> > (and from the menu or wherever the user chooses their preference) and
> > android:configChanges="keyboardHidden|orientation" in your manifest. I
> > have not used setRequestedOrientation() personally.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Training in NYC: 30 April-2 May 2010:http://guruloft.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 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
Yo

[android-developers] how to depress the onLongClick() when drag a view

2010-04-18 Thread sheng wang
Hi,

I have a View and I can drag it. It also has a onLongClick() method so it
can respond to the long press on the screen.

The problem is when I drag it , the onLongClick will also be triggered .
Anyone have an idea to depress the long click detection when i move it .


Thanks in advances.
Shawn.

-- 
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] Pass ArrayList parameters between two activities.

2010-04-18 Thread Ke Wu
-- Forwarded message --
From: Ke Wu 
Date: 2010/4/19
Subject: Pass ArrayList parameters between two activities.
To: android-developers@googlegroups.com


Hi all,
 Today I met a problem, I need to pass a ArrayList from an
activity to another. I dont know what the Intent exactly do when I use
putExtra to pass in an ArrayList object.

 I guess MyClass need to implement Parcelable interface, so I just did
it. But still, it does not work.

Maybe I need to create a Bundle and then use Bundle's
putParcelableArrayList
method to put my ArrayList object in, and then pass this bundle as
parameter of putExtra to the intent.
So crazy! I am lazy, I just want to pass an ArrayList object
simply, is there a simple way??

 Any suggestion would be greatly appreciated!

kerl.d.w

-- 
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: Portrait/landscape question

2010-04-18 Thread Bob Kerns
If you'd like a quick tour of all the options for
setRequestedOrientation(), my app, SmartVolume Free, does this, and
lets you control what value to supply to setRequestedOrientation() in
a preference setting. (The default is to not set it at all, and use
the system's setting).

Of course, it's not hard to throw the code into your app, but this way
you can switch back and forth more quickly.

I'm still not clear on how the orientation is chosen for
ActivvityInfo.SCREEN_ORIENTATION_NOSENSOR. On my device (N1) it seems
to always come up in Portrait. I don't know if this is intended to be
"a suitable default for the device", or something else. It doesn't
appear to be "what orientation the device was in on start", which I
think would be more useful. I guess I'll go fill a documentation bug.

I put this in for a couple reasons. One is that my app is more usable
in portrait mode, but switching to portrait mode if you're using it in
landscape may not be desirable. Another is that before 2.1 update 1,
the launcher would crash (out of memory) if it was behind a window
that switched to landscape and you had too many apps...

On Apr 18, 1:27 pm, Mark Murphy  wrote:
> Isaac Wagner wrote:
> > On Sun, Apr 18, 2010 at 3:25 PM, Justin Giles  wrote:
> >> Why would you want to allow them to set it in settings when Android handles
> >> the rotation automagically?  All you have to do is have a xml file in your
> >> "layout" directory, then for landscape have a xml file (with the same name)
> >> in your "layout-land" directory.  When in portrait mode Android looks to 
> >> the
> >> "layout" directory.  When the phone is flipped to its side for landscape,
> >> Android looks to the "layout-land" directory.
> >> Justin
>
> >  why is it that when I ask a simple question I get harassed?
>
> This discussion list gets a lot of people asking questions where they
> are barking up the wrong tree. It is commonplace to inquire about their
> rationale for barking up that tree and steer them in the direction of
> more common patterns. Sometimes, the barking is indeed up the correct
> tree, but that may not always be obvious from the question.
>
> If you consider that to be harassment, you may wish to choose a
> different means of getting Android developer support.
>
> > OK, since it appears I can't get a simple answer without a long
> > explanation My application is one such that the user moves their
> > phone around a lot.  During this movement I want to keep the
> > orientation constant -- I DON'T WANT ANDROID TO HANDLE THE ROTATION.
> > So, in my manifest I set the orientation to portrait to prevent
> > Android from mucking with the orientation.  However, I am now making
> > some additions and would like the user to be able to choose portrait
> > or landscape mode, but whatever they choose needs to stick.  Again, I
> > don't want Android to handle the rotation.  As the phone is moved
> > around I want whichever orientation they chose to stick.
>
> > Does that make sense?  Now, how do I do this?  How do I force the
> > orientation to my preference?
>
> You can try the combination of setRequestedOrientation() in onCreate()
> (and from the menu or wherever the user chooses their preference) and
> android:configChanges="keyboardHidden|orientation" in your manifest. I
> have not used setRequestedOrientation() personally.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training in NYC: 30 April-2 May 2010:http://guruloft.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 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: glTexImage2D very slow on phones like Nexus one

2010-04-18 Thread Eong
Sorry, I mean write the frame to a pixel buffer.
I think fbo is a ES2 feature, right? What about the other ES1 phones?
As a developer, you can't just give up the 75% users.

On 4月19日, 下午2时20分, Eong  wrote:
> Hi,
>   I'm writing this part for video output.
>   This is for video output at most of the time. Our decoder write the
> screen to a pixel buffer. And then I need to draw it to the screen.
> So, you mean, I can use FBO to do this? I'm not very familiar with fbo
> stuffs. Could you give more hint?
>   Thank you!
>
> On 4月18日, 下午5时18分, Robert Green  wrote:
>
>
>
> > Eong,
>
> > All Mario and I are trying to say is that the thing you are trying to
> > do (upload textures every frame) is generally not considered a good
> > practice and workarounds usually exist that are more efficient,
> > especially if you can target higher levels of opengl or use extensions
> > like framebufferobjects.  If you would be willing to tell us something
> > a little bit more specific about what you're doing that requires a
> > texture update every frame, we could potentially offer some more
> > efficient ways of doing it.
>
> > On Apr 18, 2:44 am, Eong  wrote:
>
> > > Thanks, Mario.
> > > I think it's somewrong with the driver or the chip. It's not just a
> > > bandwidth problem. If it's really a bandwidth problem, it only has 1/7
> > > bandwidth of milestone? (150ms compare to 20ms with a full screen
> > > tex).That's very funny.
>
> > > I'm working on some libs, which will be used for our tools and games.
> > > When a full screen update only takes 20+ms, it's usable in some
> > > conditions as it already gets at least 40fps.
>
> > > On 4月17日, 下午6时22分, Mario Zechner  wrote:
>
> > > > It seems that the msm chips are notorious for having a low bandwidth.
> > > > There's really no solution to that problem other than
>
> > > > 1) lowering your texture size
> > > > 2) lowering the bit depth of the texture, e.g. instead of using
> > > > RGBA use RGBA444 or RGB565
> > > > 2) uploading your texture in patches, e.g. split it up into 4 smaller
> > > > parts and upload one part each frame. This will probably lead to
> > > > artifacts if your frame rate is low but could work otherwise.
>
> > > > Just out of curiousity: why do you have to upload such a big texture
> > > > each frame? If you'd state your scenario in detail we might be able to
> > > > suggest other solutions to the problem.
>
> > > > On 17 Apr., 12:10, Eong  wrote:
>
> > > > > Robert,
> > > > >    Sorry, it's not text, it's tex. I just use this to draw the
> > > > > background.
> > > > >    I just want to know why nexus one is so slow with this. It takes
> > > > > 20ms on my milestone but it takes at least 80ms on the nexus one, for
> > > > > one frame.
>
> > > > > On 4月17日, 上午2时08分, Robert Green  wrote:
>
> > > > > > Eong,
>
> > > > > > You said you are uploading every frame just to draw text?  There are
> > > > > > much more efficient ways to do that.
>
> > > > > > On Apr 16, 11:14 am, Eong  wrote:
>
> > > > > > > I'm afraid it's not a same problem.
> > > > > > > My problem only happenes on Snapdragon phones.
> > > > > > > It's fine on Milestone or Droid. I found a few threads about this 
> > > > > > > but
> > > > > > > no solution.
>
> > > > > > > On 4月16日, 下午9时15分, Felipe Silveira  wrote:
>
> > > > > > > > Just a guess: It can be the same error reported 
> > > > > > > > here:http://code.google.com/p/android/issues/detail?id=7520
>
> > > > > > > > Take a look...
>
> > > > > > > > Felipe Silveirahttp://www.felipesilveira.com.br
>
> > > > > > > > On Fri, Apr 16, 2010 at 8:40 AM, Eong  
> > > > > > > > wrote:
> > > > > > > > > Hi,
> > > > > > > > > We are developing 2D games. And we found our game works fine 
> > > > > > > > > except
> > > > > > > > > the snapdragon chips, like Nexus one and Liquid A1. It even 
> > > > > > > > > runs fine
> > > > > > > > > on G1.
>
> > > > > > > > > We use GLSurfaceView, and we useglTexImage2Dand 
> > > > > > > > > glTexIsubmage2D to
> > > > > > > > > put on the text and then draw.
> > > > > > > > > TheglTexImage2Dclass take more than 100ms on Nexus one 
> > > > > > > > > (1024x512 pix
> > > > > > > > > tex). It's very strange, G1 is even faster than this.
> > > > > > > > > If anyone know something about this?
>
> > > > > > > > > -Code
> > > > > > > > > snip---
> > > > > > > > >                                        
> > > > > > > > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT
> > > > > > > > > | GL10.GL_DEPTH_BUFFER_BIT);
>
> > > > > > > > >  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, m_width,
> > > > > > > > > m_height, GL10.GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas);
>
> > > > > > > > >                                        
> > > > > > > > > ((GL11Ext)gl).glDrawTexiOES(0, 0, 0,
> > > > > > > > > m_width, m_height);
>
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to the 
> > > > > > > > > Google
> > > > > > > > > Groups 

Re: [android-developers] Re: Game develop like "Air Attack" touching screen event

2010-04-18 Thread a a
I add

android:focusableInTouchMode="true"
in my xml

and try to override the

@Override
public void setFocusableInTouchMode(boolean focusableInTouchMode) {

Log.d("harvey", "setFocusableInTouchMode");
}
But still can work when touch the screen, what' wrong?

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


Re: [android-developers] Re: Game develop like "Air Attack" touching screen event

2010-04-18 Thread a a
Dear Robert,

How can i calls setFocusableOnTouchEvents(true)?
where can i wrote?

2010/4/17 Robert Green :
> Make sure your view calls setFocusableOnTouchEvents(true)
>
> On Apr 16, 4:44 am, a a  wrote:
>> Dear all, i tested below, but it don't work
>>
>> 1. I wrote my GodsendView
>> public class GodsendView extends View implements OnTouchListener
>> {
>>         @Override
>>         public boolean onTouch(View v, MotionEvent event) {
>>                 Log.d("harvey", "onTouch");
>>                 return false;
>>         }
>>
>> }
>>
>> 2.wrote a xml
>> 
>> http://schemas.android.com/apk/res/android";
>>     android:orientation="vertical"
>>     android:layout_width="fill_parent"
>>     android:layout_height="fill_parent"
>>     >
>>     >          android:id="@+id/godsend"
>>                 android:layout_width="fill_parent"
>>                 android:layout_height="fill_parent"
>>                 tileSize="24"
>>                 />
>> 
>>
>> 3. Activity
>> public class GodSendActivity extends Activity {
>>     /** Called when the activity is first created. */
>>     @Override
>>     public void onCreate(Bundle savedInstanceState) {
>>         super.onCreate(savedInstanceState);
>>         setContentView(R.layout.main);
>>     }
>>
>> }
>>
>> but after i touch the screen, can't print my test log
>>         Log.d("harvey", "onTouch");
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group 
>> athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


[android-developers] help

2010-04-18 Thread subrat kumar panda
hello everybody,
This is subrat, i have some problem with preference screen.
in my preference screen there are 4 checkboxes & 2 lists.
so, my problem is if i do any change to checkbox or list(means, if i check one
 unchecked checkbox or vice versa as, or i select a value from list),
i want 2 post the
edited data to server for save(i am using axis server), when i press the button.
but here when i am pressing the back button after edited there is no change.
i am expecting some help .
i don't know why  i am  not able to connect to server.

here is my code:

package com.microaiddreamworks.gps;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.kobjects.util.Csv;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import com.microaiddreamworks.util.*;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.Preference.OnPreferenceClickListener;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class TestPreference extends PreferenceActivity{

private SharedPreferences m_cSharedPreferences = null  ;
private String m_cSafeZoneAlert = "0";
private String m_cOnlineTracking = "0";
private String m_cSpeedAlert = "20";
private String m_cBreadCrumbing = "1";
private String m_cLowBatteryAlert = "0";
private String m_cWhereIsLookup = "0";
ServerMethods m_cObjServer_Methods = null;
private String m_clRetVal = null;
boolean CheckBoxPreference = false;
String ListPreference = null;


@Override
 protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);

// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.testpreference);

getWindow().setBackgroundDrawableResource(R.drawable.White);
getListView().setBackgroundColor(Color.TRANSPARENT);
getListView().setCacheColorHint(Color.TRANSPARENT);
  //  getWindow().setTitleColor(Color.BLACK);
   //View view = ((Preference) 
m_cSharedPreferences).getView(null,null);
  //   
((TextView)view.findViewWithTag(android.R.id.title)).setTextColor(Color.BLACK);
m_cSharedPreferences =
PreferenceManager.getDefaultSharedPreferences(getBaseContext());
m_cObjServer_Methods = new ServerMethods();
   }

private void SaveConfigToServer() {
// TODO Auto-generated method stub


try{
  CheckBoxPreference =
m_cSharedPreferences.getBoolean("checkbox_preference1", false);
  m_cSafeZoneAlert = String.valueOf(CheckBoxPreference);
  CheckBoxPreference =
m_cSharedPreferences.getBoolean("checkbox_preference2", false);
  m_cOnlineTracking = 
String.valueOf(CheckBoxPreference);
  CheckBoxPreference =
m_cSharedPreferences.getBoolean("checkbox_preference3", false);
  m_cLowBatteryAlert = 
String.valueOf(CheckBoxPreference);
  CheckBoxPreference =
m_cSharedPreferences.getBoolean("checkbox_preference4", false);
  m_cWhereIsLookup = String.valueOf(CheckBoxPreference);
  ListPreference =
m_cSharedPreferences.getString("list_preference1", "speed_alert");
  m_cSpeedAlert = ListPreference;
  ListPreference =
m_cSharedPreferences.getString("list_preference2", "bread_crumb");
  m_cBreadCrumbing = ListPreference;

/*m_cSpeedAlert = ((Preference)
m_cSharedPreferences).getSharedPreferences().getString("list_preference1","speed_alert");
m_cBreadCrumbing = ((Preference)
m_cSharedPreferences).getSharedPreferences().getString("list_preference2",
"bread_crumb");
m_cSafeZoneAlert = String.valueOfPreference)
m_cSharedPreferences).getSharedPreferences(

[android-developers] Pass ArrayList parameters between two activities.

2010-04-18 Thread Ke Wu
Hi all,
 Today I met a problem, I need to pass a ArrayList from an
activity to another. I dont know what the Intent exactly do when I use
putExtra to pass in an ArrayList object.

 I guess MyClass need to implement Parcelable interface, so I just did
it. But still, it does not work.

Maybe I need to create a Bundle and then use Bundle's
putParcelableArrayList
method to put my ArrayList object in, and then pass this bundle as
parameter of putExtra to the intent.
So crazy! I am lazy, I just want to pass an ArrayList object
simply, is there a simple way??

 Any suggestion would be greatly appreciated!

kerl.d.w

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

Re: [android-developers] Re: GetLocation of the phone

2010-04-18 Thread Anurag Singh
Store in a Bundle pass to your activity

public void onLocationChanged(Location loc) {
   if (loc != null) {
   double lat=loc.getLatitude();
   double lon=loc.getLongitude();

   Bundle bundle = new Bundle();
   bundle.putDouble("lat", lat);
   bundle.putDouble("lon", lon);

  // Create  Intent, store Bundle into Intent and paas intent to
another Activity

   information = " "+lat +lon;
   Toast.makeText(this,   "Location Changed:"+information,
   Toast.LENGTH_LONG).show();

   }
  }

And  you can extract these value in OnCreate() of another Activity.

Bundle b = this.getIntent().getExtras();

- Anurag Singh


On Mon, Apr 19, 2010 at 10:24 AM, raqz  wrote:

> yes.. its getting the locations all right..but i am unable to save the
> location somwhere so that i can use it later. thats the whole
> issue
>
> I just thought of something...
> if I start a service that does the onLocationChanged stuffit would
> get the gps locations and store it (somewhere in the system)
> and later if i just start an acitivity that would do
> getLastKnowLocation() , shouldn't that fetch the location for further
> use.
> Come some one advise please
>
>
>
> On Apr 19, 12:22 am, Anurag Singh  wrote:
> > Have you set uses permission in manifiest file.
> >
> >  > android:name="android.permission.ACCESS_FINE_LOCATION" />
> >
> > - Anurag Singh
> >
> > Hi,
> >
> >
> >
> >
> >
> > > I am trying to retrieve the GPS location of the phone. I believe I
> > > cannot create an object of the class which stores the location in a
> > > variable. So that once the class gets instantiated I use a get method
> > > and retrieve the content in the variable.
> > > So I am trying to do this
> >
> > > locationListener = new MyLocationListener();
> >
> > >lm.requestLocationUpdates(
> > >LocationManager.GPS_PROVIDER,0,0,locationListener);
> > >if(!information.equals(null)){
> > >Bundle bundle = new Bundle();
> > >bundle.putString("hello", information);
> > >Intent intent = new Intent(LocationActivity.this,
> > > MainActivity.class);
> > >intent.putExtras(bundle);
> > >startActivity(intent);
> > >}
> >
> > > and in the locationlistener class
> >
> > > public void onLocationChanged(Location loc) {
> > >if (loc != null) {
> > >double lat=loc.getLatitude();
> > >double lon=loc.getLongitude();
> > >information = " "+lat +lon;
> > >Toast.makeText(getBaseContext(),
> > >"Location Changed:"+information,
> > >Toast.LENGTH_LONG).show();
> > >}
> > >else
> > >information="bad luck";
> > >}
> >
> > > The mainactivity then displays that...but its not happening...could
> > > some one please help me how to get the values of this.
> >
> > > Thanks...Raqeeb
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> 
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: glTexImage2D very slow on phones like Nexus one

2010-04-18 Thread Eong
Hi,
  I'm writing this part for video output.
  This is for video output at most of the time. Our decoder write the
screen to a pixel buffer. And then I need to draw it to the screen.
So, you mean, I can use FBO to do this? I'm not very familiar with fbo
stuffs. Could you give more hint?
  Thank you!


On 4月18日, 下午5时18分, Robert Green  wrote:
> Eong,
>
> All Mario and I are trying to say is that the thing you are trying to
> do (upload textures every frame) is generally not considered a good
> practice and workarounds usually exist that are more efficient,
> especially if you can target higher levels of opengl or use extensions
> like framebufferobjects.  If you would be willing to tell us something
> a little bit more specific about what you're doing that requires a
> texture update every frame, we could potentially offer some more
> efficient ways of doing it.
>
> On Apr 18, 2:44 am, Eong  wrote:
>
>
>
> > Thanks, Mario.
> > I think it's somewrong with the driver or the chip. It's not just a
> > bandwidth problem. If it's really a bandwidth problem, it only has 1/7
> > bandwidth of milestone? (150ms compare to 20ms with a full screen
> > tex).That's very funny.
>
> > I'm working on some libs, which will be used for our tools and games.
> > When a full screen update only takes 20+ms, it's usable in some
> > conditions as it already gets at least 40fps.
>
> > On 4月17日, 下午6时22分, Mario Zechner  wrote:
>
> > > It seems that the msm chips are notorious for having a low bandwidth.
> > > There's really no solution to that problem other than
>
> > > 1) lowering your texture size
> > > 2) lowering the bit depth of the texture, e.g. instead of using
> > > RGBA use RGBA444 or RGB565
> > > 2) uploading your texture in patches, e.g. split it up into 4 smaller
> > > parts and upload one part each frame. This will probably lead to
> > > artifacts if your frame rate is low but could work otherwise.
>
> > > Just out of curiousity: why do you have to upload such a big texture
> > > each frame? If you'd state your scenario in detail we might be able to
> > > suggest other solutions to the problem.
>
> > > On 17 Apr., 12:10, Eong  wrote:
>
> > > > Robert,
> > > >    Sorry, it's not text, it's tex. I just use this to draw the
> > > > background.
> > > >    I just want to know why nexus one is so slow with this. It takes
> > > > 20ms on my milestone but it takes at least 80ms on the nexus one, for
> > > > one frame.
>
> > > > On 4月17日, 上午2时08分, Robert Green  wrote:
>
> > > > > Eong,
>
> > > > > You said you are uploading every frame just to draw text?  There are
> > > > > much more efficient ways to do that.
>
> > > > > On Apr 16, 11:14 am, Eong  wrote:
>
> > > > > > I'm afraid it's not a same problem.
> > > > > > My problem only happenes on Snapdragon phones.
> > > > > > It's fine on Milestone or Droid. I found a few threads about this 
> > > > > > but
> > > > > > no solution.
>
> > > > > > On 4月16日, 下午9时15分, Felipe Silveira  wrote:
>
> > > > > > > Just a guess: It can be the same error reported 
> > > > > > > here:http://code.google.com/p/android/issues/detail?id=7520
>
> > > > > > > Take a look...
>
> > > > > > > Felipe Silveirahttp://www.felipesilveira.com.br
>
> > > > > > > On Fri, Apr 16, 2010 at 8:40 AM, Eong  wrote:
> > > > > > > > Hi,
> > > > > > > > We are developing 2D games. And we found our game works fine 
> > > > > > > > except
> > > > > > > > the snapdragon chips, like Nexus one and Liquid A1. It even 
> > > > > > > > runs fine
> > > > > > > > on G1.
>
> > > > > > > > We use GLSurfaceView, and we useglTexImage2Dand glTexIsubmage2D 
> > > > > > > > to
> > > > > > > > put on the text and then draw.
> > > > > > > > TheglTexImage2Dclass take more than 100ms on Nexus one 
> > > > > > > > (1024x512 pix
> > > > > > > > tex). It's very strange, G1 is even faster than this.
> > > > > > > > If anyone know something about this?
>
> > > > > > > > -Code
> > > > > > > > snip---
> > > > > > > >                                        
> > > > > > > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT
> > > > > > > > | GL10.GL_DEPTH_BUFFER_BIT);
>
> > > > > > > >  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, m_width,
> > > > > > > > m_height, GL10.GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas);
>
> > > > > > > >                                        
> > > > > > > > ((GL11Ext)gl).glDrawTexiOES(0, 0, 0,
> > > > > > > > m_width, m_height);
>
> > > > > > > > --
> > > > > > > > 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 > > > > > > >  cr...@googlegroups.com>
> > > > > > > > For more options, visit this group at
> > > > > > > >http://groups.google.com/group/an

[android-developers] help

2010-04-18 Thread subrat kumar panda
Hello everybody,
This is subrat, in my app i want 2 change the background and text color of
preference screeen.
in my preference screen there are 4 checkboxes & 2 lists.

i have used the following code to change background color:

getWindow().setBackgroundDrawableResource(R.drawable.White);
getListView().setBackgroundColor(Color.TRANSPARENT);
getListView().setCacheColorHint(Color.TRANSPARENT);

Now, background is looking white, but how i change the text color
to black.
i am requesting  if anybody have the knowledge please help me.

Thanking you,
Best Regards

Subrat Kumar Panda

-- 
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: Moving two views together

2010-04-18 Thread Sonic..
I'll reframe my question. I'm not using a scrollview anymore. I have
two lists being displayed in my activity. I heard that using a
listview within a scrollview causes issues. So I need a way where in I
can scroll both the lists simultaneously. Does that mean I need to
override some functions of a listview. I tried to do something with
the OnScrollListener but couldn't find much help. Can I use the
OnScrollListener and using the view given I can scroll both the lists.

On Apr 19, 10:50 am, "Sonic.."  wrote:
> Hey, if you could please give me more details for the same. I'm still
> a starter in android development.
>
> On Apr 13, 6:34 pm, social hub  wrote:
>
> > hack into onmove onscroll onfling methods and pass them to  other view
>
> > On Tue, Apr 13, 2010 at 6:25 AM, Sonic.. 
> > wrote:
>
> > > Hello,
>
> > > I currently have one Scrollview which contains a table layout and one
> > > list in my activity. Now my problem is that I wanted to move both of
> > > them(Scrollview and list) together and with proper synchronization...
> > > So if scrollview is being scrolled then listview should also scroll
> > > with the same distance, and vice versa...
>
> > > Thanks in advance..
>
> > > Abhishek
>
> > > --
> > > 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
>
> > > To unsubscribe, reply using "remove me" as the subject.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Robert Green
Excellent work, Mario.  I think it's quite clear that the input
processing code in Android needs help.  Eating 20-30% of a Cortex A8
is a pretty big deal.

On Apr 18, 4:21 pm, Mario Zechner  wrote:
> For fun i extended the example i posted earlier. It now feature cpu
> usage output derrived from /proc/stat which should be enough to given
> an indication of the slow down occuring due to touch events.
>
> The setup:
>
> - A GLSurfaceView
> - An OnTouchListener that does nothing but return true
> - A simple renderer thread which is throttled via a Thread.sleep(200)
> to 5 frames per second which outputs the frames per second as well as
> the cpu usage
>
> Observation on Milestone with 2.0.1:
> - load without touching the screen - 4%-12%
> - load with touching the screen - 24%-44%
>
> due to the way i measure the cpu usage it of course fluctuates quiet a
> bit, the overall tendency can be easily derrived though.
>
> You can find the apk athttp://www.file-pasta.com/file/1/touchflood.apk,
> the Eclipse project with all the source can be found 
> athttp://www.file-pasta.com/file/0/touchflood.zip.
>
> On 18 Apr., 22:18, Robert Green  wrote:
>
>
>
> > The fundamental issue is that there are too many instructions per
> > event being executed.  There is no way around it other than optimizing
> > the event handling code in KeyInputQueue.  No amount of waiting or
> > sleeping will fix that because those events must run through that code
> > and that code appears to be very slow.  It surprises me because it's
> > truly performance critical code and this issue has been known since
> > 1.1/1.5 and it still doesn't appear to be fixed in master.  I'm
> > looking at it now and the author(s) didn't even follow Android's best
> > optimization practices.  Simple things like declaring virtuals with
> > local variables aren't done.
>
> > For a moment today I was considering taking the input stack (EventHub,
> > KeyInputQueue and InputDevice) and hacking it into my own input stack
> > which reads off the event devices much more efficiently but I can't
> > find any way to stop the system stack from running and consuming CPU,
> > so that hack is out (and probably good because I really didn't want to
> > go there - waste of time and probably wouldn't work right anyway).
>
> > In my activity:
> > public boolean onTouchEvent(MotionEvent e) {
> >   return false;
>
> > }
>
> > And system_server still consumes about 36% of the CPU while moving my
> > finger around.  That proves there is nothing a developer can do to
> > work around this.  I think I'll take this issue to the platform group
> > now and try to file more specific bugs.
>
> > On Apr 18, 10:38 am, Ralf Schneider  wrote:
>
> > > I have already talked a lot about the touch slow down in this forum.
> > > There is another observation I would like to add, may be this can help to
> > > track the problem down.
>
> > > One of my projects is an Argumented Reality Game.
> > > Of course this kind of App eats energy (CPU cycles) like crazy:
>
> > > In my app I process:
> > > The camare, OpenGL graphics, Pseudo-3D-Sound mixing (8 simultaneous 
> > > samples
> > > + ogg-music), 2 constant sensor imputs (acceleration, magnetic) and
> > > additional input from trackball, hardware keys and the touch screen.
>
> > > The largest slow down occurs with the touch-events.
>
> > > But the next big slow down occurs with the accleration and magnetic 
> > > events!
> > > I gained up to 4 FPS on a N1 by switching from SENSOR_DELAY_FASTEST to
> > > SENSOR_DELAY_GAME.
>
> > > => So I just wonder: May be the slow down is in no way specific to touch
> > > events! Instead the whole input-queue-event handling is just horribly 
> > > slow.
> > > As everyonw has observed: Touching the screen will trigger (flood) lots of
> > > events - This is similar as enabling input from other sensors - which can
> > > slow down the app in a compareable way, too!
> > > The main differences is only: Touching the screen will still trigger more
> > > event than using a sesnor in *SENSOR_DELAY_FASTEST*. So the slow down
> > > appears as less drastically...
>
> > > After working a while with Android, I must say:
> > > The design and architecture of the Java-API seems to be nice and well done
> > > most of the time.
> > > But the execution and implementation of the software stack as a whole 
> > > seems
> > > to be just slow, slow, slow, slow,  All this doesn't matter if you 
> > > have
> > > lots of servers with many cores (ENTERPRISE!) but for an
> > > embedded-soft-realtime-device I expect more!
>
> > > IMHO the OS on an embedded device with a 1 GHZ CPU should not use more 
> > > than
> > > 1% of the CPU to process around thousand events per seconds - and even 
> > > this
> > > i would consider slow.
> > > Anyway, this time I resist to go into a deeper rant.
>
> > > Kind Regards,
> > > Ralf
>
> > > 2010/4/18 Robert Green 
>
> > > > I've tried sleep() and have switched to wait(1000), notify() / yield()
> > > > as outlined by so

[android-developers] Re: Moving two views together

2010-04-18 Thread Sonic..
Hey, if you could please give me more details for the same. I'm still
a starter in android development.

On Apr 13, 6:34 pm, social hub  wrote:
> hack into onmove onscroll onfling methods and pass them to  other view
>
> On Tue, Apr 13, 2010 at 6:25 AM, Sonic.. wrote:
>
> > Hello,
>
> > I currently have one Scrollview which contains a table layout and one
> > list in my activity. Now my problem is that I wanted to move both of
> > them(Scrollview and list) together and with proper synchronization...
> > So if scrollview is being scrolled then listview should also scroll
> > with the same distance, and vice versa...
>
> > Thanks in advance..
>
> > Abhishek
>
> > --
> > 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
>
> > To unsubscribe, reply using "remove me" as the subject.

-- 
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] ArrayIndexOutOfBoundException while reading the file

2010-04-18 Thread pramod.deore
hello everybody, I am developing one application in that I am reading
one file in parts (I am reading 102400 bytes at a time ) and sending
it to server. size of file is more than 5mb. I had write following
method to read the file

 public void readFile()
 {
  try
  {
  int size = (int)myFile.length();
  noOfChunks = (size/102400);
  noOfChunks = noOfChunks+1;
  System.out.println ("size of file is "+size);

  System.out.println ("size is"+noOfChunks);
  FileInputStream fstream = new FileInputStream(myFile);

  DataInputStream in = new DataInputStream(fstream);

  byte[] byteArray = new byte[102400];

  for (int i=1;i!=noOfChunks;i++)
  {

  xyz = in.skip(start);

  System.out.println ("skipped :"+start);

  in.readFully(byteArray, start, end);//[b]This is
line no 133 here exception occurs[/b]

  str = new String(byteArray);
  sendData("0213456789_A~addressbook.txt~10~"+str);
  start = end;
  end = end+102398;
  }

  }
  catch (IOException ioe)
  {
  ioe.printStackTrace();
  }
 }

But when this method throws IndexOutOfboundException at line 133.
Actually I thought because of "in.readFully(byteArray, start, end);
"
It reads from start to end and store it to byteArray, but it is not
working like that.

Anybody knows what I am doing wrong?

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: Android Appending Values Received From Server

2010-04-18 Thread Bob Kerns
What exactly do you mean by "second usage"?

Just pressing the home key and then tapping your program icon won't
create a new activity instance, unless the old one has been deleted.
You can't depend on it being deleted, in fact, you'd prefer it not be.

Study the diagram in the Activity class documentation (a screen or two
down): http://developer.android.com/intl/de/reference/android/app/Activity.html

Note that there are paths that take you back into the activity.
Depending on what exactly what data is you're getting from the server,
you may want to reinitialize in onResume() or onStart(). My guess
would be onStart() -- I think you probably don't want to re-fetch data
just because a dialog popped up, then returned control to your
Activity.

Likewise, you may want to de-initialize the data (for example, null
out the variable containing it) in the onStop() method, which will
allow the memory to be reclaimed sooner.

On Apr 18, 7:24 pm, raqz  wrote:
> Hi,
>
> I am trying to receive some data from a servlet on to android. It
> works fine for the first run but if in case I happen to use the same
> activity again, the previous data is  getting appended to the new
> data.
> Could some one please tell me what is wrong. Why dont the variables
> get re initialized in the activity on the second usage of the same
>
> Thanks,
> Raqeeb
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Map app with GPS is not working in Nexus One

2010-04-18 Thread SREEHARI
Hi All,

  Thanks for ur replyBut my doubt is why I am getting exception in
nexus one onlyI tried the same code with G1.It is working fine
in that.Ok...anyway I will try with requestLocationUpdates

Regards,
SREEHARI.

-- 
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: GetLocation of the phone

2010-04-18 Thread raqz
i have been getting the locations fine...thats not issue..so please be
assured that i have set the manifest file right...
i just need to send the lcoations to another activity and i am not
able to do that

i just thought of this...start a service that would collect gps data
at regular intervals of time...
and then just start my activity that would use getLastKnownLocation()
and get the locations..

Can some one please advise if i am going on the right directio n

On Apr 19, 12:22 am, Anurag Singh  wrote:
> Have you set uses permission in manifiest file.
>
>  android:name="android.permission.ACCESS_FINE_LOCATION" />
>
> - Anurag Singh
>
> Hi,
>
>
>
>
>
> > I am trying to retrieve the GPS location of the phone. I believe I
> > cannot create an object of the class which stores the location in a
> > variable. So that once the class gets instantiated I use a get method
> > and retrieve the content in the variable.
> > So I am trying to do this
>
> > locationListener = new MyLocationListener();
>
> >        lm.requestLocationUpdates(
> >            LocationManager.GPS_PROVIDER,0,0,locationListener);
> >        if(!information.equals(null)){
> >                Bundle bundle = new Bundle();
> >                bundle.putString("hello", information);
> >                Intent intent = new Intent(LocationActivity.this,
> > MainActivity.class);
> >                intent.putExtras(bundle);
> >                startActivity(intent);
> >        }
>
> > and in the locationlistener class
>
> > public void onLocationChanged(Location loc) {
> >            if (loc != null) {
> >                double lat=loc.getLatitude();
> >                double lon=loc.getLongitude();
> >                information = " "+lat +lon;
> >                Toast.makeText(getBaseContext(),
> >                "Location Changed:"+information,
> >                Toast.LENGTH_LONG).show();
> >            }
> >            else
> >                information="bad luck";
> >        }
>
> > The mainactivity then displays that...but its not happening...could
> > some one please help me how to get the values of this.
>
> > Thanks...Raqeeb
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: GetLocation of the phone

2010-04-18 Thread raqz
yes.. its getting the locations all right..but i am unable to save the
location somwhere so that i can use it later. thats the whole
issue

I just thought of something...
if I start a service that does the onLocationChanged stuffit would
get the gps locations and store it (somewhere in the system)
and later if i just start an acitivity that would do
getLastKnowLocation() , shouldn't that fetch the location for further
use.
Come some one advise please



On Apr 19, 12:22 am, Anurag Singh  wrote:
> Have you set uses permission in manifiest file.
>
>  android:name="android.permission.ACCESS_FINE_LOCATION" />
>
> - Anurag Singh
>
> Hi,
>
>
>
>
>
> > I am trying to retrieve the GPS location of the phone. I believe I
> > cannot create an object of the class which stores the location in a
> > variable. So that once the class gets instantiated I use a get method
> > and retrieve the content in the variable.
> > So I am trying to do this
>
> > locationListener = new MyLocationListener();
>
> >        lm.requestLocationUpdates(
> >            LocationManager.GPS_PROVIDER,0,0,locationListener);
> >        if(!information.equals(null)){
> >                Bundle bundle = new Bundle();
> >                bundle.putString("hello", information);
> >                Intent intent = new Intent(LocationActivity.this,
> > MainActivity.class);
> >                intent.putExtras(bundle);
> >                startActivity(intent);
> >        }
>
> > and in the locationlistener class
>
> > public void onLocationChanged(Location loc) {
> >            if (loc != null) {
> >                double lat=loc.getLatitude();
> >                double lon=loc.getLongitude();
> >                information = " "+lat +lon;
> >                Toast.makeText(getBaseContext(),
> >                "Location Changed:"+information,
> >                Toast.LENGTH_LONG).show();
> >            }
> >            else
> >                information="bad luck";
> >        }
>
> > The mainactivity then displays that...but its not happening...could
> > some one please help me how to get the values of this.
>
> > Thanks...Raqeeb
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] GetLocation of the phone

2010-04-18 Thread Anurag Singh
Have you set uses permission in manifiest file.



- Anurag Singh

Hi,
>
> I am trying to retrieve the GPS location of the phone. I believe I
> cannot create an object of the class which stores the location in a
> variable. So that once the class gets instantiated I use a get method
> and retrieve the content in the variable.
> So I am trying to do this
>
> locationListener = new MyLocationListener();
>
>lm.requestLocationUpdates(
>LocationManager.GPS_PROVIDER,0,0,locationListener);
>if(!information.equals(null)){
>Bundle bundle = new Bundle();
>bundle.putString("hello", information);
>Intent intent = new Intent(LocationActivity.this,
> MainActivity.class);
>intent.putExtras(bundle);
>startActivity(intent);
>}
>
>
> and in the locationlistener class
>
>
> public void onLocationChanged(Location loc) {
>if (loc != null) {
>double lat=loc.getLatitude();
>double lon=loc.getLongitude();
>information = " "+lat +lon;
>Toast.makeText(getBaseContext(),
>"Location Changed:"+information,
>Toast.LENGTH_LONG).show();
>}
>else
>information="bad luck";
>}
>
> The mainactivity then displays that...but its not happening...could
> some one please help me how to get the values of this.
>
> Thanks...Raqeeb
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: Need Help on Quick Search

2010-04-18 Thread Amit A
Any help on this?..

Thanks,
Amit

On Tue, Apr 13, 2010 at 12:04 PM, Amit A  wrote:

> Hi,
>
> I wanted to have one more Search with different search UI on the Home
> Screen(addition to Quick search box) which can search through restricted
> applications and provide user additonal functionalities.
>
> Does this require one more Search Service in the framework layer or this
> can be done within the existing Search manager itself? - As i see the UI and
> logic are tightly coupled.
>
> Does this Pass the compatibilty test?.
>
> Any help on this is apprecitated.
>
> Thanks,
> Amit
>
>

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

[android-developers] Opengl

2010-04-18 Thread risha
Let me know how to set up a background image in opengl

-- 
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] VIBRATE permission not showing on device or emulator

2010-04-18 Thread jk-bk-vk
Hi,

Been wrestling with uses-permission in AndroidManifest.xml for about
1/2 a day, so I may be blinded by my frustration

I've been cleaning up my app (removing debug code, experimental stuff
to blackbox things I didn't understand, etc.).  As part of this, I
removed some uses-permission elements from my manifest. After doing
so, I rebuilt, installed on emulator and a mytouch 3G, ran settings,
application manager, and checked the permission list. After chasing my
tail for about 5 hours (rant), I stumbled across issue 4101:

 
http://code.google.com/p/android/issues/detail?id=4101&can=1&q=uses-permission&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

That explained part of my problem (I was getting permission in the
installed application that were not set in my AndroidManifest.xml).
But after figuring that out, I'm still missing
android.permission.VIBRATE. The app runs and does use the vibrator on
the  mytouch. I checked my package using "aapt dump xmltree...", and
it is set in the apk version of the manifest.  I grep'ed the package
code mentioned in 4101 and didn't find vibrate anywhere.

Does anybody have any ideas why it isn't showing up in "settings-
>applications->Manage applications"

-- 
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] GetLocation of the phone

2010-04-18 Thread raqz
Hi,

I am trying to retrieve the GPS location of the phone. I believe I
cannot create an object of the class which stores the location in a
variable. So that once the class gets instantiated I use a get method
and retrieve the content in the variable.
So I am trying to do this

locationListener = new MyLocationListener();

lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,0,0,locationListener);
if(!information.equals(null)){
Bundle bundle = new Bundle();
bundle.putString("hello", information);
Intent intent = new Intent(LocationActivity.this,
MainActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}


and in the locationlistener class


public void onLocationChanged(Location loc) {
if (loc != null) {
double lat=loc.getLatitude();
double lon=loc.getLongitude();
information = " "+lat +lon;
Toast.makeText(getBaseContext(),
"Location Changed:"+information,
Toast.LENGTH_LONG).show();
}
else
information="bad luck";
}

The mainactivity then displays that...but its not happening...could
some one please help me how to get the values of this.

Thanks...Raqeeb

-- 
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: requestLocationUpdates issue

2010-04-18 Thread Tejas
Hi Bob,

Thanks a lot for this. This helped me to understand a lot of things.
I found out a good way for starting/stopping a service here:
http://www.brighthub.com/mobile/google-android/articles/34861.aspx

What do you think of this one ?
Cheers,
Tejas

On Apr 18, 7:03 pm, Bob Kerns  wrote:
> OK, I understand your thinking a bit better, so hopefully I can
> explain a bit better.
>
> onDestroy() is only called when your application is idle. The system
> will NEVER directly call a lifecycle method except when the main
> thread is idle If you are running some long-lived function from, say,
> onStart(), or a handler in the main thread.  All of these are handled
> one at a time by the main thread's Looper.
>
> So there will be no abrupt termination of your function when
> onDestroy() is called. That only happens if it kills off the process.
> Which is a lot more likely to happen if you block the main thread --
> after a while, the user will get a dialog offering to kill or wait for
> the busy process!
>
> Java used to support interrupting and abruptly terminating threads.
> However, there is absolutely NO way to make this a safe operation.
> Android does kill off processes, which can leave things outside the
> process in an inconsistent state, but that's not as bad as having your
> application still running, but in an inconsistent state internally! So
> abruptly force-quitting a method is not part of the model of any Java
> system. (But you can still check, and throw an exception to get out of
> a loop -- that will properly invoke all finally() clauses on the way
> out, etc.).
>
> It's hard for me to tell you the "proper" way to stop your service,
> because it depends on just what you're doing. You have part of the
> idea, by checking for a termination flag in your loop. You can set
> that in your onDestroy() method -- akin to what you're trying to do
> with your call to the undocumented Looper.quit() method.  But what you
> want to do is to set your CARuntimes.MainServiceRunFlag  instead.
> (Except I'd make that an instance member of your Service class, rather
> than a static of some other class. Better modularity, though you can
> make it work this way).
>
> It looks to me like what you're really trying to do, is what the
> system already provides for you better -- IntentService. I really
> don't know what their intent was, calling it this -- I think I'd call
> it ThreadedService, since the relevant point is that it runs your code
> in a separate thread. Or maybe HandlerThreadService, since it uses a
> handler to serialize the requests for work. You still have to be
> careful about things that queue up things to the current thread's
> looper -- like Toast, for example. Any deferred processing you want to
> queue up to a handler you set up in the IntentService's onCreate
> method (i.e. on the main thread).
>
> Anyway, the purpose of HandlerThread's and Handler's is not clean
> shutdown, but rather the queuing of messages via a Looper and
> associated MessageQueue.  If you're only handling one message, ever,
> then creating your own thread would make sense. An AsyncTask would be
> a good choice if you're only running for a short time (but too long
> for the main thread). But if this is something that runs for an
> extended period of time, it would potentially block other uses of
> AsyncTask, so your own thread is a better choice.
>
> So anyway, to summarize -- Handler's, HandlerThread's, and
> IntentService give you a way to do one thing at a time in another
> thread. AsyncTasks give you a way to do a small number of small things
> in parallel (in some versions of the system, one thing at a time).
> Long-lived things need their own threads -- HandlerThread and
> IntentService can provide this. You stop a thread by testing for some
> condition in the loop in the thread. If the thread needs to wait, use
> wait(), and use notifyAll() to wake it up after you set the flag. Be
> sure to use the synchronized keyword to coordinate in this case! And
> if you loop within a handler, you're basically occupying that thread
> while you're looping. So be careful not to queue up any additional
> work to that thread's looper. (And often it needs to go to the main
> thread anyway -- for example, all GUI operations need to be run
> there).
>
> Sorry I can't make all that simple! Threading is never really simple.
> But there are simple patterns, and if you carefully stay within those
> simple patterns, you can avoid most of the complexity.
>
> Finally, about getApplicationContext() -- unfortunately, in the
> released versions of the documentation, there are some bad examples
> around this. I understand they've been fixed for the next release of
> the SDK. But if you're in an Activity or a Service, you just supply
> that activity or service, via the "this" pseudo-variable. However, in
> your case, your use isn't directly in the service, but in your nested
> ServiceHandler class, so "this" will refer to that instance instead.
> But 

[android-developers] Re: Can i get this layout with List view??

2010-04-18 Thread SheikhAman
Ohk,
Things went fine, and i was able to design a new layout like this-

http://schemas.android.com/apk/res/android";
>















Things stay fine until i assign the adapter to the list i have
created-

public class MainActivity extends Activity {
/** Called when the activity is first created. */
String[] data={"1","2","3"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView tweetList = (ListView) findViewById(R.id.tweetList);
tweetList.setAdapter(new
ArrayAdapter(this,R.id.tweetList,data));
}
}

as soon as i add the last line, problems start.

whats wrong?



On Apr 19, 6:24 am, SheikhAman  wrote:
> ohh, all of the tags didnt have '>' with them.
> I have already added them but they weren't copied dont know why, so
> thats not a problem.
>
> On Apr 19, 6:12 am, SheikhAman  wrote:
>
>
>
> > Oops!
> > Sorry..
> > here is the correct one-
>
> > 
> > http://schemas.android.com/apk/res/
> > android"
> >     android:orientation="vertical"
> >     android:layout_width="fill_parent"
> >     android:layout_height="fill_parent"
> >     >
> >  > android:id="@+id/widget28"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:layout_x="17px"
> > android:layout_y="10px"
>
> >  > android:id="@+id/widget40"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Button"
> > android:layout_alignTop="@+id/widget39"
> > android:layout_toRightOf="@+id/widget38"
>
> > 
> >  > android:id="@+id/widget39"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="TextView"
> > android:layout_alignParentBottom="true"
> > android:layout_alignParentLeft="true"
> > 
>
> >  > android:id="@+id/widget38"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Button"
> > android:layout_alignParentTop="true"
> > android:layout_alignParentRight="true"
> > 
>
> > 
> >  >         android:id="@+id/tweetList"
> >         android:layout_width="wrap_content"
> >         android:layout_height="wrap_content"
> >     />
> > 
>
> > Please tell.
>
> > On Apr 18, 11:11 pm, Anurag Singh  wrote:
>
> > > I think, it's not right way.
>
> > >  > > android:id="@+id/widget39"
> > > android:layout_width="wrap_
> > > content"
> > > android:layout_height="wrap_content"
> > > android:text="TextView"
> > > android:layout_alignParentBottom="true"
> > > android:layout_alignParentLeft="true"
>
> > >  > > android:id="@+id/widget38"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:text="Button"
> > > android:layout_alignParentTop="true"
> > > android:layout_alignParentRight="true"
>
> > > 
> > > 
> > >  You have mention Button in a TextView.
>
> > > - Anurag Singh
>
> > > Hi. please find the link to attached file, i need to have this kinda
>
> > > > layout.
> > > > is it possible??
> > > > well perhaps it is, but im not getting it how to do it.
> > > > i want to specify the whole layout in the xml, but it gives runtime
> > > > error
>
> > > > here's the link to the blue print of desired layout:
>
> > > >http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88...
>
> > > > here's my main.xml-
>
> > > > 
> > > > http://schemas.android.com/apk/res/
> > > > android"
> > > >    android:orientation="vertical"
> > > >    android:layout_width="fill_parent"
> > > >    android:layout_height="fill_parent"
>
> > > >  > > > android:id="@+id/widget28"
> > > > android:layout_width="wrap_content"
> > > > android:layout_height="wrap_content"
> > > > android:layout_x="17px"
> > > > android:layout_y="10px"
>
> > > >  > > > android:id="@+id/widget40"
> > > > android:layout_width="wrap_content"
> > > > android:layout_height="wrap_content"
> > > > android:text="Button"
> > > > android:layout_alignTop="@+id/widget39"
> > > > android:layout_toRightOf="@+id/widget38"
>
> > > > 
> > > >  > > > android:id="@+id/widget39"
> > > > android:layout_width="wrap_content"
> > > > android:layout_height="wrap_content"
> > > > android:text="TextView"
> > > > android:layout_alignParentBottom="true"
> > > > android:layout_alignParentLeft="true"
>
> > > >  > > > android:id="@+id/widget38"
> > > > android:layout_width="wrap_content"
> > > > android:layout_height="wrap_content"
> > > > android:text="Button"
> > > > android:layout_alignParentTop="true"
> > > > android:layout_alignParentRight="true"
>
> > > > 
> > > > 
> > > > 
> > > >  > > >        android:id="@+id/tweetList"
> > > >        android:layout_width="wrap_content"
> > > >        android:layout_height="wrap_content"
> > > >    />
> > > > 
>
> > > > is anything wrong??
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > >

[android-developers] Android Appending Values Received From Server

2010-04-18 Thread raqz
Hi,

I am trying to receive some data from a servlet on to android. It
works fine for the first run but if in case I happen to use the same
activity again, the previous data is  getting appended to the new
data.
Could some one please tell me what is wrong. Why dont the variables
get re initialized in the activity on the second usage of the same

Thanks,
Raqeeb

-- 
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 wifi account and password in code?

2010-04-18 Thread Levi
How to get wifi account and password in code?
Please tell me if you 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

Re: [android-developers] Re: A problem about -rpath-link

2010-04-18 Thread kerl.d.w
Thanks a lot.
I think this problem maybe could not be solved. I just use relative path to
do the link.

2010/4/16 andrej sarkic 

> You should read this first:
>
> http://developer.android.com/sdk/ndk/index.html
>
> On Apr 15, 9:45 pm, Ke Wu  wrote:
> > Hi all,
> > I got a new clue, in the rpath-link option, could be several paths, and
> use
> > colon to separate these paths.
> > So, if I want to use windows driver path, I must find out a way to
> transfer
> > colon, But HOW COULD I ??
> >
> > Any suggestion would be greatly appreciated! Thanks in advance
> > GOD SAVE ME! T_T
> >
> > 2010/4/15 KerlW 
> >
> >
> >
> > > I am learning Anroid development, trying to write native C program.
> > > I am using code sourcery g++ lite to compile and link my program, When
> > > I tried to link my program dynamically, I met a problem.
> >
> > > I've pulled /system/lib from android emulator to my PC c:\androidlib
> > > when link , I need to pass this path to -L and -rpath-link option.
> > > -L "c:\androidlib" works.
> > > but
> > > -rpath-link "c:\androidlib" didn't work!!
> >
> > > I've tried in many forms such as:
> > > -rpath-link "c:/androidlib"
> > > -rpath-link "\c\androidlib"
> > > -rpath-link \driver\c\androidlib"
> > > None of above makes the linker know the correct path. How could I
> > > solve this problem??
> >
> > > Any suggestion would be greatly appreciated(aside using -static to
> > > avoid dynamic link).
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: Audio Mixing

2010-04-18 Thread ani
I found the solution to my problem: Service.startForeground. This call
makes sure my background service will keeps its priority when its
running in the background.
The SDK has a nice example that works across all API levels:
http://developer.android.com/intl/de/resources/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.html

 Jesper Hansen

-- 
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] spinner question: how to detect the selection of an already selected item?

2010-04-18 Thread greg
I have an activity with a ListView check list and a spinner that
controls the sort order of the items in that check list.  One of the
sort options is to move the checked items to the beginning of the
list.  I would like to allow users to check some items in the list,
select the 'sort by checks' option, check some more items in the list,
and select the 'sort by checks' option again.  However, I don't see
how to detect that second selection of the spinner's 'sort by checks'
option.

I've tried using setOnItemSelectedListener, but it doesn't call the
onItemSelected handler unless a different item is selected.  And I've
tried using setOnItemClickListener, but it seems that listener cannot
be used with a spinner according to following run-time exception from
logcat:

- - -
D/AndroidRuntime(  987): Shutting down VM
W/dalvikvm(  987): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime(  987): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  987): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.test.spinner/com.test.spinner.check_list}:
java.lang.RuntimeException: setOnItemClickListener cannot be used with
a spinner.
E/AndroidRuntime(  987):at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2268)
- - -

Any tips on how to detect the selection of an already selected item in
a spinner?

Thanks,
Greg

-- 
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 get this layout with List view??

2010-04-18 Thread SheikhAman
ohh, all of the tags didnt have '>' with them.
I have already added them but they weren't copied dont know why, so
thats not a problem.

On Apr 19, 6:12 am, SheikhAman  wrote:
> Oops!
> Sorry..
> here is the correct one-
>
> 
> http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>  android:id="@+id/widget28"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_x="17px"
> android:layout_y="10px"
>
>  android:id="@+id/widget40"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="Button"
> android:layout_alignTop="@+id/widget39"
> android:layout_toRightOf="@+id/widget38"
>
> 
>  android:id="@+id/widget39"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="TextView"
> android:layout_alignParentBottom="true"
> android:layout_alignParentLeft="true"
> 
>
>  android:id="@+id/widget38"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="Button"
> android:layout_alignParentTop="true"
> android:layout_alignParentRight="true"
> 
>
> 
>          android:id="@+id/tweetList"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>     />
> 
>
> Please tell.
>
> On Apr 18, 11:11 pm, Anurag Singh  wrote:
>
>
>
> > I think, it's not right way.
>
> >  > android:id="@+id/widget39"
> > android:layout_width="wrap_
> > content"
> > android:layout_height="wrap_content"
> > android:text="TextView"
> > android:layout_alignParentBottom="true"
> > android:layout_alignParentLeft="true"
>
> >  > android:id="@+id/widget38"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Button"
> > android:layout_alignParentTop="true"
> > android:layout_alignParentRight="true"
>
> > 
> > 
> >  You have mention Button in a TextView.
>
> > - Anurag Singh
>
> > Hi. please find the link to attached file, i need to have this kinda
>
> > > layout.
> > > is it possible??
> > > well perhaps it is, but im not getting it how to do it.
> > > i want to specify the whole layout in the xml, but it gives runtime
> > > error
>
> > > here's the link to the blue print of desired layout:
>
> > >http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88...
>
> > > here's my main.xml-
>
> > > 
> > > http://schemas.android.com/apk/res/
> > > android"
> > >    android:orientation="vertical"
> > >    android:layout_width="fill_parent"
> > >    android:layout_height="fill_parent"
>
> > >  > > android:id="@+id/widget28"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:layout_x="17px"
> > > android:layout_y="10px"
>
> > >  > > android:id="@+id/widget40"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:text="Button"
> > > android:layout_alignTop="@+id/widget39"
> > > android:layout_toRightOf="@+id/widget38"
>
> > > 
> > >  > > android:id="@+id/widget39"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:text="TextView"
> > > android:layout_alignParentBottom="true"
> > > android:layout_alignParentLeft="true"
>
> > >  > > android:id="@+id/widget38"
> > > android:layout_width="wrap_content"
> > > android:layout_height="wrap_content"
> > > android:text="Button"
> > > android:layout_alignParentTop="true"
> > > android:layout_alignParentRight="true"
>
> > > 
> > > 
> > > 
> > >  > >        android:id="@+id/tweetList"
> > >        android:layout_width="wrap_content"
> > >        android:layout_height="wrap_content"
> > >    />
> > > 
>
> > > is anything wrong??
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this me

[android-developers] Re: Can i get this layout with List view??

2010-04-18 Thread SheikhAman
Oops!
Sorry..
here is the correct one-


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











Please tell.





On Apr 18, 11:11 pm, Anurag Singh  wrote:
> I think, it's not right way.
>
>  android:id="@+id/widget39"
> android:layout_width="wrap_
> content"
> android:layout_height="wrap_content"
> android:text="TextView"
> android:layout_alignParentBottom="true"
> android:layout_alignParentLeft="true"
>
>  android:id="@+id/widget38"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="Button"
> android:layout_alignParentTop="true"
> android:layout_alignParentRight="true"
>
> 
> 
>  You have mention Button in a TextView.
>
> - Anurag Singh
>
> Hi. please find the link to attached file, i need to have this kinda
>
>
>
> > layout.
> > is it possible??
> > well perhaps it is, but im not getting it how to do it.
> > i want to specify the whole layout in the xml, but it gives runtime
> > error
>
> > here's the link to the blue print of desired layout:
>
> >http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88...
>
> > here's my main.xml-
>
> > 
> > http://schemas.android.com/apk/res/
> > android"
> >    android:orientation="vertical"
> >    android:layout_width="fill_parent"
> >    android:layout_height="fill_parent"
>
> >  > android:id="@+id/widget28"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:layout_x="17px"
> > android:layout_y="10px"
>
> >  > android:id="@+id/widget40"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Button"
> > android:layout_alignTop="@+id/widget39"
> > android:layout_toRightOf="@+id/widget38"
>
> > 
> >  > android:id="@+id/widget39"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="TextView"
> > android:layout_alignParentBottom="true"
> > android:layout_alignParentLeft="true"
>
> >  > android:id="@+id/widget38"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> > android:text="Button"
> > android:layout_alignParentTop="true"
> > android:layout_alignParentRight="true"
>
> > 
> > 
> > 
> >  >        android:id="@+id/tweetList"
> >        android:layout_width="wrap_content"
> >        android:layout_height="wrap_content"
> >    />
> > 
>
> > is anything wrong??
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Clear defaults programmatically

2010-04-18 Thread Bonifaz
This clears the preferences, but not the default flag set by a user
when a Intent Chooser is shown to him/her.
Am I right?

How can I get back the Intent Chooser Dialog when a user previously
set my app as default. I know you can go to Manage Applications and
click "clear defaults" but how do I do this in code?

On Apr 18, 3:01 pm, Menion  wrote:
> I'm using this code ... hope it helps
>
> PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commi 
> t();
>
> On Apr 16, 11:09 am,Bonifaz wrote:
>
>
>
>
>
> > Does anyone know
> > how to clear defaults of my own app by code.
>
> > I know that a user can always go to Manage Applications, find my app
> > and click the button there to clear previously assigned default
> > actions. But for most users this isn't intuitive at all.
>
> > I would like to offer my customers a solution to clear defaults within
> > my own app if they don't like to use my app as a replacement for a
> > specific action anymore.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: onSharedPreferenceChanged() Not Called in Live Wallpaper (WallpaperService) Engine

2010-04-18 Thread shaun
Operator head spacing

I just looked at AndroidManifest.xml again and I noticed I
accidentally left the configuration for the service to run in a new
process each time instantiated (via android:process=":myprocessname".
I was experimenting with this at one point during another debugging
session.  If it starts with a colon, a new process is given each time
and that would explain why I was getting different SharedPreferences
instances...they were different PIDs, which I did not notice at first
either.

The SharedPreferences API docs state "Note: currently this class does
not support use across multiple processes. This will be added later."

So, I just removed the android:process configuration from
AndroidManifest.xml and things are working as expected.

On Apr 16, 3:39 pm, shaun  wrote:
> Well, I tested one of the sample applications (http://code.google.com/
> p/androgames-sample/) and both the Engine's and Settings'
> onSharedPreferenceChanged() methods are called and with the same
> instance ofSharedPreferencesobject.  So, apparently something is
> different in myLiveWallpaper.
>
> I went through everything top to bottom and made some small (I'd say
> very minor) tweaks to my code/config to further match the example and
> still the same results - the Engine's onSharedPreferenceChanged()
> method is not called while the Settings' is.
>
> I also noticed thatSharedPreferencesinstance returned in the Engine
> constructor (via prefs =
> LiveWallpaperService.this.getSharedPreferences(PREFS_NAME,
> 0)) is a different object instance than that passed in to
> onSharedPreferenceChanged() of the Settings class.  Nowhere do I
> create a new instance ofSharedPreferencesnor do I have any other
> code related to shared preferences outside of what is being discussed
> here.  So, Android is serving up 2 separate instances ofSharedPreferencesfor 
> some reason Why?
>
> I am boggled.  Please help me think.
>
> On Apr 16, 11:45 am, shaun  wrote:
>
>
>
>
>
> > I am experiencing something strange with aLiveWallpaper.  I very
> > closely followed several examples out there onLiveWallpapers in
> > regards to shared preference settings (e.g. Android sample app Cube
> >LiveWallpaper).
>
> > The Engine implements
> >SharedPreferences.OnSharedPreferenceChangeListener and the pertienent
> > code in Engine looks like this:
>
> > public static final String PREFS_NAME = "some-name";
>
> > Engine() {
> >     prefs = LiveWallpaperService.this.getSharedPreferences(PREFS_NAME,
> > 0);
> >     prefs.registerOnSharedPreferenceChangeListener(this);
>
> > }
>
> > public void onSharedPreferenceChanged(SharedPreferences
> >sharedPreferences, String key) {
> >           Log.e(getClass().getSimpleName(), "on shared preference
> > changed");
>
> > }
>
> > NOTE: I never unregister the Engine instance as a shared prefs
> > listener.  Although, I did move some things around to onCreate and
> > onDestroy (added the unregister there) and had no impact as far as I
> > could tell.
>
> > The Settings class extends PreferenceActivity and implements
> >SharedPreferences.OnSharedPreferenceChangeListener as well.  And since
> > that class has little code here is the body:
>
> >     @Override
> >      protected void onCreate(Bundle icicle) {
> >          super.onCreate(icicle);
>
> > getPreferenceManager().setSharedPreferencesName(Engine.PREFS_NAME);
> >          addPreferencesFromResource(R.xml.settings);
>
> > getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceCha 
> > ­ngeListener(this);
> >      }
>
> >     �...@override
> >      protected void onDestroy() {
>
> > getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceC 
> > ­hangeListener(this);
> >          super.onDestroy();
> >      }
>
> >      public void onSharedPreferenceChanged(SharedPreferences
> >sharedPreferences, String key) {
> >           Log.e(getClass().getSimpleName(), "on shared preference
> > changed");
> >      }
>
> > The only thing coming out in the log is from the Settings class for on
> > shared pref change.  Anyone have any idea why?
>
> > In the implementations I've found forLiveWallpapershared prefs
> > settings, the Engine constructor either uses the shared preferences or
> > calls to onSharedPreferenceChanged() directly.  It seems like those
> > other examples may be experiencing the same thing I described above,
> > and they worked around it!?!?
>
> > I do admit I have not taken the example code from others and tried it
> > out to see if the Engine onSharedPreferenceChanged() gets called.  I
> > will do that tonight or this weekend.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --

[android-developers] Re: app that 'animates' drawing

2010-04-18 Thread Rob Y.
> I guess the only mechanism that would work is to maintain a bitmap of
> the whole Surface and draw *that* incrementally.  Then on each 'delay'
> request, lock the Surface and copy the entire bitmap in to draw the
> next 'frame'.  Ouch.

Tried this, and it seems to work.  Still eager for suggestions if this
seems as awkward to you as it does to me.

Thanks,
Rob

-- 
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: requestLocationUpdates issue

2010-04-18 Thread Bob Kerns
OK, I understand your thinking a bit better, so hopefully I can
explain a bit better.

onDestroy() is only called when your application is idle. The system
will NEVER directly call a lifecycle method except when the main
thread is idle If you are running some long-lived function from, say,
onStart(), or a handler in the main thread.  All of these are handled
one at a time by the main thread's Looper.

So there will be no abrupt termination of your function when
onDestroy() is called. That only happens if it kills off the process.
Which is a lot more likely to happen if you block the main thread --
after a while, the user will get a dialog offering to kill or wait for
the busy process!

Java used to support interrupting and abruptly terminating threads.
However, there is absolutely NO way to make this a safe operation.
Android does kill off processes, which can leave things outside the
process in an inconsistent state, but that's not as bad as having your
application still running, but in an inconsistent state internally! So
abruptly force-quitting a method is not part of the model of any Java
system. (But you can still check, and throw an exception to get out of
a loop -- that will properly invoke all finally() clauses on the way
out, etc.).

It's hard for me to tell you the "proper" way to stop your service,
because it depends on just what you're doing. You have part of the
idea, by checking for a termination flag in your loop. You can set
that in your onDestroy() method -- akin to what you're trying to do
with your call to the undocumented Looper.quit() method.  But what you
want to do is to set your CARuntimes.MainServiceRunFlag  instead.
(Except I'd make that an instance member of your Service class, rather
than a static of some other class. Better modularity, though you can
make it work this way).

It looks to me like what you're really trying to do, is what the
system already provides for you better -- IntentService. I really
don't know what their intent was, calling it this -- I think I'd call
it ThreadedService, since the relevant point is that it runs your code
in a separate thread. Or maybe HandlerThreadService, since it uses a
handler to serialize the requests for work. You still have to be
careful about things that queue up things to the current thread's
looper -- like Toast, for example. Any deferred processing you want to
queue up to a handler you set up in the IntentService's onCreate
method (i.e. on the main thread).

Anyway, the purpose of HandlerThread's and Handler's is not clean
shutdown, but rather the queuing of messages via a Looper and
associated MessageQueue.  If you're only handling one message, ever,
then creating your own thread would make sense. An AsyncTask would be
a good choice if you're only running for a short time (but too long
for the main thread). But if this is something that runs for an
extended period of time, it would potentially block other uses of
AsyncTask, so your own thread is a better choice.

So anyway, to summarize -- Handler's, HandlerThread's, and
IntentService give you a way to do one thing at a time in another
thread. AsyncTasks give you a way to do a small number of small things
in parallel (in some versions of the system, one thing at a time).
Long-lived things need their own threads -- HandlerThread and
IntentService can provide this. You stop a thread by testing for some
condition in the loop in the thread. If the thread needs to wait, use
wait(), and use notifyAll() to wake it up after you set the flag. Be
sure to use the synchronized keyword to coordinate in this case! And
if you loop within a handler, you're basically occupying that thread
while you're looping. So be careful not to queue up any additional
work to that thread's looper. (And often it needs to go to the main
thread anyway -- for example, all GUI operations need to be run
there).

Sorry I can't make all that simple! Threading is never really simple.
But there are simple patterns, and if you carefully stay within those
simple patterns, you can avoid most of the complexity.

Finally, about getApplicationContext() -- unfortunately, in the
released versions of the documentation, there are some bad examples
around this. I understand they've been fixed for the next release of
the SDK. But if you're in an Activity or a Service, you just supply
that activity or service, via the "this" pseudo-variable. However, in
your case, your use isn't directly in the service, but in your nested
ServiceHandler class, so "this" will refer to that instance instead.
But you can still refer to the outer instance's this, by writing
"ManagerService.this". You could also arrange to pass the context in
ass a parameter when you create your ManagerService -- but since the
system already does that work for you with a nested class, there's no
reason. Just replace getApplicationContext() with ManagerService.this,
and you're set.

.
On Apr 18, 11:08 am, Tejas  wrote:
> > If you're going to do that, why involve a handler

Re: [android-developers] Re: Selling outside the Android Market--> Use Google Checkout to sell direct from website??? SlideMe.Org??

2010-04-18 Thread Shane Isbell
Cool, at least something is coming out of SlideME.

George,

I have a general policy of not attacking people personally, but in this
case, I'll make an exception because I think it is warranted. You are a
dishonest individual. You came on this list and publicly accused me of being
the reason developers did not get paid. And yet, it took 5 months after I
left SlideME for you to resolve and pay a simple invoice. Yet you gave a
completely (dishonest) impression on this list that it was my fault. You
also blamed your recently botched rollout of SAM on me (4 months after I
left). In addition, you were dishonest in regards to your replies to Martin
on this list.

SlideME needs to take responsibility for its actions. Stop pointing fingers
to others. Stop spinning things. Just cleanup the payout mess. Developers
are saying it's not working for them and is likely the cause of all these
angry posts from developers. Deleting these posts from SlideME forums raises
a lot of eyebrows and was no small factor in why I brought these issues
forward.

And for god's sake, stop blaming me for all SlideME's problems. I left 5
months ago.

Shane

On Sun, Apr 18, 2010 at 2:47 PM, Koxx  wrote:

> Hi,
>
> after a long talk with George and some 'lost' emails, I finally
> managed to be paid few days ago (April 8).
> The main problem was with invoice.
> It is very difficult to know what is needed by SlideMe to get your
> payout.
> You need to request payout balance (we should receive a summary each
> month ? I never received them), then edit yourself the invoice with
> all sales keys (!!!), print it, sign it, scan it, and sent it !!!
> ouch !
> I had to request their help for this (thanks George for your help on
> this).
> The fact is here : it's difficult and not clear.
>
> I'll may give a shot to AndAppStore.
>
> ciao,
> Francois @ Koxx
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Compiling FFMpeg as NDK Shared library

2010-04-18 Thread sfomra
Has any one successfully compiled ffmpeg for use as a shared library??

I tried  the doing what 
http://oo-androidnews.blogspot.com/2010/02/ffmpeg-and-androidmk.html
says but i keep getting
the following message on compile

Android NDK: Building for application 'ffmpeg-org'
make: *** No rule to make target `ffmpeg-org', needed by `ndk-app-
ffmpeg-org'.  Stop.

Has any one encountered this???

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


[android-developers] Transfer List of specific objects across intents

2010-04-18 Thread raqz
Hi,

I wish to send a list of type  from one activity to another.
I dont find a bundle.put.. for such an requirement in the api's.
Is there a way somebody could suggest through which I could transfer
different kinds of data.
Thanks,
Raqeeb

-- 
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: Selling outside the Android Market--> Use Google Checkout to sell direct from website??? SlideMe.Org??

2010-04-18 Thread Koxx
Hi,

after a long talk with George and some 'lost' emails, I finally
managed to be paid few days ago (April 8).
The main problem was with invoice.
It is very difficult to know what is needed by SlideMe to get your
payout.
You need to request payout balance (we should receive a summary each
month ? I never received them), then edit yourself the invoice with
all sales keys (!!!), print it, sign it, scan it, and sent it !!!
ouch !
I had to request their help for this (thanks George for your help on
this).
The fact is here : it's difficult and not clear.

I'll may give a shot to AndAppStore.

ciao,
Francois @ Koxx

-- 
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: app that 'animates' drawing

2010-04-18 Thread Rob Y.
Poking around here some more, it seems like the problem is the way
SurfaceView double-buffers output.  You kind of have to draw the
entire surface every time.  I had tried unlocking and relocking on
every 'delay' call, but that didn't work either, presumably because
the relock produced an incomplete buffer, and adding more data to that
and posting it didn't draw the whole picture.

I guess the only mechanism that would work is to maintain a bitmap of
the whole Surface and draw *that* incrementally.  Then on each 'delay'
request, lock the Surface and copy the entire bitmap in to draw the
next 'frame'.  Ouch.

Does this sound 'right'?  Or is there a better way?

Thanks,
Rob

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


[android-developers] Re: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Mario Zechner
For fun i extended the example i posted earlier. It now feature cpu
usage output derrived from /proc/stat which should be enough to given
an indication of the slow down occuring due to touch events.

The setup:

- A GLSurfaceView
- An OnTouchListener that does nothing but return true
- A simple renderer thread which is throttled via a Thread.sleep(200)
to 5 frames per second which outputs the frames per second as well as
the cpu usage

Observation on Milestone with 2.0.1:
- load without touching the screen - 4%-12%
- load with touching the screen - 24%-44%

due to the way i measure the cpu usage it of course fluctuates quiet a
bit, the overall tendency can be easily derrived though.

You can find the apk at http://www.file-pasta.com/file/1/touchflood.apk,
the Eclipse project with all the source can be found at
http://www.file-pasta.com/file/0/touchflood.zip.


On 18 Apr., 22:18, Robert Green  wrote:
> The fundamental issue is that there are too many instructions per
> event being executed.  There is no way around it other than optimizing
> the event handling code in KeyInputQueue.  No amount of waiting or
> sleeping will fix that because those events must run through that code
> and that code appears to be very slow.  It surprises me because it's
> truly performance critical code and this issue has been known since
> 1.1/1.5 and it still doesn't appear to be fixed in master.  I'm
> looking at it now and the author(s) didn't even follow Android's best
> optimization practices.  Simple things like declaring virtuals with
> local variables aren't done.
>
> For a moment today I was considering taking the input stack (EventHub,
> KeyInputQueue and InputDevice) and hacking it into my own input stack
> which reads off the event devices much more efficiently but I can't
> find any way to stop the system stack from running and consuming CPU,
> so that hack is out (and probably good because I really didn't want to
> go there - waste of time and probably wouldn't work right anyway).
>
> In my activity:
> public boolean onTouchEvent(MotionEvent e) {
>   return false;
>
> }
>
> And system_server still consumes about 36% of the CPU while moving my
> finger around.  That proves there is nothing a developer can do to
> work around this.  I think I'll take this issue to the platform group
> now and try to file more specific bugs.
>
> On Apr 18, 10:38 am, Ralf Schneider  wrote:
>
> > I have already talked a lot about the touch slow down in this forum.
> > There is another observation I would like to add, may be this can help to
> > track the problem down.
>
> > One of my projects is an Argumented Reality Game.
> > Of course this kind of App eats energy (CPU cycles) like crazy:
>
> > In my app I process:
> > The camare, OpenGL graphics, Pseudo-3D-Sound mixing (8 simultaneous samples
> > + ogg-music), 2 constant sensor imputs (acceleration, magnetic) and
> > additional input from trackball, hardware keys and the touch screen.
>
> > The largest slow down occurs with the touch-events.
>
> > But the next big slow down occurs with the accleration and magnetic events!
> > I gained up to 4 FPS on a N1 by switching from SENSOR_DELAY_FASTEST to
> > SENSOR_DELAY_GAME.
>
> > => So I just wonder: May be the slow down is in no way specific to touch
> > events! Instead the whole input-queue-event handling is just horribly slow.
> > As everyonw has observed: Touching the screen will trigger (flood) lots of
> > events - This is similar as enabling input from other sensors - which can
> > slow down the app in a compareable way, too!
> > The main differences is only: Touching the screen will still trigger more
> > event than using a sesnor in *SENSOR_DELAY_FASTEST*. So the slow down
> > appears as less drastically...
>
> > After working a while with Android, I must say:
> > The design and architecture of the Java-API seems to be nice and well done
> > most of the time.
> > But the execution and implementation of the software stack as a whole seems
> > to be just slow, slow, slow, slow,  All this doesn't matter if you have
> > lots of servers with many cores (ENTERPRISE!) but for an
> > embedded-soft-realtime-device I expect more!
>
> > IMHO the OS on an embedded device with a 1 GHZ CPU should not use more than
> > 1% of the CPU to process around thousand events per seconds - and even this
> > i would consider slow.
> > Anyway, this time I resist to go into a deeper rant.
>
> > Kind Regards,
> > Ralf
>
> > 2010/4/18 Robert Green 
>
> > > I've tried sleep() and have switched to wait(1000), notify() / yield()
> > > as outlined by some other devs.  I have no empirical evidence that one
> > > works any better than the other.  Both consume a range between 25-36%
> > > of the CPU by system_process while touching.  That's a full third of
> > > the CPU of the device just to give me coordinates off the touch
> > > screen.  No one has a good workaround for this it seems and seeing the
> > > problem on the 2.1 emulator makes me think that Google Andr

[android-developers] Re: Do the USB drivers work on XP64?

2010-04-18 Thread DonFrench
Nope, they don't work on XP-64.

On Apr 18, 12:28 pm, ThomasWrobel  wrote:
> I have two machines, one a WindowsXP32, and one 64. Both with AMD64
> chips.
> I have eclipse on both, and the SDK on both.
> I'm using the usb drivers with the HTC Legend (http://
> groups.google.com/group/android-developers/browse_thread/thread/
> 2b54d2ce1202b04b/dd6f9152cd50d64b?lnk=gst&q=usb+#dd6f9152cd50d64b).
>
> On the 32bit one things work just peachy. Device recognised, and
> debugging working fine.
> However, the 64bit one doesn't seem to recognise the device.
> Windows recognise's the device, and windows device manage shows it,
> but "adb devices" lists nothing, and nothing shows up when trying to
> manually launch from eclipse.
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: SlidingDrawer handle

2010-04-18 Thread Chris Eby
It looks like you have to dig a little deeper. The images and the
layout referencing them are in the Launcher package, which is open
source.

http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=res/layout-land/launcher.xml

On Sun, Apr 18, 2010 at 12:04 PM, Pinheiro  wrote:
>  Thanks, Bob!
>
>  Unfortunately, it seems Launcher's handle is not accessible (at least
> it's not in the SDK).
>  Bummer, will have to reinvent the wheel and make my own :-(
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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


[android-developers] app that 'animates' drawing

2010-04-18 Thread Rob Y.
I'm trying to learn about Android programming by rewriting a C app
I've moved from DOS to X-windows to Windows as a learning tool.  It's
just a silly little app that draws symmetrical 'game of life' patterns
on the screen in a kaleidoscopic fashion.  It's structured so that the
patterns do their own animations.  I.e. there's a 'Life' class that
produces the next generation and redraws itself from the center
outward, inserting delays to produce a kaleidoscopic effect.

I've got it so that the patterns draw - I took the LunarLander sample
as a starting point, and an drawing on a SurfaceView.  But my problem
is with timing the 'animations'.  I'm not doing traditional animation,
where I build a whole frame and then draw it, but  the surface seems
to want to draw itself completely on each iteration of my loop, so my
inserted sleep's don't insert delay in the right places.

So my questions:

1. Is there a more direct way to write to the screen than via a
SurfaceView?  If I did that, would the various steps of my 'animation'
occur as I drew them, producing the desired effect.
2. If such a drawing method exists, would I be wasting my time
learning how to use it?
3. What's the 'standard' way to do this kind of animation?

Thanks.

By the way, my main loop (lifted from the LunarLandar example) looks
like:

public void run() {
while (mRun) {
mCanvas = null;
try {
mCanvas = mSurfaceHolder.lockCanvas(null);
synchronized (mSurfaceHolder) {
if (mMode == STATE_RUNNING)
doUpdate();
doDraw();
}
} finally {
if (mCanvas != null) {
mSurfaceHolder.unlockCanvasAndPost(mCanvas);
mCanvas = null;
}
}
}
}


-- 
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] Native Bluetooth programming

2010-04-18 Thread Rafał Grzybowski
I'd like to create native library for Java (using Android NDK) for
Bluetooth. I have read a sample from
http://blog.bruary.net/2009/07/android-bluetooth-hacking-using-ndk.html
but I cannot get hci_get_route working on my HTC Legend. It returns
ENODEV, Bluetooth is enabled and appropriate permissions are in the
application manifest.

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


Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Isaac Wagner
> This discussion list gets a lot of people asking questions where they
> are barking up the wrong tree. It is commonplace to inquire about their
> rationale for barking up that tree and steer them in the direction of
> more common patterns. Sometimes, the barking is indeed up the correct
> tree, but that may not always be obvious from the question.
>
> If you consider that to be harassment, you may wish to choose a
> different means of getting Android developer support.
>
My apologies.  I agree and do appreciate the support I've received
from this list.


> You can try the combination of setRequestedOrientation() in onCreate()
> (and from the menu or wherever the user chooses their preference) and
> android:configChanges="keyboardHidden|orientation" in your manifest. I
> have not used setRequestedOrientation() personally.
>
I'll take a look at that.  Thanks.

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


Re: [android-developers] Re: Performance comparison NDK vs SDK

2010-04-18 Thread Ralf Schneider
Pre-scale the background image to match the device resolution.
Split the background image in texture tiles like 256x256, 128x128, 
Blitt the tiles separately.


2010/4/8 lixin China 

> Hi Schneider:
> As you said avoid scale the texture. Could you tell me the solution
> how to render background texture(480x320 to full screen) without
> scale.
>
> On Apr 7, 5:28 am, Ralf Schneider  wrote:
> > If your performance problem is only related to putting sprites on the
> > screen, don't expect an improvement by witching to the NDK.
> >
> > I don't know how you are currently doint it, but these are some general
> > remarks:
> >
> > Use OpenGL ES to draw the sprites.
> > Limit your textures to 256x256. 512x512 seems to be slower on some
> devices.
> > Use texture atlases for smaller sprites -> To avoid state changes in
> OpenGL
> > Use VBOs
> > Avoid textures with alpha channels on slower devices.
> > Don't scale or rotate your sprites on slower devices. Slower devices
> often
> > have a fast path for simple blitt operations. => Check if "point sprites"
> > are available on the device. If yes, use them.
> > Use 16 Bit (565) textures.
> > Watch the video I have posted in the previous post. The speaker has some
> > valuable tips for performance improvements.
> >
> > Anyway, 100 Sprites is not very much if you are already using OpenGL...
> > So may be you are right and the only solution is to target high end
> devices
> > for your next project.
> >
> > 2010/4/6 MrChaz 
> >
> >
> >
> > > I was hoping that someone had tried a little test app with a simple
> > > scene.  I think I've pretty much reached the limits in terms of get
> > > sprites on the screen at an acceptable frame rate (at least on G1 type
> > > hardware).
> > > It seems, at least for what I'm doing, the limit is about 100 sprites
> > > but for my next project I'd like a bit more.
> > > Maybe I'll just stop making games for 'old' hardware and concentrate
> > > on the Droid and N1.  I can't say I like the idea of ignoring half the
> > > market :(
>
> --
> 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
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
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: Bluetooth pairing request

2010-04-18 Thread Rafał Grzybowski
But when the devices are paired using Settings/Wireless & networks/Wi-
Fi then the notification is skipped and the dialog is shown
immediately. I need the same...

On Apr 14, 11:15 am, VovaN  wrote:
> If you click on notification dialog'll  appear. It's Android behavior.
>
> On Mar 30, 11:02 am, Rafał Grzybowski  wrote:
>
>
>
> > Hello there
>
> > When myBluetoothapplication is about to create SPP connection to the
> > unpaired remote device, pairing notification is displayed.
> > From the documentation I can see that pairing request can display a
> > dialog or sent notification. I'd like to know what logic causes my app
> > to sent notification than display a regular pairing dialog. Maybe I'm
> > blind but the problem is I were not aware of that notification and was
> > fighting with pairing problem for few hours :) And I'd really would
> > prefer my app to trigger dialog display.
>
> > Thank you,
>
> > Best regards
> >     Rafa³ Grzybowski

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


Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Mark Murphy
Isaac Wagner wrote:
> On Sun, Apr 18, 2010 at 3:25 PM, Justin Giles  wrote:
>> Why would you want to allow them to set it in settings when Android handles
>> the rotation automagically?  All you have to do is have a xml file in your
>> "layout" directory, then for landscape have a xml file (with the same name)
>> in your "layout-land" directory.  When in portrait mode Android looks to the
>> "layout" directory.  When the phone is flipped to its side for landscape,
>> Android looks to the "layout-land" directory.
>> Justin
>>
> 
>  why is it that when I ask a simple question I get harassed? 

This discussion list gets a lot of people asking questions where they
are barking up the wrong tree. It is commonplace to inquire about their
rationale for barking up that tree and steer them in the direction of
more common patterns. Sometimes, the barking is indeed up the correct
tree, but that may not always be obvious from the question.

If you consider that to be harassment, you may wish to choose a
different means of getting Android developer support.

> OK, since it appears I can't get a simple answer without a long
> explanation My application is one such that the user moves their
> phone around a lot.  During this movement I want to keep the
> orientation constant -- I DON'T WANT ANDROID TO HANDLE THE ROTATION.
> So, in my manifest I set the orientation to portrait to prevent
> Android from mucking with the orientation.  However, I am now making
> some additions and would like the user to be able to choose portrait
> or landscape mode, but whatever they choose needs to stick.  Again, I
> don't want Android to handle the rotation.  As the phone is moved
> around I want whichever orientation they chose to stick.
> 
> Does that make sense?  Now, how do I do this?  How do I force the
> orientation to my preference?

You can try the combination of setRequestedOrientation() in onCreate()
(and from the menu or wherever the user chooses their preference) and
android:configChanges="keyboardHidden|orientation" in your manifest. I
have not used setRequestedOrientation() personally.

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

Android Training in NYC: 30 April-2 May 2010: http://guruloft.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: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Robert Green
The fundamental issue is that there are too many instructions per
event being executed.  There is no way around it other than optimizing
the event handling code in KeyInputQueue.  No amount of waiting or
sleeping will fix that because those events must run through that code
and that code appears to be very slow.  It surprises me because it's
truly performance critical code and this issue has been known since
1.1/1.5 and it still doesn't appear to be fixed in master.  I'm
looking at it now and the author(s) didn't even follow Android's best
optimization practices.  Simple things like declaring virtuals with
local variables aren't done.

For a moment today I was considering taking the input stack (EventHub,
KeyInputQueue and InputDevice) and hacking it into my own input stack
which reads off the event devices much more efficiently but I can't
find any way to stop the system stack from running and consuming CPU,
so that hack is out (and probably good because I really didn't want to
go there - waste of time and probably wouldn't work right anyway).

In my activity:
public boolean onTouchEvent(MotionEvent e) {
  return false;
}

And system_server still consumes about 36% of the CPU while moving my
finger around.  That proves there is nothing a developer can do to
work around this.  I think I'll take this issue to the platform group
now and try to file more specific bugs.

On Apr 18, 10:38 am, Ralf Schneider  wrote:
> I have already talked a lot about the touch slow down in this forum.
> There is another observation I would like to add, may be this can help to
> track the problem down.
>
> One of my projects is an Argumented Reality Game.
> Of course this kind of App eats energy (CPU cycles) like crazy:
>
> In my app I process:
> The camare, OpenGL graphics, Pseudo-3D-Sound mixing (8 simultaneous samples
> + ogg-music), 2 constant sensor imputs (acceleration, magnetic) and
> additional input from trackball, hardware keys and the touch screen.
>
> The largest slow down occurs with the touch-events.
>
> But the next big slow down occurs with the accleration and magnetic events!
> I gained up to 4 FPS on a N1 by switching from SENSOR_DELAY_FASTEST to
> SENSOR_DELAY_GAME.
>
> => So I just wonder: May be the slow down is in no way specific to touch
> events! Instead the whole input-queue-event handling is just horribly slow.
> As everyonw has observed: Touching the screen will trigger (flood) lots of
> events - This is similar as enabling input from other sensors - which can
> slow down the app in a compareable way, too!
> The main differences is only: Touching the screen will still trigger more
> event than using a sesnor in *SENSOR_DELAY_FASTEST*. So the slow down
> appears as less drastically...
>
> After working a while with Android, I must say:
> The design and architecture of the Java-API seems to be nice and well done
> most of the time.
> But the execution and implementation of the software stack as a whole seems
> to be just slow, slow, slow, slow,  All this doesn't matter if you have
> lots of servers with many cores (ENTERPRISE!) but for an
> embedded-soft-realtime-device I expect more!
>
> IMHO the OS on an embedded device with a 1 GHZ CPU should not use more than
> 1% of the CPU to process around thousand events per seconds - and even this
> i would consider slow.
> Anyway, this time I resist to go into a deeper rant.
>
> Kind Regards,
> Ralf
>
> 2010/4/18 Robert Green 
>
>
>
>
>
> > I've tried sleep() and have switched to wait(1000), notify() / yield()
> > as outlined by some other devs.  I have no empirical evidence that one
> > works any better than the other.  Both consume a range between 25-36%
> > of the CPU by system_process while touching.  That's a full third of
> > the CPU of the device just to give me coordinates off the touch
> > screen.  No one has a good workaround for this it seems and seeing the
> > problem on the 2.1 emulator makes me think that Google Android devs
> > have swept it aside with a casual "It's good enough."  Let's see
> > replica island switch to constant-touch controls (virtual joystick or
> > virtual dpad) and retain framerates over 20 with that input scheme on
> > any MSM7200-based device.
>
> > I'm a little frustrated.  I've spent the last 6 months writing two
> > really nice games (Best work I've ever done in my 11 year programming
> > career, in fact) and this is their main issue now.  They run fantastic
> > on the Droid and N1, of course, and even get solid framerates on the
> > MSM7200 up until you touch the screen... Then it's lag-city all the
> > way home.
>
> > I'm ready to put up a decent cash bounty for someone that can provide
> > a reliable solution to this that doesn't involve me taking away the
> > constant-touch controls.  Contact me if you have experience fixing
> > this problem and are sure you can do it.
>
> > On Apr 18, 5:41 am, Mario Zechner  wrote:
> > > I can confirm that the issue is still there in Android 2.0.1 on my
> > > Milestone as well (

Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Isaac Wagner
On Sun, Apr 18, 2010 at 3:25 PM, Justin Giles  wrote:
> Why would you want to allow them to set it in settings when Android handles
> the rotation automagically?  All you have to do is have a xml file in your
> "layout" directory, then for landscape have a xml file (with the same name)
> in your "layout-land" directory.  When in portrait mode Android looks to the
> "layout" directory.  When the phone is flipped to its side for landscape,
> Android looks to the "layout-land" directory.
> Justin
>

 why is it that when I ask a simple question I get harassed?  I
didn't want to get into a big long discussion of why something makes
sense or doesn't.  I understand my problem domain and have a specific
portion of that domain that I am solving right now.

OK, since it appears I can't get a simple answer without a long
explanation My application is one such that the user moves their
phone around a lot.  During this movement I want to keep the
orientation constant -- I DON'T WANT ANDROID TO HANDLE THE ROTATION.
So, in my manifest I set the orientation to portrait to prevent
Android from mucking with the orientation.  However, I am now making
some additions and would like the user to be able to choose portrait
or landscape mode, but whatever they choose needs to stick.  Again, I
don't want Android to handle the rotation.  As the phone is moved
around I want whichever orientation they chose to stick.

Does that make sense?  Now, how do I do this?  How do I force the
orientation to my preference?

-- 
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] Defining an XML vertical line drawable

2010-04-18 Thread Caspa
Hello,

I'm trying to figure out how to define a verical line (1px thick) to
be used as a drawable.

to make a horizontal one, it's pretty straightforward:

http://schemas.android.com/apk/res/android";
android:shape="line">




The question is, how to make this line vertical?

Yes, there are workarounds, such as drawing a rectangle shape 1px
thick, but that complicates the drawable xml, if it consists of
multiple  elements.

Anyone had any chance with this?

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


[android-developers] Do the USB drivers work on XP64?

2010-04-18 Thread ThomasWrobel
I have two machines, one a WindowsXP32, and one 64. Both with AMD64
chips.
I have eclipse on both, and the SDK on both.
I'm using the usb drivers with the HTC Legend (http://
groups.google.com/group/android-developers/browse_thread/thread/
2b54d2ce1202b04b/dd6f9152cd50d64b?lnk=gst&q=usb+#dd6f9152cd50d64b).

On the 32bit one things work just peachy. Device recognised, and
debugging working fine.
However, the 64bit one doesn't seem to recognise the device.
Windows recognise's the device, and windows device manage shows it,
but "adb devices" lists nothing, and nothing shows up when trying to
manually launch from eclipse.

Any ideas?

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


Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Justin Giles
Why would you want to allow them to set it in settings when Android handles
the rotation automagically?  All you have to do is have a xml file in your
"layout" directory, then for landscape have a xml file (with the same name)
in your "layout-land" directory.  When in portrait mode Android looks to the
"layout" directory.  When the phone is flipped to its side for landscape,
Android looks to the "layout-land" directory.

Justin


On Sun, Apr 18, 2010 at 1:35 PM, Isaac Wagner wrote:

> On Sun, Apr 18, 2010 at 2:24 PM, Anurag Singh 
> wrote:
> >
> > Specify in your manifest file into Activity block as
> > android:ScreenOrientation="portrait"
> >
>
> My question is, how do I change the orientation through my program?  I
> want the user, through a settings option, to be able to change the
> orientation.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Isaac Wagner
On Sun, Apr 18, 2010 at 2:24 PM, Anurag Singh  wrote:
>
> Specify in your manifest file into Activity block as
> android:ScreenOrientation="portrait"
>

My question is, how do I change the orientation through my program?  I
want the user, through a settings option, to be able to change the
orientation.

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


Re: [android-developers] Handling Orientation Changes in AppWidgets

2010-04-18 Thread Anurag Singh
 Implement OnConfigurationChanged() function of your Activity and also
mention in your manifest as
  android:configChanges="orientation"

How can we tell our AppWidget to recalculate the amount of text
> displayed on screen orientation change? Is this possible? How would
> you solve this problem?
>
>

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

Re: [android-developers] Handling Orientation Changes in AppWidgets

2010-04-18 Thread Anurag Singh
Implement OnConfigurationChanged() function of your Activity and also
mention in your manifest as
android:configChanged=s="orientation"


> How can we tell our AppWidget to recalculate the amount of text
> displayed on screen orientation change? Is this possible? How would
> you solve this problem?
>


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

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

Re: [android-developers] Portrait/landscape question

2010-04-18 Thread Anurag Singh
Specify in your manifest file into Activity block as
android:ScreenOrientation="portrait"

I've got an app that I don't want to auto-rotate.  Currently, I've got
> it set up so that it is always in portrait mode.  However, I'd like to
> add a setting to my preferences where the user can choose either
> portrait or landscape mode.  Is there a way to force screen rotation?
> Or, could I perhaps make two different layout XML files, one for
> portrait and one for landscape, and programmatically choose which 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

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

Re: [android-developers] Can i get this layout with List view??

2010-04-18 Thread Anurag Singh
I think, it's not right way.





 You have mention Button in a TextView.

- Anurag Singh

Hi. please find the link to attached file, i need to have this kinda
> layout.
> is it possible??
> well perhaps it is, but im not getting it how to do it.
> i want to specify the whole layout in the xml, but it gives runtime
> error
>
> here's the link to the blue print of desired layout:
>
> http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88/desired%20layout.jpg
>
> here's my main.xml-
>
> 
> http://schemas.android.com/apk/res/
> android"
>android:orientation="vertical"
>android:layout_width="fill_parent"
>android:layout_height="fill_parent"
>>
>  android:id="@+id/widget28"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_x="17px"
> android:layout_y="10px"
> >
>  android:id="@+id/widget40"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="Button"
> android:layout_alignTop="@+id/widget39"
> android:layout_toRightOf="@+id/widget38"
> >
> 
>  android:id="@+id/widget39"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="TextView"
> android:layout_alignParentBottom="true"
> android:layout_alignParentLeft="true"
> >
>  android:id="@+id/widget38"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="Button"
> android:layout_alignParentTop="true"
> android:layout_alignParentRight="true"
> >
> 
> 
> 
> android:id="@+id/tweetList"
>android:layout_width="wrap_content"
>android:layout_height="wrap_content"
>/>
> 
>
> is anything wrong??
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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] Portrait/landscape question

2010-04-18 Thread Isaac Wagner
I've got an app that I don't want to auto-rotate.  Currently, I've got
it set up so that it is always in portrait mode.  However, I'd like to
add a setting to my preferences where the user can choose either
portrait or landscape mode.  Is there a way to force screen rotation?
Or, could I perhaps make two different layout XML files, one for
portrait and one for landscape, and programmatically choose which 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: requestLocationUpdates issue

2010-04-18 Thread Tejas
> If you're going to do that, why involve a handler
> at all?

Now suppose, I use any other function in my service class instead of
handler and say I'm performing a time consuming task in that function.
If the onDestroy method of the service is called, I assume that it
will terminate my function abruptly. I'm not sure of this, but I
thought so and hence used the Handler thread to have a proper
shutdown. please correct me if I'm wrong. Also let me know the right
way to stop the service.

> Finally, never, ever, call getApplicationContext(). The return value
> is not useful to us mortals. Supply the service itself as the context.
I'm still not sure what are you saying. How will you supply the
service as the context ? Can you provide an example ?



On Apr 18, 2:56 am, Bob Kerns  wrote:
> Actually, just because something is a background service does NOT mean
> it is running in a different thread.
>
> Background services run in the main thread. I suspect that this point
> of confusion may be involved in your problem, though I don't quite
> spot the problem.
>
> Also, you have a handler there that basically loops forever. That's
> kind of an oxymoron. If you're going to do that, why involve a handler
> at all? If I parse it correctly, it's not the main thread it'll be
> blocking, but still... if something in that thread is posting via that
> thread's looper rather than the context, that won't be processed.
>
> Finally, never, ever, call getApplicationContext(). The return value
> is not useful to us mortals. Supply the service itself as the context.
> To make things maximally confusing, getApplicationContext() will
> appear to work in most circumstances. But it's always the wrong way to
> get a context to use.
>
> On Apr 17, 2:05 pm, Tejas  wrote:
>
>
>
>
>
> > Ah... I got this working. Still I'm not sure of the reason for this
> > (some thread issue I suppose) It would be great if someone can throw
> > some light on this.
>
> > I was instantiating the sensor class in a background service.So the
> > thread in which it was running was different than the main thread.
> > I was doing something like this:
>
> > public class ManagerService extends Service {
>
> >         private final String LTAG = this.getClass().getName();
> >         private volatile Looper mServiceLooper;
> >         private volatile ServiceHandler mServiceHandler;
>
> >         private final class ServiceHandler extends Handler{
> >                 public ServiceHandler(Looper myLooper) {
> >                         super(myLooper);
> >                 }
>
> >                 public void handleMessage(Message msg) {
> >                         Log.v(LTAG, "handleMessage Called");
> >                         super.handleMessage(msg);
>
> >                         // Class Instantiation
> >                         GPSSensor gs = new GPSSensor();
> >                         gs.setContext(getApplicationContext());
> >                         gs.startSensing()
>
> >                         // Main service loop
> >                         while(CARuntimes.MainServiceRunFlag == true){
> >                                 Log.v(LTAG, "In service Loop");
> >                                 // Do something
>
> >                                 SystemClock.sleep(6);
>
> >                         }//while
>
> >                 }
> >         }
>
> >         public void onCreate() {
> >                 super.onCreate();
> >                 HandlerThread myThread = new HandlerThread("Main Service 
> > Thread");
> >                 myThread.start();
>
> >                 mServiceLooper = myThread.getLooper();
> >                 mServiceHandler = new ServiceHandler(mServiceLooper);
> >         }
>
> >         public void onStart(Intent intent, int startId) {
> >                 super.onStart(intent, startId);
>
> >                 Message msg = mServiceHandler.obtainMessage();
> >                 //msg.obj = blah blah
> >                 mServiceHandler.sendMessage(msg);
>
> >         }
>
> >         public void onDestroy() {
> >                 Log.v(LTAG, "onDestroy called, quitting looper");
> >                 super.onDestroy();
>
> >                 mServiceLooper.quit();
> >         }
>
> >         public IBinder onBind(Intent arg0) {
> >                 return null;
> >         }
>
> > }
>
> > So, I was instantiating the GPSSensor in the handleMessage method. I
> > moved this to the onStart method and it started working.
> > I'm not sure why it wasn't working earlier and now has started working
> > with this change.
> > It will be great if anyone can explain this.
>
> > Cheers,
> > Tejas
>
> > On Apr 17, 1:59 am, Tejas  wrote:
>
> > > Hi,
>
> > > My class listed below is not working. No idea whatsoever. The
> > > onLocationChanged method is never getting called !
> > > I checked the logs for any errors/exceptions. I have the required
> > > permissions set (fine and course locations).
> > > I doubt the Context I'm setting from the caller. I'm using
> 

[android-developers] Handling Orientation Changes in AppWidgets

2010-04-18 Thread Adam Brookman
We have created an AppWidget that takes user inputted text into an
EditText and displays a calculated amount of text inside a TextView on
the Home Screen. We calculate the amount of text based on the
AppWidgetInfo.minWidth, minHeight attributes. We do this to simulate
scrolling; we cut up the user-inputted text into chunks that will fit
into the widget and swap them based on button clicks.

When we save the widget with the device in Landscape mode, it
calculates the appropriate amount of text for Landscape mode and
displays it in the widget. The problem is when the user changes
orientation of the device to Portrait mode (without opening the widget
and resaving the text), the calculated amount of text for Landscape
mode is still displayed. This also happens in the vice versa case (the
user is in Portrait and saves, etc.)

How can we tell our AppWidget to recalculate the amount of text
displayed on screen orientation change? Is this possible? How would
you solve this problem?

-- 
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 i get this layout with List view??

2010-04-18 Thread SheikhAman
Hi. please find the link to attached file, i need to have this kinda
layout.
is it possible??
well perhaps it is, but im not getting it how to do it.
i want to specify the whole layout in the xml, but it gives runtime
error

here's the link to the blue print of desired layout:
http://lh6.ggpht.com/_o9EYB0b5APY/S8s-coQE-KI/CrA/KJUl5ANBi88/desired%20layout.jpg

here's my main.xml-


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











is anything wrong??

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


Re: [android-developers] aidl.exe is missing from tool directory

2010-04-18 Thread Anurag Singh
Thanks a lot, I got the same.

> I had install SDK 2.0. I am not able to locate aidl.exe in tool directory.
>
> It will not be in the top-level tools directory, but in a
> platform-specific tools directory. For example, if you have installed
> the SDK in C:\SDK, you will find the Android 2.1 version of aidl.exe in
> C:\SDK\platforms\android-2.1\tools.
>
> Ant and Eclipse should each find it without issue, if you have
> everything configured properly.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Consulting: http://commonsware.com/consulting
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] aidl.exe is missing from tool directory

2010-04-18 Thread Mark Murphy
Anurag Singh wrote:
> I had install SDK 2.0. I am not able to locate aidl.exe in tool directory.

It will not be in the top-level tools directory, but in a
platform-specific tools directory. For example, if you have installed
the SDK in C:\SDK, you will find the Android 2.1 version of aidl.exe in
C:\SDK\platforms\android-2.1\tools.

Ant and Eclipse should each find it without issue, if you have
everything configured properly.

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

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

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


[android-developers] aidl.exe is missing from tool directory

2010-04-18 Thread Anurag Singh
Hello All

I had install SDK 2.0. I am not able to locate aidl.exe in tool directory.

Please help to locate. Is there any location from where I can download?

Thanks In  Advance.

Anurag

-- 
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: Problems with big buttons using android:duplicateParentState

2010-04-18 Thread marco.alexander.schmitz
is there nobody who can help me?

2010/4/17 Marco Alexander Schmitz 

> Hi you all,
>
> today I've got a silly little problem and I hope you can help me out.
>
> I want to create a big button that contains a bitmap and some text.
>
> So I created a container (LinearLayout) with clickable="true".
>
> Inside this container there is an ImageButton with
> duplicateParentState="true" and a TextView.
>
> The problem is that I can click everywhere in this container except on
> the ImageButton.
>
>
> In order to show that something is clicked I use an xml (with selector
> and items) as background for the ImageView.
>
>
> If you remove the clickable="true" and duplicateParentState="true"
> only the the ImageButton is clickable.
>
> How can I create such a big button as I want to?
>
>
> Here comes some code:
>
> First of all the button_green.xml with 2 different bitmaps:
>
> 
> http://schemas.android.com/apk/res/android";>
>
>android:drawable="@drawable/button_green_normal" />
>
>android:drawable="@drawable/button_green_normal" />
>
>android:drawable="@drawable/button_green_hover" />
>
>android:drawable="@drawable/button_green_hover" />
>
> 
>
> And then the main.xml with a top image and two big buttons:
>
> 
> http://schemas.android.com/apk/res/
> android"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:background="#141414">
>
>  android:layout_width="wrap_content"
>  android:layout_height="wrap_content" android:src="@drawable/
> top"
>  android:layout_alignParentTop="true" />
>
> 
>   android:layout_below="@+id/top"
> android:layout_width="250dip"
>  android:layout_height="100dip" android:background="@drawable/
> bigbutton"
>  android:layout_centerHorizontal="true"
> android:layout_marginTop="25dip"
>  android:clickable="true">
>
>  
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>   android:background="@drawable/button_green"
> android:layout_gravity="center_vertical"
>   android:duplicateParentState="true" />
>
> android:layout_height="wrap_content" android:text="You
> can click me !"
>   android:layout_gravity="center_vertical"
> android:textColor="#BBB5A5"
>   android:textSize="18dip" />
> 
>
> 
>   android:layout_below="@+id/bigbutton_1"
> android:layout_width="250dip"
>  android:layout_height="100dip" android:background="@drawable/
> bigbutton"
>  android:layout_centerHorizontal="true"
> android:layout_marginTop="25dip"
>  android:clickable="true">
>
>  
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>   android:background="@drawable/button_red"
> android:layout_gravity="center_vertical"
>   android:textColor="#BBB5A5" android:textSize="18dip"
>   android:duplicateParentState="true" />
>
> android:layout_height="wrap_content"
> android:text="Click me, too !"
>   android:layout_gravity="center_vertical"
> android:textColor="#BBB5A5"
>   android:textSize="18dip" />
> 
>
> 
>
> Thanks for your help.
>
> I'll attach the project so you can play around...
>
> Greetings,
> Marco
>
> Screenshot: http://www.anddev.org/files/screenshot_652.png
> Project: http://www.anddev.org/download.php?id=2058
>

-- 
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: SlidingDrawer handle

2010-04-18 Thread Pinheiro
 Thanks, Bob!

 Unfortunately, it seems Launcher's handle is not accessible (at least
it's not in the SDK).
 Bummer, will have to reinvent the wheel and make my own :-(

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


Re: [android-developers] Re: Selling outside the Android Market--> Use Google Checkout to sell direct from website??? SlideMe.Org??

2010-04-18 Thread Shane Isbell
On Sun, Apr 18, 2010 at 12:04 AM, Shane Isbell wrote:

>
>
> On Sat, Apr 17, 2010 at 7:57 PM, George | SlideME <
> george.slid...@gmail.com> wrote:
>
>>
>> Wish to also say thank you to Paul for uploading his application to
>> SlideME, considering the negativity of this thread from an ex-partner. I am
>> sure Paul and many others will be well looked after as best as we can and
>> have their say one day.
>>
> I'd prefer if Paul could have his say right now. Paul, does this mean you
> investigation turned up positive results for dev payments from SlideME?
>
> According to a post by Koxx on androidforums (on April 3, 2010), payment
> from SlideME was still in progress. George said SlideME already paid him.
> What gives? Something really doesn't add up now.
>
This question is really simple, does SlideME handle it's obligation of
paying out developers? SlideME says that it does. This is simple to verify.
I've e-mailed Koxx(Francois) so I hope to have a response regarding this
soon. I'll also e-mail out to other developers as well and will report back
to this group, hopefully within the next week or two, so we can put this
issue to rest one way or another.

Shane

-- 
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's wrong with this location code?

2010-04-18 Thread Maps.Huge.Info (Maps API Guru)
Personally, I wouldn't be making any coding plans for using the
Galileo system for location handling any time this decade. It will be
amazing if the EU manages to organize it into a working system in any
lifetime of current OS's or apps for that matter. Think of how long it
took to get a working engine for their A400 program, nearly 20 years
and the darn thing still isn't anything but a test program. The
Galileo system currently has no "in operation" date and only two test
satellites have been launched, none of them will be used in an
operational program. A functional system is at least a decade away
optimistically. I think you can safely ignore that possibility as a
means of location detection on current Android devices.

-John Coryat

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


Re: [android-developers] Re: glCopyTexImage2D - Success anyone?

2010-04-18 Thread Andres Colubri


FYI - CopyTexImage2D is a pipeline stall so you will want to set up
your rendering order to account for that.  I'm not sure how to
optimize but I would try having it be as near to last as possible to
start with.
Thanks for the recommendation. In fact, I'm using it as the very last 
function in the rendering sequence. The effect on the performance is 
quite noticeable: the framerate goes from 60 down to 20 when doing 
copying a 256x512 texture.



I don't know how to get the SubImage function to work.  As far as I
understand, you must start with an allocated texture space using
TexImage2D and then and only then after that can you use
SubTexImage2D.  Please correct me if I'm wrong.
  
I have a suspicion as for the reason why CopyTexSubImage2D doesn't work. 
First of all, CopyTexImage2D only accepts GL_RGB as the internal format. 
GL_RGBA won't work, which seems to indicate that only RGB textures can 
be used as destination. I don't know the reason for this. Now, if you 
read the documentation for CopyTexSubImage2D:


"glCopyTexSubImage2D requires that the internal format of the currently 
bound texture is such that color buffer components can be dropped during 
conversion to the internal format, but new components cannot be added. 
For example, an RGB color buffer can be used to create LUMINANCE or RGB 
textures, but not ALPHA, LUMINANCE_ALPHA or RGBA textures."


Since the color buffer seems to provide only RGB components, according 
to what we observed with CopyTexSubImage2D, then we should bound an RGB 
texture to use with CopyTexSubImage2D. But RGB textures allocated with 
TexImage2D are not "functional" at all. Every time I try to render an 
RGB texture, I get just a white rectangle irrespective of the color 
buffer I use to initialize the texture.


Robert Green wrote:

Great!  I'm glad you got it to work.




I'd like to recommend checking for the FrameBufferObject (FBO)
extension and using that instead of this function when available.  I
think all of the ES2 chips support it.  It's much faster, but you'll
need to fallback to this when it's not supported.

On Apr 18, 12:30 am, Andres Colubri  wrote:
  

I finally got glCopyTexImage2D t work, using a power-of-two texture as
you suggested, and GL_RGB as internal format passed to glCopyTexImage2D
(the internal format of the texture is GL_RGBA).

glCopyTexSubImage2D doesn't seem to work though. As far as I understand
from reading the OpenGL ES documentation, this call:

glCopyTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, 0, 0, w, h);

should be equivalent to:

glCopyTexImage2D(GL10.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0,0, w, h, 0)

if the internal format of the bound texture is RGB. Am I correct?

Thanks for the feedback.





Robert Green wrote:


Have you tried copying it to a power of 2 texture instead of the
viewport dimensions?  I'd test with 512x256 and see if that works.
  
On Apr 16, 10:22 pm, Andres Colubri  wrote:
  

Any updates on this one? I have been trying to copy the contents of the
back buffer into an opengl texture, but without success. I'm using the
same method mentioned in the first post of this thread:

gl.glCopyTexImage2D(GL10.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0,0, w, h, 0);

where w and h are the current width and height of the screen,

respectively. This works fine on the emulator, but it returns garbage
back into the texture on the actual device.
The phone is a Nexus One.

On Dec 11 2009, 11:56 pm, scott19_68  wrote:

 > Works for me on my HTC Hero - I too could only use RGB and not RGBA.
 > Emulator flips the textures upside down though...

 > Does anyone else have more information regarding other phones?  I have

 > an app on the app store that uses this method and I am suspecting that
 > it does not work for all current phones.  I get really useful comments
 > like 'Does not work on Tattoo - nuff said'...

 > Not sure if the forum rules prevent me from mentioning my app so PM me

 > if you'd like to help out and test - I'd definitely appreciate it very
 > much and would be willing to help you out in return regarding OpenGL
 > development questions...

 > On Nov 21, 4:45 pm, Ben Gotow  wrote:

 > > Hey everyone,

 > > I'm porting anOpenGLapp from the iPhone to Android, and I need to

 > > renderOpenGLcontent to a texture. Since framebuffers are not
 > > available inOpenGL1.0 and the DROID is the only Android phone to
 > > support the framebuffer extension, I'm trying to draw usingOpenGLand
 > > then copy the result into a texture usingglCopyTexImage2D. However,
 > > my initial findings are not good:

 > > 1.glCopyTexImage2Dworks in the Android emulator (OS v. 1.5), but

 > > only with GL10.GL_RGB, not GL_RGBA. If you try to copy the alpha data
 > > from the scene into the texture, you just get a completely white
 > > texture.

 > > 2.glCopyTexImage2Ddoesn't seem to work _at all_ on the Android G1.

 > > It does not throw an UnsupportedOperationExc

[android-developers] Re: OutOfMemory problem

2010-04-18 Thread Streets Of Boston
How big, in pixels, is the image?

On Apr 18, 5:50 am, Kofa  wrote:
> I really don't know why it's giving me this error...
> I load an ImageView with an image of 692kb .jpg, using scroll options,
> so you can scroll it around... the strange it's that when the mobile
> it's connected to the VM it's less possible to happen.
> So...how can I prevent this? is there anyway that I can free memory
> when starting the app? can I tell the system to free memory before
> loading the image? please show me the path =Pthx a lot!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Disabling records in a List View

2010-04-18 Thread Prathamesh Shetye
never mind, solved it, cheers mate!

On Apr 18, 8:26 pm, Prathamesh Shetye 
wrote:
> Hi Mark, Here's what I did
>
> My Existing Class extending ListActivity
>
> /
> *** 
> /
> public class LifeProducts extends ListActivity {
>
>         private static List products;
>         private static List actives;
>
>         private DataHelper dh;
>         private List ips;
>
>         public void onCreate(Bundle savedInstanceState) {
>
>                 dh = new DataHelper(this);
>                 ips = dh.GetMyProducts();
>
>                 products = new ArrayList();
>                 actives = new ArrayList();
>
>                 for(MyProducts ip : ips){
>                         products.add(ip.name);
>
>                         if (ip.active == 0)
>                                 actives.add("N");
>                         else
>                                 actives.add("Y");
>                 }
>
>                 super.onCreate(savedInstanceState);
>
>                 ProductAdapter pas = new ProductAdapter(this,
> R.layout.life_products, products);
>                 pas.setActiveList(actives);
>                 setListAdapter(pas);
>
>                 ListView lv = getListView();
>                 lv.setTextFilterEnabled(true);
>
>                 lv.setOnItemClickListener(
>                         new OnItemClickListener() {
>                                 @Override
>                                 public void onItemClick(AdapterView arg0, 
> View arg1, int arg2,
>                                                 long arg3) {
>                                         // TODO Auto-generated method stub
>                                         
> Toast.makeText(getApplicationContext(), ((TextView)
> arg1).getText(),
>                                                   Toast.LENGTH_SHORT).show();
>                                 }
>                         }
>                 );
>         }
>
> }
>
> and here's how i overloaded the ArrayAdapter
> /
> *** 
> /
> @SuppressWarnings({ "unchecked", "hiding" })
> public class ProductAdapter extends ArrayAdapter{
>
>         public ProductAdapter(Context context, int textViewResourceId, List
> objects) {
>                 super(context, textViewResourceId, objects);
>                 // TODO Auto-generated constructor stub
>         }
>
>         public List actives;
>
>         public void setActiveList(List act){
>                 actives = act;
>         }
>
>         @Override
>         public boolean areAllItemsEnabled(){
>                 return false;
>         }
>
>         @Override
>         public boolean isEnabled(int position){
>                 for (String s : actives){
>                         if (s == "Y")
>                                 return true;
>                         else
>                                 return false;
>                 }
>                 return true;
>         }}
>
> /
> *** 
> /
> Now my Database has 8 records, which are to be displayed
> I am not getting any error but the my output just contains the last
> records displayed 8 times
>
> what am i doing wrong??
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Disabling records in a List View

2010-04-18 Thread Mark Murphy
Prathamesh Shetye wrote:
> Hi Mark, Here's what I did
> 
> My Existing Class extending ListActivity
> 
> /
> ***/
> public class LifeProducts extends ListActivity {
> 
>   private static List products;
>   private static List actives;
> 
>   private DataHelper dh;
>   private List ips;
> 
>   public void onCreate(Bundle savedInstanceState) {
> 
>   dh = new DataHelper(this);
>   ips = dh.GetMyProducts();
> 
>   products = new ArrayList();
>   actives = new ArrayList();
> 
>   for(MyProducts ip : ips){
>   products.add(ip.name);
> 
>   if (ip.active == 0)
>   actives.add("N");
>   else
>   actives.add("Y");
>   }
> 
>   super.onCreate(savedInstanceState);
> 
>   ProductAdapter pas = new ProductAdapter(this,
> R.layout.life_products, products);
>   pas.setActiveList(actives);
>   setListAdapter(pas);
> 
>   ListView lv = getListView();
>   lv.setTextFilterEnabled(true);
> 
>   lv.setOnItemClickListener(
>   new OnItemClickListener() {
>   @Override
>   public void onItemClick(AdapterView arg0, 
> View arg1, int arg2,
>   long arg3) {
>   // TODO Auto-generated method stub
>   Toast.makeText(getApplicationContext(), 
> ((TextView)
> arg1).getText(),
> Toast.LENGTH_SHORT).show();
>   }
>   }
>   );
>   }
> }
> 
> and here's how i overloaded the ArrayAdapter
> /
> ***/
> @SuppressWarnings({ "unchecked", "hiding" })
> public class ProductAdapter extends ArrayAdapter{
> 
>   public ProductAdapter(Context context, int textViewResourceId, List
> objects) {
>   super(context, textViewResourceId, objects);
>   // TODO Auto-generated constructor stub
>   }
> 
>   public List actives;
> 
>   public void setActiveList(List act){
>   actives = act;
>   }
> 
>   @Override
>   public boolean areAllItemsEnabled(){
>   return false;
>   }
> 
>   @Override
>   public boolean isEnabled(int position){
>   for (String s : actives){
>   if (s == "Y")
>   return true;
>   else
>   return false;
>   }
>   return true;
>   }
> }
> /
> ***/
> Now my Database has 8 records, which are to be displayed
> I am not getting any error but the my output just contains the last
> records displayed 8 times
> 
> what am i doing wrong??

Get rid of @SuppressWarnings({ "unchecked", "hiding" }) and fix whatever
warnings you're getting.

Your isEnabled() implementation is not using the position parameter.
That would seem to be an error, since the whole *point* of isEnabled()
is to indicate if the row at a certain position in your adapter is or is
not enabled.

Beyond that, I have no suggestions.

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

_Android Programming Tutorials_ Version 2.0 Available!

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


[android-developers] Need some knowledge on android emulator | Please Help

2010-04-18 Thread Thisara Rupasinghe
Hi All,

I'm interested in doing some enhancements to android emulator (implement
webcam on emulator). Therefore I'm following the android source and
emulators source to get basic understanding  & the connection between
modules. But its really hard to understand it for someone who is new to
android. Therefore can anyone please direct me to some resource to
understand this. May be some proper documentation, tutorials or anything
that i can understand this.

And since i'm interested in emulator if i change the code of emulator with
in "external\qemu" , then build it using "m emulator" and run using
"emulator" , will those changes effect or apply onto the started emulator.

And if anyone know please let me know that, what is the sdk it uses when it
run as "emulator" from the build android source code. Cos if i want to
install some application to that emulator how can i do that?

Please help if anyone know...

-- 
Thanks & Regards,
Thisara.

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

Re: [android-developers] Re: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Ralf Schneider
I have already talked a lot about the touch slow down in this forum.
There is another observation I would like to add, may be this can help to
track the problem down.

One of my projects is an Argumented Reality Game.
Of course this kind of App eats energy (CPU cycles) like crazy:

In my app I process:
The camare, OpenGL graphics, Pseudo-3D-Sound mixing (8 simultaneous samples
+ ogg-music), 2 constant sensor imputs (acceleration, magnetic) and
additional input from trackball, hardware keys and the touch screen.

The largest slow down occurs with the touch-events.

But the next big slow down occurs with the accleration and magnetic events!
I gained up to 4 FPS on a N1 by switching from SENSOR_DELAY_FASTEST to
SENSOR_DELAY_GAME.

=> So I just wonder: May be the slow down is in no way specific to touch
events! Instead the whole input-queue-event handling is just horribly slow.
As everyonw has observed: Touching the screen will trigger (flood) lots of
events - This is similar as enabling input from other sensors - which can
slow down the app in a compareable way, too!
The main differences is only: Touching the screen will still trigger more
event than using a sesnor in *SENSOR_DELAY_FASTEST*. So the slow down
appears as less drastically...

After working a while with Android, I must say:
The design and architecture of the Java-API seems to be nice and well done
most of the time.
But the execution and implementation of the software stack as a whole seems
to be just slow, slow, slow, slow,  All this doesn't matter if you have
lots of servers with many cores (ENTERPRISE!) but for an
embedded-soft-realtime-device I expect more!

IMHO the OS on an embedded device with a 1 GHZ CPU should not use more than
1% of the CPU to process around thousand events per seconds - and even this
i would consider slow.
Anyway, this time I resist to go into a deeper rant.

Kind Regards,
Ralf



2010/4/18 Robert Green 

> I've tried sleep() and have switched to wait(1000), notify() / yield()
> as outlined by some other devs.  I have no empirical evidence that one
> works any better than the other.  Both consume a range between 25-36%
> of the CPU by system_process while touching.  That's a full third of
> the CPU of the device just to give me coordinates off the touch
> screen.  No one has a good workaround for this it seems and seeing the
> problem on the 2.1 emulator makes me think that Google Android devs
> have swept it aside with a casual "It's good enough."  Let's see
> replica island switch to constant-touch controls (virtual joystick or
> virtual dpad) and retain framerates over 20 with that input scheme on
> any MSM7200-based device.
>
> I'm a little frustrated.  I've spent the last 6 months writing two
> really nice games (Best work I've ever done in my 11 year programming
> career, in fact) and this is their main issue now.  They run fantastic
> on the Droid and N1, of course, and even get solid framerates on the
> MSM7200 up until you touch the screen... Then it's lag-city all the
> way home.
>
> I'm ready to put up a decent cash bounty for someone that can provide
> a reliable solution to this that doesn't involve me taking away the
> constant-touch controls.  Contact me if you have experience fixing
> this problem and are sure you can do it.
>
> On Apr 18, 5:41 am, Mario Zechner  wrote:
> > I can confirm that the issue is still there in Android 2.0.1 on my
> > Milestone as well (and more pronounced) on my HTC Hero which still
> > runs 1.5. I put together a quick test that you can download fromhttp://
> file-pasta.com/file/0/touchflood.apk(Note:
> it's 300kb because
> > i used a game dev framework to put that together which features a bit
> > more than is needed).
> >
> > Observations on 2.0.1:
> > - Touching alone decreases the performance a bit, around 2-4 frames
> > are lost
> > - Touching and moving the finger around makes things works, the frame
> > rate drops by up to 8fps
> > - The slow down is not constant but fluctuates a lot.
> > - Sleeping in onTouch does not solve the problem at all (sleep times
> > from 16 to 40ms) but only increases the lag in user input
> >
> > At least there's no garbage collection in 2.0.1 anymore due to touch
> > events.
> >
> > On 18 Apr., 11:46, Robert Green  wrote:
> >
> >
> >
> >
> >
> > > Actually I take it back about the emulators.  I just tested again in
> > > the 2.1 emulator and realized that in my first test, I was holding the
> > > "finger" down on the screen but unlike a device, it doesn't send
> > > constant motion events if you hold the cursor still.  Moving the
> > > cursor (touch) around caused the same problem as on 1.6!  Now I'm a
> > > little worried.  Is this problem really still not fixed?
> >
> > > On Apr 18, 4:30 am, Robert Green  wrote:
> >
> > > > Just wondering if anyone can speak on this yet.  I'd really like to
> > > > know what the state of that fix is as 2.1 is rolled out onto first
> > > > generation (

[android-developers] Re: Disabling records in a List View

2010-04-18 Thread Prathamesh Shetye
Hi Mark, Here's what I did

My Existing Class extending ListActivity

/
***/
public class LifeProducts extends ListActivity {

private static List products;
private static List actives;

private DataHelper dh;
private List ips;

public void onCreate(Bundle savedInstanceState) {

dh = new DataHelper(this);
ips = dh.GetMyProducts();

products = new ArrayList();
actives = new ArrayList();

for(MyProducts ip : ips){
products.add(ip.name);

if (ip.active == 0)
actives.add("N");
else
actives.add("Y");
}

super.onCreate(savedInstanceState);

ProductAdapter pas = new ProductAdapter(this,
R.layout.life_products, products);
pas.setActiveList(actives);
setListAdapter(pas);

ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(
new OnItemClickListener() {
@Override
public void onItemClick(AdapterView arg0, 
View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), 
((TextView)
arg1).getText(),
  Toast.LENGTH_SHORT).show();
}
}
);
}
}

and here's how i overloaded the ArrayAdapter
/
***/
@SuppressWarnings({ "unchecked", "hiding" })
public class ProductAdapter extends ArrayAdapter{

public ProductAdapter(Context context, int textViewResourceId, List
objects) {
super(context, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}

public List actives;

public void setActiveList(List act){
actives = act;
}

@Override
public boolean areAllItemsEnabled(){
return false;
}

@Override
public boolean isEnabled(int position){
for (String s : actives){
if (s == "Y")
return true;
else
return false;
}
return true;
}
}
/
***/
Now my Database has 8 records, which are to be displayed
I am not getting any error but the my output just contains the last
records displayed 8 times

what am i doing wrong??

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


[android-developers] Using Selector to change ImageButton's background while keeping the content image

2010-04-18 Thread Sebastian Mauer
Hi there,

I am currently trying to customize ImageButton to show different
draweables as background of the Button while keeping
the image set via the src attribute.

That's my custom_button.xml:


http://schemas.android.com/apk/res/android";>
  
  
  


And this is the actual definition of the ImageButton:


Unfortunately all I get is the background from the selector xml
(whichs is btw working as expected) but not the image I have set via
the src attribute.
So basically all I want is to replace the standard state background
drawables while keeping the ability to set a foreground/content image.

Am I doing something wrong here?

Greetings,

maui

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


Re: [android-developers] Re: What's wrong with this location code?

2010-04-18 Thread Michael Thomas

patbenatar wrote:

Perhaps you are forgetting about the chain and theodolite provider.



Mike-

What are those? The LocationManager class only has these two provider
constants: GPS_PROVIDER, NETWORK_PROVIDER.
  


I was just making a funny, but the larger point is to not code things as 
if these are
the only two forever more, (think ultimately Galileo as an example), and 
certainly
don't make assumptions about the accuracy of resolution (Galileo is 
supposed to be

quite a bit more accurate once its constellation is up).

Mike


Thanks!
Nick




On Apr 17, 2:57 am, Michael Thomas  wrote:
  

patbenatar wrote:


You really have no reason to have a LocationListener[10] array...
There are really only two location providers, Network and GPS. So all
you need are two LocationListeners: fineLocationListener and
coarseLocationListener.
  

Perhaps you are forgetting about the chain and theodolite provider.

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



  


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


[android-developers] Re: HTC Desire keyboard problem

2010-04-18 Thread jamesc
Hi Michael

It'll be the Sense UI's IME which has different behaviour to the stock
Android IME. Sadly, I'd suggest that you get your hands on a Sense UI-
equipped device (even a Hero, which whilst it has 1.5 on it, may help
you track that issues).

When you say that ACTION_UP doesn't work, is this for all key presses,
or just some in particular?  A bit more information on what you're
attempting to capture with ACTION_UP would be helpful in order to
allow to to get some useful debug prints out.

On Apr 17, 8:46 am, Michael Rueger  wrote:
> Hi all,
>
> a day away from deployment...
> Our application which we had tested on a G1 with 1.6 and a Nexus with
> 2.1 suddenly has unexpected problems on a HTC desire (German version)
> with 2.1.
>
> It seems that the keyboard behaves differently:
>
> - event.getAction() == KeyEvent.ACTION_UP
> doesn't work/fire
>
> - android:imeOptions="actionNext"
> doesn't seem to be honored by the keyboard (it keeps the return button)
>
> Unfortunately I don't have access to the phone (a user did some testing)
> so I can't debug.
>
> Any ideas?
>
> Michael
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Disabling records in a List View

2010-04-18 Thread Prathamesh Shetye
Thanks Mark, I'll try it out.

Cheers!

On Apr 18, 6:20 pm, Mark Murphy  wrote:
> Prathamesh Shetye wrote:
> > I have a list view which is populated via records from the database.
> > Now i have to make some records visible but unavailable for selection,
> > how can i achieve that?
>
> Step #1: Create your own subclass of ArrayAdapter
>
> Step #2: Override areAllItemsEnabled() in that subclass to return false
>
> Step #3: Override isItemEnabled() in that subclass to return true for
> the enabled positions and false for the disabled positions
>
> Note that disabled rows do not get dividers around them. Dividers only
> separate a pair of enabled rows.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Disabling records in a List View

2010-04-18 Thread Mark Murphy
Prathamesh Shetye wrote:
> I have a list view which is populated via records from the database.
> Now i have to make some records visible but unavailable for selection,
> how can i achieve that?

Step #1: Create your own subclass of ArrayAdapter

Step #2: Override areAllItemsEnabled() in that subclass to return false

Step #3: Override isItemEnabled() in that subclass to return true for
the enabled positions and false for the disabled positions

Note that disabled rows do not get dividers around them. Dividers only
separate a pair of enabled rows.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
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] Disabling records in a List View

2010-04-18 Thread Prathamesh Shetye
I have a list view which is populated via records from the database.
Now i have to make some records visible but unavailable for selection,
how can i achieve that?

here's my code

public class SomeClass extends ListActivity {

private static List products;

private DataHelper dh;

public void onCreate(Bundle savedInstanceState) {

dh = new DataHelper(this);

products = dh.GetMyProducts();  /* Returns a List*/

super.onCreate(savedInstanceState);

setListAdapter(new ArrayAdapter(this, 
R.layout.myproducts,
products));

ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(
new OnItemClickListener() {
@Override
public void onItemClick(AdapterView arg0, 
View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), 
((TextView)
arg1).getText(),
  Toast.LENGTH_SHORT).show();
}
}
);
}
}


The layout file myproducts.xml is as follows


http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp">


-- 
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: Clear defaults programmatically

2010-04-18 Thread Menion
I'm using this code ... hope it helps

PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();

On Apr 16, 11:09 am, Bonifaz  wrote:
> Does anyone know
> how to clear defaults of my own app by code.
>
> I know that a user can always go to Manage Applications, find my app
> and click the button there to clear previously assigned default
> actions. But for most users this isn't intuitive at all.
>
> I would like to offer my customers a solution to clear defaults within
> my own app if they don't like to use my app as a replacement for a
> specific action anymore.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Socket + SurfaceView + multiplayer game problem. Need Help

2010-04-18 Thread croco
FYI,

I've raised to 18 FPS by using LinkedBlockingQueue instead of 8FPS
with while design in Socket writer.
But we are far from 60FPS per second.

Any help?

Thanks

Luc

On 18 avr, 10:18, croco  wrote:
> Hi all,
>
> I'm developping a simple realtime action game 4 Android.
> It works nice. but now i want deal with animation FPS and i'm facing a
> big problem i can't solve since couple days now.
>
> I started from the famous Lunar Android sample using facebook. got
> 55-60 frame per second on my G1.
> it smelt good for my game i thought ... BUT when i plugged the surface
> view in my game i got a poor 6-9 Frame per second making the game
> unplayable.
>
> After debugging removing all content of my doDraw used by the thread
> controlling the surface view i found the problem.
>
> The problem is not the quantity of sprites i displayed but the
> concurrency between threads used for receiving my game data over TCP
> and the UI thread i use to control surface view.
>
> If when i start displaying the game i stop the my socket protocol
> threads (reader, writer) the game is refreshed at 25 FPS which is not
> 50 FPS but large enought to make the game playable.
>
> So my question is how in realtime game for android i can send /
> received data (and not delayed of course) without killing the game
> refresh rate.
>
> Last thing i use canvas and not open gl but i don't need open gl and i
> really see the problem comes from the multithreading
>
> Thanks a Lot for your help.
>
> Luc
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Disable or Override the Car Dock App

2010-04-18 Thread Mark Murphy
shookie10 wrote:
> Is there any way to disable or override the car dock app? 

You should be able to provide an alternative to the car dock app by
having an activity with an  with the CATEGORY_CAR_DOCK
category.

I would expect the user to then get a choice of what activity to start
when they dock their phone, just as there is with a replacement home screen.

However, I don't have a car dock and so have not experimented with this
category.

> I have created a BroadcastReceiver for my
> app but the standard car dock app displays, not my app.

To quote the documentation:

"To launch an activity from a dock state change, use CATEGORY_CAR_DOCK
or CATEGORY_DESK_DOCK instead. "

(that's from the docs for ACTION_DOCK_EVENT, which is what your
BroadcastReceiver presumably listens for)

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

Android 2.x Programming Books: http://commonsware.com/books

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


[android-developers] Disable or Override the Car Dock App

2010-04-18 Thread shookie10
Is there any way to disable or override the car dock app?  I want the
application that I am writing to be able to launch when the device is
placed into the car dock.  I have created a BroadcastReceiver for my
app but the standard car dock app displays, not my app.  I know that
my broadcast receiver is working because when I click the back button
on the device from the car dock app it shows my app.  How do I get it
to not show the car dock app?  There is no listing for the car dock
app in the list of installed apps on the phone.  The only solution I
have found on the web is to root your phone and change the .apk file
name.  I can't expect my users to do that.  Any help greatly
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: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Robert Green
I've tried sleep() and have switched to wait(1000), notify() / yield()
as outlined by some other devs.  I have no empirical evidence that one
works any better than the other.  Both consume a range between 25-36%
of the CPU by system_process while touching.  That's a full third of
the CPU of the device just to give me coordinates off the touch
screen.  No one has a good workaround for this it seems and seeing the
problem on the 2.1 emulator makes me think that Google Android devs
have swept it aside with a casual "It's good enough."  Let's see
replica island switch to constant-touch controls (virtual joystick or
virtual dpad) and retain framerates over 20 with that input scheme on
any MSM7200-based device.

I'm a little frustrated.  I've spent the last 6 months writing two
really nice games (Best work I've ever done in my 11 year programming
career, in fact) and this is their main issue now.  They run fantastic
on the Droid and N1, of course, and even get solid framerates on the
MSM7200 up until you touch the screen... Then it's lag-city all the
way home.

I'm ready to put up a decent cash bounty for someone that can provide
a reliable solution to this that doesn't involve me taking away the
constant-touch controls.  Contact me if you have experience fixing
this problem and are sure you can do it.

On Apr 18, 5:41 am, Mario Zechner  wrote:
> I can confirm that the issue is still there in Android 2.0.1 on my
> Milestone as well (and more pronounced) on my HTC Hero which still
> runs 1.5. I put together a quick test that you can download 
> fromhttp://file-pasta.com/file/0/touchflood.apk(Note: it's 300kb because
> i used a game dev framework to put that together which features a bit
> more than is needed).
>
> Observations on 2.0.1:
> - Touching alone decreases the performance a bit, around 2-4 frames
> are lost
> - Touching and moving the finger around makes things works, the frame
> rate drops by up to 8fps
> - The slow down is not constant but fluctuates a lot.
> - Sleeping in onTouch does not solve the problem at all (sleep times
> from 16 to 40ms) but only increases the lag in user input
>
> At least there's no garbage collection in 2.0.1 anymore due to touch
> events.
>
> On 18 Apr., 11:46, Robert Green  wrote:
>
>
>
>
>
> > Actually I take it back about the emulators.  I just tested again in
> > the 2.1 emulator and realized that in my first test, I was holding the
> > "finger" down on the screen but unlike a device, it doesn't send
> > constant motion events if you hold the cursor still.  Moving the
> > cursor (touch) around caused the same problem as on 1.6!  Now I'm a
> > little worried.  Is this problem really still not fixed?
>
> > On Apr 18, 4:30 am, Robert Green  wrote:
>
> > > Just wondering if anyone can speak on this yet.  I'd really like to
> > > know what the state of that fix is as 2.1 is rolled out onto first
> > > generation (MSM7200-based) devices.  As it stands, I don't see much of
> > > a problem with touch eating up CPU on the Droid and N1 but those are
> > > much faster phones so I don't think it would be quite as pronounced on
> > > them.  My current 1.6 devices (G1 and Tattoo) cut my framerates in
> > > half during any touch (with the sleep hack, even).  I optimized my new
> > > games so that they would run well-enough (25-40fps) on that hardware
> > > but they have very touch-centric interfaces so won't work well with
> > > that bug.  I talked to a few people who run 2.0/2.1 mods on their G1s
> > > and they said the problem isn't any better.  They still see the big
> > > slowdown.  I tested on my 1.6 emulator vs a 2.1 emulator and there is
> > > a huge improvement.  The 1.6 emulator slows down just like my G1 does
> > > and the 2.1 emulator shows only a tiny bit of slowdown, which is what
> > > I was hoping for.  That's encouraging, but I have yet to see a real
> > > 2.1 MSM7200 update in the field so I don't know what to think yet.
>
> > > Anyone got anything concrete on this?
>
> > > 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 
> > > athttp://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
>

[android-developers] Re: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Mario Zechner
I can confirm that the issue is still there in Android 2.0.1 on my
Milestone as well (and more pronounced) on my HTC Hero which still
runs 1.5. I put together a quick test that you can download from
http://file-pasta.com/file/0/touchflood.apk (Note: it's 300kb because
i used a game dev framework to put that together which features a bit
more than is needed).

Observations on 2.0.1:
- Touching alone decreases the performance a bit, around 2-4 frames
are lost
- Touching and moving the finger around makes things works, the frame
rate drops by up to 8fps
- The slow down is not constant but fluctuates a lot.
- Sleeping in onTouch does not solve the problem at all (sleep times
from 16 to 40ms) but only increases the lag in user input

At least there's no garbage collection in 2.0.1 anymore due to touch
events.

On 18 Apr., 11:46, Robert Green  wrote:
> Actually I take it back about the emulators.  I just tested again in
> the 2.1 emulator and realized that in my first test, I was holding the
> "finger" down on the screen but unlike a device, it doesn't send
> constant motion events if you hold the cursor still.  Moving the
> cursor (touch) around caused the same problem as on 1.6!  Now I'm a
> little worried.  Is this problem really still not fixed?
>
> On Apr 18, 4:30 am, Robert Green  wrote:
>
>
>
> > Just wondering if anyone can speak on this yet.  I'd really like to
> > know what the state of that fix is as 2.1 is rolled out onto first
> > generation (MSM7200-based) devices.  As it stands, I don't see much of
> > a problem with touch eating up CPU on the Droid and N1 but those are
> > much faster phones so I don't think it would be quite as pronounced on
> > them.  My current 1.6 devices (G1 and Tattoo) cut my framerates in
> > half during any touch (with the sleep hack, even).  I optimized my new
> > games so that they would run well-enough (25-40fps) on that hardware
> > but they have very touch-centric interfaces so won't work well with
> > that bug.  I talked to a few people who run 2.0/2.1 mods on their G1s
> > and they said the problem isn't any better.  They still see the big
> > slowdown.  I tested on my 1.6 emulator vs a 2.1 emulator and there is
> > a huge improvement.  The 1.6 emulator slows down just like my G1 does
> > and the 2.1 emulator shows only a tiny bit of slowdown, which is what
> > I was hoping for.  That's encouraging, but I have yet to see a real
> > 2.1 MSM7200 update in the field so I don't know what to think yet.
>
> > Anyone got anything concrete on this?
>
> > 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 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Socket + SurfaceView + multiplayer game problem. Need Help

2010-04-18 Thread satish bhoyar
Hi,

I am not big Android programmer .. I cant solve this problem ...  but wish
to learn this cocept like u have ,Socket + surfaceView is there any
specific link that u have through which i can learn abt this ..?

please send me if u can ...

thanks,
satish
On Sun, Apr 18, 2010 at 1:48 PM, croco  wrote:

> Hi all,
>
> I'm developping a simple realtime action game 4 Android.
> It works nice. but now i want deal with animation FPS and i'm facing a
> big problem i can't solve since couple days now.
>
> I started from the famous Lunar Android sample using facebook. got
> 55-60 frame per second on my G1.
> it smelt good for my game i thought ... BUT when i plugged the surface
> view in my game i got a poor 6-9 Frame per second making the game
> unplayable.
>
> After debugging removing all content of my doDraw used by the thread
> controlling the surface view i found the problem.
>
> The problem is not the quantity of sprites i displayed but the
> concurrency between threads used for receiving my game data over TCP
> and the UI thread i use to control surface view.
>
> If when i start displaying the game i stop the my socket protocol
> threads (reader, writer) the game is refreshed at 25 FPS which is not
> 50 FPS but large enought to make the game playable.
>
> So my question is how in realtime game for android i can send /
> received data (and not delayed of course) without killing the game
> refresh rate.
>
> Last thing i use canvas and not open gl but i don't need open gl and i
> really see the problem comes from the multithreading
>
> Thanks a Lot for your help.
>
> Luc
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] OutOfMemory problem

2010-04-18 Thread Kofa
I really don't know why it's giving me this error...
I load an ImageView with an image of 692kb .jpg, using scroll options,
so you can scroll it around... the strange it's that when the mobile
it's connected to the VM it's less possible to happen.
So...how can I prevent this? is there anyway that I can free memory
when starting the app? can I tell the system to free memory before
loading the image? please show me the path =Pthx a lot!

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


[android-developers] Re: Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Robert Green
Actually I take it back about the emulators.  I just tested again in
the 2.1 emulator and realized that in my first test, I was holding the
"finger" down on the screen but unlike a device, it doesn't send
constant motion events if you hold the cursor still.  Moving the
cursor (touch) around caused the same problem as on 1.6!  Now I'm a
little worried.  Is this problem really still not fixed?

On Apr 18, 4:30 am, Robert Green  wrote:
> Just wondering if anyone can speak on this yet.  I'd really like to
> know what the state of that fix is as 2.1 is rolled out onto first
> generation (MSM7200-based) devices.  As it stands, I don't see much of
> a problem with touch eating up CPU on the Droid and N1 but those are
> much faster phones so I don't think it would be quite as pronounced on
> them.  My current 1.6 devices (G1 and Tattoo) cut my framerates in
> half during any touch (with the sleep hack, even).  I optimized my new
> games so that they would run well-enough (25-40fps) on that hardware
> but they have very touch-centric interfaces so won't work well with
> that bug.  I talked to a few people who run 2.0/2.1 mods on their G1s
> and they said the problem isn't any better.  They still see the big
> slowdown.  I tested on my 1.6 emulator vs a 2.1 emulator and there is
> a huge improvement.  The 1.6 emulator slows down just like my G1 does
> and the 2.1 emulator shows only a tiny bit of slowdown, which is what
> I was hoping for.  That's encouraging, but I have yet to see a real
> 2.1 MSM7200 update in the field so I don't know what to think yet.
>
> Anyone got anything concrete on this?
>
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: memory problem with image... but strange...

2010-04-18 Thread Kofa
It wasn't solved, now it ask for less memory but still outOfMemory
sometimes. I really don't know what to do if anyone knows how to
solve it, please tell me!!!

-- 
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] Is the bad MotionEvent/Touch slowdown stuff actually fixed on first-gen 2.1 updates?

2010-04-18 Thread Robert Green
Just wondering if anyone can speak on this yet.  I'd really like to
know what the state of that fix is as 2.1 is rolled out onto first
generation (MSM7200-based) devices.  As it stands, I don't see much of
a problem with touch eating up CPU on the Droid and N1 but those are
much faster phones so I don't think it would be quite as pronounced on
them.  My current 1.6 devices (G1 and Tattoo) cut my framerates in
half during any touch (with the sleep hack, even).  I optimized my new
games so that they would run well-enough (25-40fps) on that hardware
but they have very touch-centric interfaces so won't work well with
that bug.  I talked to a few people who run 2.0/2.1 mods on their G1s
and they said the problem isn't any better.  They still see the big
slowdown.  I tested on my 1.6 emulator vs a 2.1 emulator and there is
a huge improvement.  The 1.6 emulator slows down just like my G1 does
and the 2.1 emulator shows only a tiny bit of slowdown, which is what
I was hoping for.  That's encouraging, but I have yet to see a real
2.1 MSM7200 update in the field so I don't know what to think yet.

Anyone got anything concrete on this?

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: glTexImage2D very slow on phones like Nexus one

2010-04-18 Thread Robert Green
Eong,

All Mario and I are trying to say is that the thing you are trying to
do (upload textures every frame) is generally not considered a good
practice and workarounds usually exist that are more efficient,
especially if you can target higher levels of opengl or use extensions
like framebufferobjects.  If you would be willing to tell us something
a little bit more specific about what you're doing that requires a
texture update every frame, we could potentially offer some more
efficient ways of doing it.

On Apr 18, 2:44 am, Eong  wrote:
> Thanks, Mario.
> I think it's somewrong with the driver or the chip. It's not just a
> bandwidth problem. If it's really a bandwidth problem, it only has 1/7
> bandwidth of milestone? (150ms compare to 20ms with a full screen
> tex).That's very funny.
>
> I'm working on some libs, which will be used for our tools and games.
> When a full screen update only takes 20+ms, it's usable in some
> conditions as it already gets at least 40fps.
>
> On 4月17日, 下午6时22分, Mario Zechner  wrote:
>
>
>
>
>
> > It seems that the msm chips are notorious for having a low bandwidth.
> > There's really no solution to that problem other than
>
> > 1) lowering your texture size
> > 2) lowering the bit depth of the texture, e.g. instead of using
> > RGBA use RGBA444 or RGB565
> > 2) uploading your texture in patches, e.g. split it up into 4 smaller
> > parts and upload one part each frame. This will probably lead to
> > artifacts if your frame rate is low but could work otherwise.
>
> > Just out of curiousity: why do you have to upload such a big texture
> > each frame? If you'd state your scenario in detail we might be able to
> > suggest other solutions to the problem.
>
> > On 17 Apr., 12:10, Eong  wrote:
>
> > > Robert,
> > >    Sorry, it's not text, it's tex. I just use this to draw the
> > > background.
> > >    I just want to know why nexus one is so slow with this. It takes
> > > 20ms on my milestone but it takes at least 80ms on the nexus one, for
> > > one frame.
>
> > > On 4月17日, 上午2时08分, Robert Green  wrote:
>
> > > > Eong,
>
> > > > You said you are uploading every frame just to draw text?  There are
> > > > much more efficient ways to do that.
>
> > > > On Apr 16, 11:14 am, Eong  wrote:
>
> > > > > I'm afraid it's not a same problem.
> > > > > My problem only happenes on Snapdragon phones.
> > > > > It's fine on Milestone or Droid. I found a few threads about this but
> > > > > no solution.
>
> > > > > On 4月16日, 下午9时15分, Felipe Silveira  wrote:
>
> > > > > > Just a guess: It can be the same error reported 
> > > > > > here:http://code.google.com/p/android/issues/detail?id=7520
>
> > > > > > Take a look...
>
> > > > > > Felipe Silveirahttp://www.felipesilveira.com.br
>
> > > > > > On Fri, Apr 16, 2010 at 8:40 AM, Eong  wrote:
> > > > > > > Hi,
> > > > > > > We are developing 2D games. And we found our game works fine 
> > > > > > > except
> > > > > > > the snapdragon chips, like Nexus one and Liquid A1. It even runs 
> > > > > > > fine
> > > > > > > on G1.
>
> > > > > > > We use GLSurfaceView, and we useglTexImage2Dand glTexIsubmage2D to
> > > > > > > put on the text and then draw.
> > > > > > > TheglTexImage2Dclass take more than 100ms on Nexus one (1024x512 
> > > > > > > pix
> > > > > > > tex). It's very strange, G1 is even faster than this.
> > > > > > > If anyone know something about this?
>
> > > > > > > -Code
> > > > > > > snip---
> > > > > > >                                        
> > > > > > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT
> > > > > > > | GL10.GL_DEPTH_BUFFER_BIT);
>
> > > > > > >  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, m_width,
> > > > > > > m_height, GL10.GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas);
>
> > > > > > >                                        
> > > > > > > ((GL11Ext)gl).glDrawTexiOES(0, 0, 0,
> > > > > > > m_width, m_height);
>
> > > > > > > --
> > > > > > > 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 > > > > > >  cr...@googlegroups.com>
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > > > --
> > > > > > Felipe Silveira
> > > > > > Engenharia da Computação
> > > > > > Universidade Federal de Itajubáhttp://www.felipesilveira.com.br
> > > > > > MSN: felipeuni...@hotmail.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 t

[android-developers] Socket + SurfaceView + multiplayer game problem. Need Help

2010-04-18 Thread croco
Hi all,

I'm developping a simple realtime action game 4 Android.
It works nice. but now i want deal with animation FPS and i'm facing a
big problem i can't solve since couple days now.

I started from the famous Lunar Android sample using facebook. got
55-60 frame per second on my G1.
it smelt good for my game i thought ... BUT when i plugged the surface
view in my game i got a poor 6-9 Frame per second making the game
unplayable.

After debugging removing all content of my doDraw used by the thread
controlling the surface view i found the problem.

The problem is not the quantity of sprites i displayed but the
concurrency between threads used for receiving my game data over TCP
and the UI thread i use to control surface view.

If when i start displaying the game i stop the my socket protocol
threads (reader, writer) the game is refreshed at 25 FPS which is not
50 FPS but large enought to make the game playable.

So my question is how in realtime game for android i can send /
received data (and not delayed of course) without killing the game
refresh rate.

Last thing i use canvas and not open gl but i don't need open gl and i
really see the problem comes from the multithreading

Thanks a Lot for your help.

Luc

-- 
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: glTexImage2D very slow on phones like Nexus one

2010-04-18 Thread Eong
Thanks, Mario.
I think it's somewrong with the driver or the chip. It's not just a
bandwidth problem. If it's really a bandwidth problem, it only has 1/7
bandwidth of milestone? (150ms compare to 20ms with a full screen
tex).That's very funny.

I'm working on some libs, which will be used for our tools and games.
When a full screen update only takes 20+ms, it's usable in some
conditions as it already gets at least 40fps.


On 4月17日, 下午6时22分, Mario Zechner  wrote:
> It seems that the msm chips are notorious for having a low bandwidth.
> There's really no solution to that problem other than
>
> 1) lowering your texture size
> 2) lowering the bit depth of the texture, e.g. instead of using
> RGBA use RGBA444 or RGB565
> 2) uploading your texture in patches, e.g. split it up into 4 smaller
> parts and upload one part each frame. This will probably lead to
> artifacts if your frame rate is low but could work otherwise.
>
> Just out of curiousity: why do you have to upload such a big texture
> each frame? If you'd state your scenario in detail we might be able to
> suggest other solutions to the problem.
>
> On 17 Apr., 12:10, Eong  wrote:
>
>
>
> > Robert,
> >    Sorry, it's not text, it's tex. I just use this to draw the
> > background.
> >    I just want to know why nexus one is so slow with this. It takes
> > 20ms on my milestone but it takes at least 80ms on the nexus one, for
> > one frame.
>
> > On 4月17日, 上午2时08分, Robert Green  wrote:
>
> > > Eong,
>
> > > You said you are uploading every frame just to draw text?  There are
> > > much more efficient ways to do that.
>
> > > On Apr 16, 11:14 am, Eong  wrote:
>
> > > > I'm afraid it's not a same problem.
> > > > My problem only happenes on Snapdragon phones.
> > > > It's fine on Milestone or Droid. I found a few threads about this but
> > > > no solution.
>
> > > > On 4月16日, 下午9时15分, Felipe Silveira  wrote:
>
> > > > > Just a guess: It can be the same error reported 
> > > > > here:http://code.google.com/p/android/issues/detail?id=7520
>
> > > > > Take a look...
>
> > > > > Felipe Silveirahttp://www.felipesilveira.com.br
>
> > > > > On Fri, Apr 16, 2010 at 8:40 AM, Eong  wrote:
> > > > > > Hi,
> > > > > > We are developing 2D games. And we found our game works fine except
> > > > > > the snapdragon chips, like Nexus one and Liquid A1. It even runs 
> > > > > > fine
> > > > > > on G1.
>
> > > > > > We use GLSurfaceView, and we useglTexImage2Dand glTexIsubmage2D to
> > > > > > put on the text and then draw.
> > > > > > TheglTexImage2Dclass take more than 100ms on Nexus one (1024x512 pix
> > > > > > tex). It's very strange, G1 is even faster than this.
> > > > > > If anyone know something about this?
>
> > > > > > -Code
> > > > > > snip---
> > > > > >                                        
> > > > > > gl.glClear(GL10.GL_COLOR_BUFFER_BIT
> > > > > > | GL10.GL_DEPTH_BUFFER_BIT);
>
> > > > > >  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, m_width,
> > > > > > m_height, GL10.GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_byteCanvas);
>
> > > > > >                                        
> > > > > > ((GL11Ext)gl).glDrawTexiOES(0, 0, 0,
> > > > > > m_width, m_height);
>
> > > > > > --
> > > > > > 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 > > > > >  cr...@googlegroups.com>
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > > --
> > > > > Felipe Silveira
> > > > > Engenharia da Computação
> > > > > Universidade Federal de Itajubáhttp://www.felipesilveira.com.br
> > > > > MSN: felipeuni...@hotmail.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 
> > > > > athttp://groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" gro

  1   2   >