Re: [android-beginners] Re: Facing serious problem with static objects

2010-01-04 Thread swapnil kamble
Hi Alok,
if your both activities are from part of a single application
then why don't you simply create a common non-activity class with members as
static and access them from wherever you want.

On Sun, Jan 3, 2010 at 12:17 AM, Coco meli...@superliminal.com wrote:

 His code as given would crash if initialized to null on activity
 change. I think what you mean is to reinitialize the containers which
 is what I would suggest trying. Something like this:

 public class MyActivity extends Activity {
 public static HashMapString, String hMap;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
 hMap = new HashMapString, String(); // Recreate container
 each time.
...
}

 Alternatively he can just call hMap.clear() in onCreate() which will
 have much of the same effect. Which approach is better depends on
 exactly what he's trying to do.

 Another thing to consider is whether these members really want to be
 static in the first place.

 -Melinda

 On Jan 2, 8:50 am, Yousuf Faheem yousuf.syed@gmail.com wrote:
  Hi,
 
  Try initiallizing them to null before the change of activity takes place
 or
  at the start of home activity. Since your application is not closed(scope
 of
  the static objects), the static objects are there in memory allocated to
  that process and hence retain the value that you give.
 
  Thanks  Regards,
  Yousuf Syed
 
  On Sat, Jan 2, 2010 at 2:27 AM, Alok Kulkarni kulsu...@gmail.com
 wrote:
   Hi guys, I am facing a problem in my application.
   I have a few static arrays and Hashmaps in my app which i fill in when
 my
   Activity starts.Then this  activity later launches another Activity.
 Now
   user presses Home button of Back button and again restarts the app,
 even
   then the static objects remain in memory. I beleive this is default
 android
   behaviour.
   I have an example app.
   package com.cm.test;
 
   import java.util.HashMap;
 
   import android.app.Activity;
   import android.os.Bundle;
   import android.util.Log;
 
   public class MyActivity extends Activity {
   public static HashMapString, String hMap = new HashMapString,
   String();
 
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   Log.i(***,Hash map size = +hMap.size());
 
   hMap.put(Alok,Alo);
   hMap.put(Jitu,Jit);
 
   Log.i(***,Activity onCreate() called);
   }
   @Override
   public void onDestroy()
   {
   Log.i(***,Activity onDestroy() called);
   super.onDestroy();
 
   }
 
   @Override
   public void onResume()
   {
   super.onResume();
   Log.i(***,Activity onResume() called);
   }
   @Override
   public void onStop()
   {
 
   super.onStop();
 
   Log.i(***,Activity onStop() called);
   }
 
   }
   Output First time is Size = 0. for 1st launch, Next for every launch ,
   HashMap size is 2... If i use ArrayList , the size of ArrayList goes on
   increasing.
   I dont want this to happen.One thing was that to clear the HashMap in
   onDestroy() or in onStop() in case user presses Home button. But my
 Activity
   launches another ListActivity in it. So the alternae option is to clear
 the
   Hashmaps in onDestroy() | onStop() of this activity.
   I am not much clear when the Activity exits. From the posts that i have
   read i found few things here
  http://groups.google.com/group/android-developers/browse_thread/threa.
 ..
   The manifest part android:clearTaskOnLaunch=true does not work in my
 case.
   What do you people suggest in this case?
   Thanks,
   Alok.
 
   --
   You received this message because you are subscribed to the Google
   Groups Android Beginners group.
 
   NEW! Try asking and tagging your question on Stack Overflow at
  http://stackoverflow.com/questions/tagged/android
 
   To unsubscribe from this group, send email to
   android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 android-beginners%2bunsubscr...@googlegroups.comandroid-beginners%252bunsubscr...@googlegroups.com
 
   For more options, visit this group at
  http://groups.google.com/group/android-beginners?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en




-- 

[android-beginners] Observing User inactivity time and broadcasting intent after timeout

2009-12-13 Thread swapnil kamble
Hi,
   As in android, after inactvity of screen off timeout, android screen goes
off. So here android itself uses some activity observer, to know whether
user is currently active or not. I need not every keystroke or touch event
with details, just knowing that user is active and getting a
broadcastreceiver after some timeout value. Does anybody know something
related to activity observing ? I got the code from in frameworks where it
broadcast, but I am still figuring out code in android that monitors user
activity.

Need not be an app restricted, I am open to modify code frameworks too.

Thanks in advance,
Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] Receiving inactivity notifications in service from android

2009-11-25 Thread swapnil kamble
Hi,
I want to launch an activity only when there is no activity on android
till a particular a period of time. I know the timer value, and I want
notification after inactivity timeout of timer value. Just like what windows
provides, you set some timer value and system will be locked after that
particular inactivity timeout.

Currently I am using ACTION_SCREEN_OFF intent, but this notification timer
value i.e. inactivity timer value is screen timeout of android's default
setting.

Does anybody has any idea about providing our own timer value for
ACTION_SCREEN_OFF ? Or different way of getting inactivity notifications ?

Thanks in advance,
Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] Blocking Window key shortcut when specific activity is running

2009-11-25 Thread swapnil kamble
Hi All,
 I want to block window key shortcut, which takes user back to home
screen by suspending current activity. I want to block that, I want to eat
up that key event. I also wrote onkeydown handler using which I could eat up
all other keys, but this key event is not been received by onkeydown. Does
anybody has any idea about blocking this key event ?

Thanks in advance
Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] Re: Support of JKS Keystore in Android

2009-11-13 Thread swapnil kamble
I got it working. I used KeyTool UIU app. Using it, worked smoothly.

If anyone wants details how I did it, send me an email. I will document it
and post it on list.

Thanks,
Swapnil


On Fri, Nov 13, 2009 at 12:53 PM, swapnil kamble swap.kam...@gmail.comwrote:

 Hi,
 I am having Java SSL based server and I want to connect android SSL
 supported client to it. My keystore in Java is JKS, but android says no JKS
 implementation found. It supports BKS. Is there any way to have JKS support
 for android ? If not then how can use BKS in Java.

 I am trying using PKCS12, but documentation says using PKCS12 for
 trustanchors purpose is not supported.

 Does anybody has any suggestions about this issue ?

 --
 ...Swapnil

 || Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
 || Hare RamaHare Rama   Rama   RamaHare Hare ||




-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] Support of JKS Keystore in Android

2009-11-12 Thread swapnil kamble
Hi,
I am having Java SSL based server and I want to connect android SSL
supported client to it. My keystore in Java is JKS, but android says no JKS
implementation found. It supports BKS. Is there any way to have JKS support
for android ? If not then how can use BKS in Java.

I am trying using PKCS12, but documentation says using PKCS12 for
trustanchors purpose is not supported.

Does anybody has any suggestions about this issue ?

-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

Re: [android-beginners] Launch App on bootup?

2009-11-03 Thread swapnil kamble
I am also looking for same thing. Please let me know, if you get any
information on this.

Thanks,
Swapnil

On Tue, Nov 3, 2009 at 2:03 PM, Justin wenxinle...@gmail.com wrote:

 Hi all,

 I'm still a rookie here. I'm looking to write an application that sit
 in front of the home screen on boot up and restrict user from
 returning home screen to access system settings. Is this even possible
 on SDK 1.5/1.6? Thanks ahead.

 BR  Thanks
 Justin

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




-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] Viewing logs on native android

2009-11-03 Thread swapnil kamble
Hi All,
 As we see emulator's logs in logcat of eclipse. What is similar on
native android to view these logs ?

Thanks in advance

-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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

[android-beginners] how to set a shortcut key to launch an activity ?

2009-10-20 Thread swapnil kamble
Hello,
  how to set a shortcut key to launch an activity ?  Lets say I have an app
TestApp. I want to set a shortcut key (e.g alt + T ) to launch activity of
TestApp. Is there any way to set such shortcuts to android apps ?

Thanks in advance.

-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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



[android-beginners] Re: Is there a way to install LiveAndroid to PC permanently?

2009-09-06 Thread swapnil kamble
Hi,
There is new installable iso available. You can download that from

http://code.google.com/p/android-x86/downloads/list

On Thu, Sep 3, 2009 at 11:32 PM, windrg windr...@gmail.com wrote:


 Hello, All?
 I'd like to see if there is a way to install LiveAndroid to PC
 permanently?
 Pls let me know if you have...^^
 I really hope get a real Android machine that is networking available.

 Thx.

 



-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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



[android-beginners] Re: Making separate service app and separate activity app

2009-09-02 Thread swapnil kamble
On Wed, Sep 2, 2009 at 11:06 AM, swapnil kamble swap.kam...@gmail.comwrote:

 Hi All,
  I am new to android. I want to create a service, which will
 installed independently. And there will be multiple activity apps
 communicating with it, justlike doing IPC. I saw the DualSeviceClient sample
 which itself writes a service and communicates with it. But I want to run
 service only app separately and activity app separately.

 I also tried a separate service wiht my own. I installed it also. Now to
 start or stop from activity app I need to call startService (Intent) or
 StopService (Intent).

 And my problem is how do I know class name package name reqd for intent
 before starting or stopping in following code,

 Intent i = new Intent();

 *i.setClassName( com.DualServiceOnly,
 com.DualServiceOnly.DualServiceOnly );* // How to
 associate service here

Now I am using this code to call service as

Intent i = new Intent(ICounterService.class.getName());
ComponentName cn = startService( i );

but I am getting cn as null, ie, service not available.


How do I get list of running services ?

I have installed service with android.



 startService( i );

 Is there any sample available for this ?

 Thanks in advance.



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



[android-beginners] Making separate service app and separate activity app

2009-09-02 Thread swapnil kamble
Hi All,
 I am new to android. I want to create a service, which will
installed independently. And there will be multiple activity apps
communicating with it, justlike doing IPC. I saw the DualSeviceClient sample
which itself writes a service and communicates with it. But I want to run
service only app separately and activity app separately.

I also tried a separate service wiht my own. I installed it also. Now to
start or stop from activity app I need to call startService (Intent) or
StopService (Intent).

And my problem is how do I know class name package name reqd for intent
before starting or stopping in following code,

Intent i = new Intent();

*i.setClassName( com.DualServiceOnly,
com.DualServiceOnly.DualServiceOnly );* // How to
associate service here

startService( i );

Is there any sample available for this ?

Thanks in advance.

-- 
...Swapnil

|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama   Rama   RamaHare Hare ||

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



[android-beginners] Camera Preview on Emulator

2009-08-11 Thread swapnil kamble
Hi,
I want to preview my camera on emulator. I have also written small app for
that. But it only show black and white squares and gray square moving. Does
anybody has any idea about this ?

Thanks in advance,
Swapnil

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