[android-developers] Will android.permission.VIBRATE permission make my app invisible to tablets(in Android Market)?

2011-09-23 Thread Kakyoin
I've read about Android Market filtering which involve uses-feature
tag. But what about permission?

Will Android Market filter my app out if the device has no vibrator?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: OpenGL texture display properly on my phone. But 'white box' on some device?

2011-03-20 Thread Kakyoin
Hi.

Sorry for taking so long to get back to you.

It works now. =) The problem here is the alpha. I tried setting the
alpha to 1.0 instead of 0.0 and it works.

//solution
gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);


Also thank you for the tips about drawable-nodpi/debugging the actual
bitmap after decoding. Although it's not the case here(I tried
debugging as you advise), it's good to know. =)

Thank you everyone. =)

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


[android-developers] OpenGL texture display properly on my phone. But 'white box' on some device?

2011-03-17 Thread Kakyoin
Hi.

My OpenGL texture display properly on my G1 and Motorola Milestone. (I
only have these 2 devices to test)

But on many other devices(reported by users), there's only a white
box displaying instead of the texture.

This bug also appear on  Android 2.3 Emulator.

My texture size is 128x256 in pixel.

Below is the code I use to display the texture:

gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL10.GL_BLEND); // Turn Blending On
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glDisable(GL10.GL_LIGHT0);
gl.glDisable(GL10.GL_LIGHTING);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
GL10.GL_REPLACE);
gl.glBindTexture(GL10.GL_TEXTURE_2D, myTextureID);

gl.glPushMatrix();
gl.glTranslatef(0, 0, -9.0f);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texBuff);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, bgBuff);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);  
gl.glPopMatrix();




And here's the code I used to load the texture:

private int loadTextureById(GL10 gl, int resId) {
int[] textures = new int[1];
gl.glGenTextures(1, textures, 0);

int generatedTextureId = textures[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, generatedTextureId);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, 
GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, 
GL10.GL_TEXTURE_MAG_FILTER,
GL10.GL_LINEAR);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_CLAMP_TO_EDGE);




  gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
  GL10.GL_MODULATE);

InputStream is =
mGameActivity.getResources().openRawResource(resId);
Bitmap bitmap;
try {
bitmap = BitmapFactory.decodeStream(is);
} finally {
try {
is.close();
} catch (IOException e) {
// Ignore.
}
}

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();

return generatedTextureId;

}

Anyone know how to solve this problem?

Thank you in advance!

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


[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?

2011-03-17 Thread Kakyoin
*** Update ***

Today I just updated my Motorola Milestone to Android 2.2 and this bug
is now happening on my device !!

The texture was displaying fine when my Milestone was Android 2.1
yesterday.

I hope this piece of info will greatly help solving 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] I'm using onSensorChanged(). What should I specify in uses-feature ?

2010-11-30 Thread Kakyoin
Hi.

I've checked the doc here:
http://developer.android.com/guide/topics/manifest/uses-feature-element.html

and found 2 most relevant features:

1)  android.hardware.sensor.accelerometer

2)  android.hardware.sensor.compass

Which one do I need to specify in my manifest? Or both?

Yes, I'm sure I'm using the accelerometer. But the Accelerometer and
Magnetic Field values are also used to calculate Direction (which
also means I'm using android.hardware.sensor.compass ??)

Here's my code:

@Override
public void onSensorChanged(SensorEvent event) {
int type = event.sensor.getType();

switch (type) {
case Sensor.TYPE_MAGNETIC_FIELD:
mags = event.values.clone();
break;
   //I'm using Accelerometer here
case Sensor.TYPE_ACCELEROMETER:
accels = event.values.clone();
break;
}
SensorManager.getRotationMatrix(rotationMat,
I, accels, mags);
SensorManager.getOrientation(rotationMat, 
calculatedOrients);

   //I also get direction here,  So do I need to specify
android.hardware.sensor.compass in uses-feature ?
azimuthZ = (float) Math.toDegrees(calculatedOrients[0]);
pitchX = (float) Math.toDegrees(calculatedOrients[1]);
rollY = -(float) Math.toDegrees(calculatedOrients[2]);
}

Thank you in advance!

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


[android-developers] Extremely weird Null Pointer exception. Please help.

2010-09-29 Thread Kakyoin
Hi.  I'll try to explain the situation as clear as possible.  I'll
provide all the data I can.

My problem is: I click on a checkbox in my PreferenceActivity activity
and got a Null pointer exception. I took it from the API demo app. I
also borrow LunarView and LunarThread from Lunar Lander example.




These logs were taken right after I press a button to launch my
preference Activity.


09-29 14:21:50.413: INFO/ActivityManager(76): Starting activity:
Intent { cmp=com.company.mygame/.PreferencesFromXml }
09-29 14:21:50.423: WARN/com.company.mygame.GameActivity(934): SIS
called
09-29 14:21:51.013: INFO/ActivityManager(76): Displayed activity
com.company.mygame/.PreferencesFromXml: 581 ms (total 581 ms)

//***please notice these 2 lines.  This is exactly when I
clicked on one of the checkboxes. I printed out 2 objects that might
be the culprit  *//

09-29 14:21:52.033: ERROR/onSharedPreferenceChanged(934):
mlunarview=com.company.mygame.lunarv...@438c1448
mLunarThread=Thread[Thread-45,5,main]
09-29 14:21:52.033: ERROR/onSharedPreferenceChanged(934):
mlunarview=com.company.mygame.lunarv...@438c9930  mLunarThread=null

*then I suddenly got Null pointer
exception
//

09-29 14:21:52.043: DEBUG/AndroidRuntime(934): Shutting down VM
09-29 14:21:52.043: WARN/dalvikvm(934): threadid=3: thread exiting
with uncaught exception (group=0x4001da28)
09-29 14:21:52.043: ERROR/AndroidRuntime(934): Uncaught handler:
thread main exiting due to uncaught exception
09-29 14:21:52.103: ERROR/AndroidRuntime(934):
java.lang.NullPointerException
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
com.company.mygame.GameActivity
$1.onSharedPreferenceChanged(GameActivity.java:352)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.app.ApplicationContext$SharedPreferencesImpl
$EditorImpl.commit(ApplicationContext.java:2727)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.preference.Preference.tryCommit(Preference.java:1199)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.preference.Preference.persistBoolean(Preference.java:1404)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.preference.CheckBoxPreference.setChecked(CheckBoxPreference.java:
155)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.preference.CheckBoxPreference.onClick(CheckBoxPreference.java:
143)
09-29 14:21:52.103: ERROR/AndroidRuntime(934): at
android.preference.Preference.performClick(Preference.java:811)


OK, I know you need more info, here's the content of GameActivity.java
around line 352:

OnSharedPreferenceChangeListener mOnSPListener = new
OnSharedPreferenceChangeListener() {

@Override
public void onSharedPreferenceChanged(
SharedPreferences sharedPreferences, String 
key) {
if (key.equals(sound_preference)) {

boolean soundOn = 
sharedPreferences.getBoolean(key, true);
Log.e(onSharedPreferenceChanged, 
mLunarView=+mLunarView+ 
mLunarThread=+mLunarThread);   //***you can see the log
output above for this line***//
mLunarThread.prefChangedSound(soundOn); 
//***line 352
is here***//

} else if (key.equals(music_preference)) {

boolean musicOn = 
sharedPreferences.getBoolean(key, true);
mLunarThread.prefChangedMusic(musicOn);

}
}
};



What's worse is this Null pointer won't always happen! To reproduce
this bug, I did this:
1. Launch my game. Initializing both LunarView and LunarThread.
2. Click 'Option' button to go into preference activity.
3. Click on a checkbox to turn on/off the sound or music.
4. Press back to return to title screen of my game.
5. Press back again to exit the game completely. Releasing any thread
that's running.


repeat 1-5 for three to four times then I got Null pointer when I
click on a checkbox. You can see the log above.

I'm really at a dead end now. Can experts help me please? I did
everything I can for the past 3 days.

btw this was tested on Dev Phone One and Motorola Milestone.

Thank you in advance!

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


[android-developers] Re: Extremely weird Null Pointer exception. Please help.

2010-09-29 Thread Kakyoin
To point out the problem:

How did mLunarThread object suddenly become null  at line 352 of
GameActivity.java ??

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


[android-developers] What'll happen if I don't call Looper.quit()?

2010-09-28 Thread Kakyoin
Hi.

Allow me to make another thread exclusively for this. I'm sure other
dev would want to know as well.

According to the doc here:
http://developer.android.com/reference/android/os/Looper.html#loop()

--
public static final void loop ()

Since: API Level 1
Run the message queue in this thread. Be sure to call quit() to end
the loop.
--




Question:
If I use Looper.prepare() and then Looper.loop() like this:
--
new Thread(){

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

// my code here (create handler and stuff)

Looper.loop();
}

}.start();
--

What will happen if I don't call quit()? Actually I have no idea
'when' and 'where' should I call quit().

Will this loop disappear by itself after my application exit?

Thank you in advance!

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


[android-developers] Looper.prepare() question

2010-09-27 Thread Kakyoin
Hi.

I'm trying to initialize OpenFeint in my game like this:
-
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   OpenFeintSettings settings = new OpenFeintSettings(xxx,
xxx,xxx,xxx);
   OpenFeint.initialize(this, settings, new OpenFeintDelegate() {});
   
-
Result:
1. OpenFeint initialization sometimes take so song(network actions?).
It blocks the main thread.
2. My application remains in onCreate() for too long.
3. My Dev Phone One display ANR(application not responding) dialog
prompting me to choose between 'Force Close' and 'Wait'
4. Soon after that, OpenFeint has done its things and my game shows up
behind the dialog.
5. Now pressing 'Wait' will dismiss the ANR dialog and I can continue
my game properly.



But obviously we don't want ANR dialog. So now I put it in a Thread
like this:
-
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   new Thread(){
@Override
public void run() {
Looper.prepare();
OpenFeintSettings settings = new 
OpenFeintSettings(xxx,
xxx,xxx,xxx);
OpenFeint.initialize(this,
settings, new OpenFeintDelegate() {});
Looper.loop();
}
}.start();

-
Result: Problem solved. Everything seems to run fine now.

I put Looper.prepare() there because my game will crash if I don't.
The log message told me to put it there.
I put Looper.loop(); there because OpenFeint will not initialize
at all if I don't.
I've read the doc about Looper but honestly I don't understand what
the doc says.

Question:
Question 1. The doc also tell me this:
-
public static final void loop ()

Since: API Level 1
Run the message queue in this thread. Be sure to call quit() to end
the loop.
--
Can anyone explain when  where should I call quit()?

Question 2 What will happen if I don't call Looper.quit()?

Question 3 Let me ask this straight. Am I taking the correct approach?
Is there some kind of loop running alongside my game all the time if I
do this?

Thank you in advance!

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


[android-developers] Force close/wait popup while in onCreate().

2010-09-22 Thread Kakyoin
Hi.


My situation:
I've a lot of  initialization code in my main activity's onCreate().
When I launch my game, the screen goes black for a long time, then my
game appears.
I did logged some message at the start and end of onCreate() and found
that onCreate() is executing its code while the screen is black.


OK, here's the problem:
Sometimes the screen goes black for too long and phone shows a popup
dialog prompting me to choose between Force close/Wait.  Then when
onCreate() is completed, my game appears. Choosing 'Wait' then dismiss
the dialog.


How to solve this?
I tried using progress dialog described in this article
http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog

But it doesn't work. The screen goes black for the same amount of time
even after I use the progress dialog.

Thank you in advance!

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


[android-developers] Need guidance in making the game's logic supporting multiple screens.

2010-07-25 Thread Kakyoin
Hi.

I've read the article Supporting Multiple Screen on Android
developers site. But that doesn't apply to game logic.

Let me get straight to the point. My situation is as follows:

- I'm creating a game using LunarLander code as a base.

- In my game, there'll be an object flying up from the bottom of the
screen. The object will fly in projectile motion.

- I set the starting velocity, gravity and angle so that the highest
point(of projectile motion) is almost at the top of the screen.

- The screen tested is Motorola Milestone. (480x854 resolution)
Meaning the object travels around 854 pixels vertically.

--- Problem ---
When I test the game on small device (Android Dev Phone 1/G1) which is
320x480.(has only 480 pixels vertical)  The object fly out of the
screen because it is set to travel for 854 pixels.

I'm thinking of adjusting starting velocity based on screensizes. But
that sounds unreliable when we've so many devices/resolutions out
there.

How do you combat these kind of problem when making games?

Thank you in advance!

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


[android-developers] [Copyright question] Can I use Mozart's music in my Android apps/games?

2010-06-26 Thread Kakyoin
Hi.

Can I use Mozart or Beethoven music in my Android apps/games? Will I
get arrested for doing that?

I'm pretty sure their music are in public domain though.

Thank you in advance!

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


[android-developers] How to detect blowing in to the microphone?

2010-04-08 Thread Kakyoin
How to detect blowing in to the microphone?

I saw an iPhone app which simulate flute instrument. You blow through
the mic and use your fingers to play. Can Android do that?

I've looked at the voice recognition in the API demos but it seems
that is not the case.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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.


[android-developers] What to do when other 'Home' app crashes? Reboot only?

2009-03-11 Thread Kakyoin

Hi. I should post this as a follow-up to my previous thread.

But I think this problem (may be) somewhat big so I create a new
thread:

1. If a user install an alternative to 'Home'. (I'll call it 2nd Home)

2. He set this 2nd Home to launch by default for 'Home' action.

3. Whenever this 2nd Home crashes, their only choice is to reboot the
system... ?

Because, after setting 2nd Home as default,  the 'chooser' will not
come out any more even if you press the 'Home' button.

In some case if this 2nd Home crashes in its initialization state,
user can go no where, can't even go to Settings - Manage App - Clear
Defaults

Am I missing something?

Thank you in advance.

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



[android-developers] Is it possible to clear defaults by code? (after setting 'Use by default for this action'')

2009-03-10 Thread Kakyoin

Topic.

I'm playing with the alternative Home app that comes with the SDK.

I can set this as default for 'Home' action.

I can unset this by --Setting-Manage Application-My Alternative
Home- clear defaults


Question:

How to do this clear defaults by code?

I've browsed the forums but cannot find an answer.

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



[android-developers] How to explicitly launch the system's Home application by code?

2009-03-10 Thread Kakyoin

Topic.  Short and sweet question. And I did browse the forum before
asking.

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



[android-developers] Re: How to explicitly launch the system's Home application by code?

2009-03-10 Thread Kakyoin



On Mar 10, 7:31 pm, Stoyan Damov stoyan.da...@gmail.com wrote:
 Here are some examples of other operations you can specify as intents
 using these additional parameters:

     *

       ACTION_MAIN with category CATEGORY_HOME -- Launch the home screen.

 http://developer.android.com/reference/android/content/Intent.html

 On Tue, Mar 10, 2009 at 2:20 PM, Kakyoin lgmc...@gmail.com wrote:

  Topic.  Short and sweet question. And I did browse the forum before
  asking.

  Thank you in advance.


Hi. Thank you for the reply.

But actually I do have another Alternative Home application (which I
set to default for CATEGORY_HOME).

In this case, let's assume that this Alternative Home has a but in its
onCreate(), this bug cause the Force close screen.

The real problem is: when user set my Alternative Home as their
'default action for 'Home' ', then shutdown the device and turn it
back on. It'll keep crashing at the start up.

The user can't press back to go to system's Home app; there's no
system's Home to go back to (because my Alternative Home is the
default and is the only 'Home'  loaded at boot time)



I'm sorry for my bad English. _  What I'm trying to do is to handle
that bug(which actually only happen when user has no SD card present)
by doing this: if there's no SD card inserted, then just launch the
System's Home app instead




here's my code when the SD card is not found:

Intent i = new Intent();
i.setAction(android.intent.action.MAIN);
i.addCategory(android.intent.category.HOME);
startActivity(i); // this launch my Alternative Home (because it is
set as default)

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



[android-developers] Re: Is it possible to clear defaults by code? (after setting 'Use by default for this action'')

2009-03-10 Thread Kakyoin

If it's not possible,  then is there a way to check if my Alternative
Home is currently being set as default or not ?

Thank you again. =)

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



[android-developers] Re: Is it possible to clear defaults by code? (after setting 'Use by default for this action'')

2009-03-10 Thread Kakyoin

If it's not possible,  then is there a way to check if my Alternative
Home is currently being set as default or not ?

Thank you again. =)

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



[android-developers] Re: Is it possible to clear defaults by code? (after setting 'Use by default for this action'')

2009-03-10 Thread Kakyoin

If it's not possible,  then is there a way to check if my Alternative
Home is currently being set as default or not ?

Thank you again. =)

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



[android-developers] Re: How to explicitly launch the system's Home application by code?

2009-03-10 Thread Kakyoin

Hi. Thank you all for the answers.

Launching by class name was very helpful for now but following your
advice, I'll not use that method. _


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



[android-developers] How to draw an image on top of another drawable?

2008-11-30 Thread Kakyoin

Hi.

I'm playing with the Home sample (the one that is bundled with the
SDK)

I can change the Home screen background using this:


getWindow().setBackgroundDrawable(image_mountain);

Now I have a mountain as a background of my Home screen.

Now let's assume I have a picture of a moon. (image_moon)



Question: Is it possible to...

1. programmatically put the moon on my mountain image.
2. then set the new drawable: Mountain with the Moon on top as my
Home screen background?

I've explored the LayerDrawable class but it doesn't seem to solve my
problem.

Thank you in advance.


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



[android-developers] How to get the current city/country name?

2008-11-25 Thread Kakyoin

Is it possible to get the city name(I mean the city where the phone is
in at the current time)?

I need it as a parameter for google weather API, like this:

http://www.google.com/ig/api?weather=city_name,country_name

I tried browsing the classes in android.location package but have
yet to find a method to get the 'exact city name' and country name
needed for google weather API.

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



[android-developers] How to make a Service run ONLY when no other app is running?

2008-11-17 Thread Kakyoin

I've successfully created a service that change the wallpaper every 2
seconds.

My next goals:

I want this service to...

- auto-stop itself when user launch other app.
- auto-start itself when the wallpaper is visible. (eg. when users
close all other apps)

The only clue I have is, when user press the device's home button,
Android will launch an activity of category
Android.intent.category.HOME.

Which can help me a bit but obviously not enough (as pressing back
button also make wallpaper visible, but no event fired)

Any recommendations are welcome.

Thank you in advance. Smile

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



[android-developers] Need help animating the System Wallpaper.

2008-11-17 Thread Kakyoin

This is my Service.

It's a simple service which use Handler to invoke setWallpaper()
every 2 seconds.
[code]
package com.mseer.testservice;

import java.io.IOException;
import java.io.InputStream;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;

public class MyService extends Service{

  public IBinder onBind(Intent intent) {
return null;
  }


  protected static Service sv;
  protected static InputStream bg01, bg02, bg03, bg04, bg05, bg06;

  protected static int index=0;

  protected static final int SECONDPASSED = 0x1234;

  protected boolean running = false;

  Thread counterThread = null;

  static Handler myWallpaperHandler = new Handler(){
   public void handleMessage(Message msg) {
switch (msg.what) {
 case MyService.SECONDPASSED:

 updateWallpaper();

  break;
}
super.handleMessage(msg);
   }
  };





  protected static void updateWallpaper(){

  try {
if(index==0){
sv.setWallpaper(bg01);
}else if(index==1){
sv.setWallpaper(bg02);
}else if(index==2){
sv.setWallpaper(bg03);
}else if(index==3){
sv.setWallpaper(bg04);
}else if(index==4){
sv.setWallpaper(bg05);
}else if(index==5){
sv.setWallpaper(bg06);
}

index++;
if(index5){
index = 0;
}


} catch (IOException e) {

e.printStackTrace();
}




  }



  public void onCreate(){
  sv = this;
  super.onCreate();
  running = true;
  bg01 = sv.getResources().openRawResource(R.drawable.night01w);
  bg02 = sv.getResources().openRawResource(R.drawable.night02w);
  bg03 = sv.getResources().openRawResource(R.drawable.night03w);
  bg04 = sv.getResources().openRawResource(R.drawable.night04w);
  bg05 = sv.getResources().openRawResource(R.drawable.night05w);
  bg06 = sv.getResources().openRawResource(R.drawable.night06w);

  this.counterThread = new Thread(new secondCountDownRunner());
  this.counterThread.start();

  }

  public void onDestroy() {
super.onDestroy();
running = false;
counterThread.interrupt();
  }


}



class secondCountDownRunner implements Runnable{
public void run() {
 while(!Thread.currentThread().isInterrupted()){
  Message m = new Message();
  m.what = MyService.SECONDPASSED;
  MyService.myWallpaperHandler.sendMessage(m);
  try {
   Thread.sleep(2000);
  } catch (InterruptedException e) {
   Thread.currentThread().interrupt();
  }
 }
}
}[/code]My problem:

The wallpaper changes for 4-5 frames, then stopped...


Solutions I've tried:

1. I tried Logging like this:


[code]if(index==0){
Log.e(BM WALLPAPER,Wallpaper set to WP1 |  +
bg01);
sv.setWallpaper(bg01);
}else if(index==1){
Log.e(BM WALLPAPER,Wallpaper set to WP2 |   +
bg02);
sv.setWallpaper(bg02);
// and so on...
[/code]And I can still see the Log message every 2 seconds (but the
wallpaper dont change anymore)



2. I tried creating the InputStream every cycle. It works. But it
greatly slow down the phone to an unacceptable level.

[code]if(index==0){
  bg01 = sv.getResources().openRawResource
(R.drawable.night01w);
sv.setWallpaper(bg01);
}else if(index==1){
bg02 = sv.getResources
().openRawResource(R.drawable.night02w);
sv.setWallpaper(bg02);
// and so on...[/code]3. I've tried all of the above solutions but use
setWallpaper(Bitmap); instead. The result is even slower...



My requests to experts in this forum:
1. I wonder why my wallpaper animated for only 4-5 frames, then
stopped. (using the first code snippet posted above)

2. If anyone happen to know how to efficiently create an animated
wallpaper, please let me know.


Thank you in advance. =)

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



[android-developers] How to check if System Wallpaper is now Visible to the user?

2008-11-17 Thread Kakyoin

Hi.

I'm creating a Service that will run in the background and do many
tasks.

And one of those tasks will need to verify that the wallpaper is
currently visible to the user or not.

Is threre a way to check(by code) if the System Wallpaper is currently
'visible' to the user? (eg. when the user is at Home screen)

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