[android-developers] Re: for loop gives NullPointer Exception

2009-09-11 Thread Ask

I had used the same..
but it gives the Exception in first iteration itself..

On Sep 11, 4:41 pm, joyband joyb...@163.com wrote:
 Use Log to debug the index number i

 On 9月11日, 下午7时35分, Asif k asifk1...@gmail.com wrote:



  Hi all,

I am getting null pointer exception at the bellow mentioned line in
  the for loop.

  char[] buffer= {'s','d','c'};
  char[] test;

  for(int i=0; buffer[i]!='\n';i++) {
  test[i] = buffer[i];   //This line gives Null pointer
  Exception at runtime

  }

  I am getting the same error in each for loop where I am equating
  something.- Hide quoted text -

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



[android-developers] Re: error msg after run a thread

2009-08-20 Thread Ask

Use post and handler mechanism or RunFromUI interface.

Thanks
asif

On Aug 20, 11:16 am, tstanly tsai.sta...@gmail.com wrote:
 thanks for reply,

 so how can I do for change thread's control to change my UI?

 thanks!

 On 8月20日, 下午1時03分, star double doublestar...@gmail.com wrote:



  My god, you must change your UI in main thread  but not your new thread , it
  is  android's rule .

  2009/8/20 tstanly tsai.sta...@gmail.com

   hi all,

   I write a thread, and do show() after thread complete,
   but I always get the error msg bellow,
   and this show() function is ok, because I put it on other location of
   program,
   and it works fine.

   plz help me!
   thanks!

   error msg===
   E/AndroidRuntime(  746): Uncaught handler: thread Thread-8 exiting due
   to uncaug
   ht exception
   E/AndroidRuntime(  746): android.view.ViewRoot
   $CalledFromWrongThreadException: O
   nly the original thread that created a view hierarchy can touch its
   views.

   code===
   new Thread()
   {
   public void run()
{
   try{
  } /* end of try */
   catch (Exception e)
{
Log.d(tsai_error1,e.getMessage());
} /* end of catch */
   finally
{
mProgressDialog2.dismiss();

} /* end of finally */
}/* end of run */
   }.start();

   show();- 隱藏被引用文字 -

  - 顯示被引用文字 -- Hide quoted text -

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



[android-developers] Re: error while building the android code using make

2009-07-21 Thread Ask

Hi,

  I have not got solution yet.. Has anyone ???

On Jul 17, 3:21 pm, Android development smu...@gmail.com wrote:
 Hi Asif k,
   Have you resolved this problem?
   I have the same problem.

 [...@myandroid]$ make
 build/core/product_config.mk:232: WARNING: adding test OTA key
 
 TARGET_PRODUCT=generic
 TARGET_BUILD_VARIANT=eng
 TARGET_SIMULATOR=
 TARGET_BUILD_TYPE=release
 TARGET_ARCH=arm
 HOST_ARCH=x86
 HOST_OS=linux
 HOST_BUILD_TYPE=release
 BUILD_ID=
 
 find: invalid predicate `-L'
 frameworks/policies/base/PolicyConfig.mk:22: *** No module defined for
 the given PRODUCT_POLICY (android.policy_phone).  Stop.

 On 7月17日, 下午3时05分, Ask asifk1...@gmail.com wrote:

  Hi Fred,

 If you got the answer then can you please send me some useful link.
  I had searched but could not got the proper answer (it could not solve
  my issue).

 Thanks in advance.

  On Jul 16, 8:47 pm, Fred Grott(shareme) fred.gr...@gmail.com
  wrote:

   simple  google search usually turns up the solution ..it did fro my
   build error on ubunut

   On Jul 16, 5:48 am, Ask asifk1...@gmail.com wrote:

This is the link on android platform group,

   http://groups.google.com/group/android-platform/browse_thread/thread/...

On Jul 16, 3:46 pm, Ask asifk1...@gmail.com wrote:

 Hi Mark,

   I had asked the same question to android platform forum earlier but
 nobody was  responding to that. This is the problem that I am facing
 when just following the steps showing 
 athttp://source.android.com/download
 . So even I dont know should I report it as bug ???

 Regards,

 Asif

 On Jul 16, 3:21 pm, Mark Murphy mmur...@commonsware.com wrote:

  Asif k wrote:
   Hi all,

 I have downloaded the code successfully using repo sync on my
   linux system and now I want to buld it using make but it fails and
   telling that

   frameworks/policies/base/PolicyConfig.mk:22:*** No module defined
   for
   the givenPRODUCT_POLICY(android.policy_phone) . stop.  

   So can  anyone plz tell me regarding this problem

  That's probably a better question to ask of the Android open source 
  project:

 http://source.android.com/discuss

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

  _Android Programming Tutorials_ Version 1.0 In Print!- Hide quoted 
  text -

 - Show quoted text -- Hide quoted text -

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



[android-developers] Re: error while building the android code using make

2009-07-17 Thread Ask

Hi Fred,

   If you got the answer then can you please send me some useful link.
I had searched but could not got the proper answer (it could not solve
my issue).

   Thanks in advance.

On Jul 16, 8:47 pm, Fred Grott(shareme) fred.gr...@gmail.com
wrote:
 simple  google search usually turns up the solution ..it did fro my
 build error on ubunut

 On Jul 16, 5:48 am, Ask asifk1...@gmail.com wrote:



  This is the link on android platform group,

 http://groups.google.com/group/android-platform/browse_thread/thread/...

  On Jul 16, 3:46 pm, Ask asifk1...@gmail.com wrote:

   Hi Mark,

     I had asked the same question to android platform forum earlier but
   nobody was  responding to that. This is the problem that I am facing
   when just following the steps showing athttp://source.android.com/download
   . So even I dont know should I report it as bug ???

   Regards,

   Asif

   On Jul 16, 3:21 pm, Mark Murphy mmur...@commonsware.com wrote:

Asif k wrote:
 Hi all,

   I have downloaded the code successfully using repo sync on my
 linux system and now I want to buld it using make but it fails and
 telling that

 frameworks/policies/base/PolicyConfig.mk:22:*** No module defined
 for
 the given PRODUCT_POLICY (android.policy_phone) . stop.  

 So can  anyone plz tell me regarding this problem

That's probably a better question to ask of the Android open source 
project:

   http://source.android.com/discuss

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

_Android Programming Tutorials_ Version 1.0 In Print!- Hide quoted text 
-

   - Show quoted text -- Hide quoted text -

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



[android-developers] Re: error while building the android code using make

2009-07-16 Thread Ask

Hi Mark,

  I had asked the same question to android platform forum earlier but
nobody was  responding to that. This is the problem that I am facing
when just following the steps showing at http://source.android.com/download
. So even I dont know should I report it as bug ???

Regards,

Asif

On Jul 16, 3:21 pm, Mark Murphy mmur...@commonsware.com wrote:
 Asif k wrote:
  Hi all,

    I have downloaded the code successfully using repo sync on my
  linux system and now I want to buld it using make but it fails and
  telling that

  frameworks/policies/base/PolicyConfig.mk:22:*** No module defined
  for
  the given PRODUCT_POLICY (android.policy_phone) . stop.  

  So can  anyone plz tell me regarding this problem

 That's probably a better question to ask of the Android open source project:

 http://source.android.com/discuss

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

 _Android Programming Tutorials_ Version 1.0 In Print!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: error while building the android code using make

2009-07-16 Thread Ask

This is the link on android platform group,

http://groups.google.com/group/android-platform/browse_thread/thread/208c760eab587239/4974176be9b4ed03?hl=en#4974176be9b4ed03

On Jul 16, 3:46 pm, Ask asifk1...@gmail.com wrote:
 Hi Mark,

   I had asked the same question to android platform forum earlier but
 nobody was  responding to that. This is the problem that I am facing
 when just following the steps showing athttp://source.android.com/download
 . So even I dont know should I report it as bug ???

 Regards,

 Asif

 On Jul 16, 3:21 pm, Mark Murphy mmur...@commonsware.com wrote:



  Asif k wrote:
   Hi all,

     I have downloaded the code successfully using repo sync on my
   linux system and now I want to buld it using make but it fails and
   telling that

   frameworks/policies/base/PolicyConfig.mk:22:*** No module defined
   for
   the given PRODUCT_POLICY (android.policy_phone) . stop.  

   So can  anyone plz tell me regarding this problem

  That's probably a better question to ask of the Android open source project:

 http://source.android.com/discuss

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

  _Android Programming Tutorials_ Version 1.0 In Print!- Hide quoted text -

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



[android-developers] Re: Sending messages to Subactivity( currently running) from the parentActivity

2009-06-02 Thread Ask

hello Saurav,

   Thanks for your reply. Its working fine for user defined
subActivity.

 But If we use intents for ACTION_CALL and dial a number, then if
after 30 second I want to end the call programmatically from my parent
activity , how to accomplish this using intent broadcast ?? or how can
we set timer for the subActivities started by intents

Thanks,

Asif

On Jun 1, 3:04 pm, hina naz hinana...@gmail.com wrote:
 *visit my site and earn more money**  *

 *http://latesttechnologyinfo.com/*

 *  http://latesttechnologyinfo.com/*

 *  http://latesttechnologyinfo.com/*

 *  http://latesttechnologyinfo.com/*

 *  http://latesttechnologyinfo.com/*

 *  http://latesttechnologyinfo.com/ *

 * **http://latesttechnologyinfo.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: finishing subactivity after some perticular time

2009-05-28 Thread Ask

Hi Macro,

   You are right and I know this  but this can be applicable only when
you are invoking sub activity that u had created so that u can write
ur logic in that. And My problem is, I am invoking the activity for
the phone dialer application using startActivity so I dont have
control on the code of the phone Dialer application (sub Activity). I
want to dial a number using intent and also want to cut the call
automatically after 15 seconds.

   I hope , u got my problem.

Thanks,

Asif

On May 27, 7:45 pm, Marco Nelissen marc...@android.com wrote:
 Why don't you just have your subactivity post a delayed message to itself
 and have it call finish() when it gets it?



 On Tue, May 26, 2009 at 11:49 PM, Ask asifk1...@gmail.com wrote:

  Is it possible to call finish() for subactivity from the parent
  activity?? I want to show subactivity for only some perticular time
  and after that I want it to be automatically finished..

  Thanks,
  Asif

  On May 26, 7:26 pm, Asif k asifk1...@gmail.com wrote:
   Hi all,

      I had opened an image file store in the sdcard using startActivity
   (intent) API.

     By doing this, image has opened and will remain open til manually
   coming back to parent activity by pressing back button. but I want it
   to be opened only for some perticular time after that it should exit
   and came back to parent acity. So how to set timer for subactivity??

   Please help.

   Thanks,

   Asif- Hide quoted text -

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



[android-developers] Re: finishing subactivity after some perticular time

2009-05-27 Thread Ask

Is it possible to call finish() for subactivity from the parent
activity?? I want to show subactivity for only some perticular time
and after that I want it to be automatically finished..

Thanks,
Asif

On May 26, 7:26 pm, Asif k asifk1...@gmail.com wrote:
 Hi all,

    I had opened an image file store in the sdcard using startActivity
 (intent) API.

   By doing this, image has opened and will remain open til manually
 coming back to parent activity by pressing back button. but I want it
 to be opened only for some perticular time after that it should exit
 and came back to parent acity. So how to set timer for subactivity??

 Please help.

 Thanks,

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

2009-05-27 Thread Ask

one observation :

Whenever I am puling a file from emulator using DDMS fileexplorer /
data/app , one process is created in which file explorer window is
continuosly refreshed and emulator remains engaged. So I could not run
any application on that instance.

   To run a new application, I have to close this emulator instance
and create a new instance again.

   What can be the problem??

Please help.

regards,
Asif.

On May 26, 10:58 am, Asif k asifk1...@gmail.com wrote:
 Hi all,

    In the DDMS, I had used FileExplorer and visited /data/app folder
 to see the .apk files installed in the emulator. After that I had
 minimized the data folder and thus stopped that process.

   But I am observing that this /data/app folder is opening again and
 again automatically. I dont know what is the reason and how to stop
 it.

   Please help..

 Thanks,

 Asif
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: DexClassLoader caould not invoke method from another application properly

2009-05-14 Thread Ask

Hi Dianne,

Thanks a lot for your suggestion. Problem has been solved as I had
passed the Context of the application as an argument of invoked method
display().

Regards,

Asif

On May 14, 10:22 am, Dianne Hackborn hack...@android.com wrote:
 You seem to be passing in a bad ContextWrapper that somehow has a null base
 pointer:

 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...

   85     public Toast(Context context) {

   86         mContext = context;

   87         mTN = new TN(context);

   88         mY = context.getResources().getDimensionPixelSize(

   89                 com.android.internal.R.dimen.toast_y_offset);

   90     }

 http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...

   76     @Override

   77     public Resources getResources()

   78     {

   79         return mBase.getResources();

   80     }





 On Wed, May 13, 2009 at 9:34 PM, Ask asifk1...@gmail.com wrote:

  Fadden,

    It throws these exceptions only when  I tried to create any UI
  component like Toast message or invoking phone dialer inents etc.  It
  executes nicely when I just tried to print a log message or created
  MediaPlayer and playing a song    .

   So my conclusion is that It throws NullPointerException only when
  invoked code has a UI component.

   Note: same thing I had tried using the normal desktop java
  application using swing and excuted nicely with UI component also. So
  Is this a bug in android or some other way to do it.

  Thanks,

  Asif

  On May 14, 3:28 am, fadden fad...@android.com wrote:
   On May 13, 8:05 am, Asif k asifk1...@gmail.com wrote:

   I had used DexClassLoader to execute the code of other application
dynamically. I am calling method display() of another application from
my application. The display() method will just show the Toast pop up.
   [...]
05-13 20:10:22.336: WARN/System.err(773): Caused by:
java.lang.NullPointerException
05-13 20:10:22.466: WARN/System.err(773):     at
android.content.ContextWrapper.getResources(ContextWrapper.java:79)
05-13 20:10:22.466: WARN/System.err(773):     at
android.widget.Toast.init(Toast.java:88)
05-13 20:10:22.477: WARN/System.err(773):     at
android.widget.Toast.makeText(Toast.java:230)
05-13 20:10:22.485: WARN/System.err(773):     ... 25 more

Please Help. Am I missing something??

   Looks like it was doing something and then hit a null pointer
   exception?

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

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.- Hide quoted text -

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



[android-developers] Re: DexClassLoader caould not invoke method from another application properly

2009-05-13 Thread Ask

Fadden,

   It throws these exceptions only when  I tried to create any UI
component like Toast message or invoking phone dialer inents etc.  It
executes nicely when I just tried to print a log message or created
MediaPlayer and playing a song.

  So my conclusion is that It throws NullPointerException only when
invoked code has a UI component.

  Note: same thing I had tried using the normal desktop java
application using swing and excuted nicely with UI component also. So
Is this a bug in android or some other way to do it.

Thanks,

Asif

On May 14, 3:28 am, fadden fad...@android.com wrote:
 On May 13, 8:05 am, Asif k asifk1...@gmail.com wrote:

     I had used DexClassLoader to execute the code of other application
  dynamically. I am calling method display() of another application from
  my application. The display() method will just show the Toast pop up.
 [...]
  05-13 20:10:22.336: WARN/System.err(773): Caused by:
  java.lang.NullPointerException
  05-13 20:10:22.466: WARN/System.err(773):     at
  android.content.ContextWrapper.getResources(ContextWrapper.java:79)
  05-13 20:10:22.466: WARN/System.err(773):     at
  android.widget.Toast.init(Toast.java:88)
  05-13 20:10:22.477: WARN/System.err(773):     at
  android.widget.Toast.makeText(Toast.java:230)
  05-13 20:10:22.485: WARN/System.err(773):     ... 25 more

  Please Help. Am I missing something??

 Looks like it was doing something and then hit a null pointer
 exception?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Running two applications in the same process

2009-05-12 Thread Ask

Hello Neil,

the same thing I had done. I had given the same
android:sharedUserId= hii.hello  in the manifest of the both the
application as well as same android:process = guide.android  in both
the manifests. But could not get the expected result.

Is the anything more to be done to run both the applications in
the same process?? How to check that they are running in the same
process?

Thanks,

Asif

On May 12, 5:49 pm, Neil neilb...@gmail.com wrote:
 To answer the first question, read the manual:

 http://developer.android.com/guide/topics/manifest/application-elemen...

 By setting this attribute to a process name that's shared with another
 application, you can arrange for components of both applications to
 run in the same process — but only if the two applications also share
 a user ID and be signed with the same certificate.

 I didn't understand the how part of your question - just do it.

 Neil

 On May 12, 1:50 pm, Asif k asifk1...@gmail.com wrote:



  Hi all,

     I want to run two different android applications in the single
  process to access the resources. For that purpose, I had made
  following two changes in the manifest file of both the application ,

  I had override two attributes and

  1) android:sharedUserId= hii.hello under manifest tag
  2) android:process = guide.android under application tag

    I had made these changes (asign the same values) in the both the
  applications but could not get expected results. How to check whether
  both these applications are running in the same process??

    Should I sign both the application with the same certificate?? If
  yes, then can you please tell how??

  Thanks,
  Asif.- Hide quoted text -

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



[android-developers] Re: Invoking one apk from another

2009-05-07 Thread Ask

Thanks for your reply.

   Actually I want to call one method abc() which resides in the other
application(PhoneDialer.apk) from my application (TestApp.apk) and
that PhoneDialer application resides in the /data/app-private
directory (means this application is not installed in the device) .
This method abc() will invoke a phone dialer application using intents
as per below.

public void abc(){
Intent CallIntent = new 
Intent(Intent.ACTION_CALL,Uri.parse(tel:+
25522059));
startActivity(CallIntent);

}
   Using the pathloader and reflection APIs I am able to call the
fuction abc() from TestApp activity but I could not able to invoke
this phoneDialer intent. It throws InvokeException and
NullPointerException.

   Can you please tell what more should I do like android:export or
binder to accomplish this task.?? please help.


Thanks,
Asif

On May 7, 9:50 pm, Marco Nelissen marc...@android.com wrote:
 What do you mean by invoking an apk? An APK file is essentially a zip
 file, normally used to package android applications, and contains the code
 and resources for any number of activities, services, broadcastreceivers,
 etcetera.
 Do you want to run an activity from that other apk? Run a service? Trigger a
 broadcastreceiver?
 In any case, you're going to have to install that apk on the system first,
 just like you would install any other application. Once that is done, you
 can run the activity/service/etc the same way you would normally do, e.g. by
 calling startActivity, bindService, sendBroadcast, etc.



 On Thu, May 7, 2009 at 7:37 AM, Asif k asifk1...@gmail.com wrote:

  Hi all,

    I want to invoke musicplayer.apk(this .apk I have already created
  and working fine) application from my current application
  programmatically. Can anyone please suggest me how to export
  musicplayer.apk and the steps to accomplish this task?

    Please help. Thanks in advance.- Hide quoted text -

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



[android-developers] Re: Playing a .mp3 file using View Intent

2009-05-05 Thread Ask

Hi MrChaz,

Thanks for your help. I changed it and its working now.

regards,

Asif

On May 5, 3:55 pm, MrChaz mrchazmob...@googlemail.com wrote:
 it's audio/mp3 not /audio/mp3

 On May 5, 11:27 am, Asif k asifk1...@gmail.com wrote:



  Hi all,

     I want to play a mp3 file which is stored in the /sdcard/ using
  ACTION_VIEW intent and I used following code to accomplish that, but I
  got ActivityNotFound Exception..

  Intent intent = new Intent(android.content.Intent.ACTION_VIEW);

          Uri data = Uri.parse(file:///sdcard/abc_xyz.mp3);
          intent.setDataAndType(data,/audio/mp3);

          try {
                    startActivity(intent);
             } catch (ActivityNotFoundException e) {
                    e.printStackTrace();

             }

  But I got the following exception,

  05-05 15:44:40.563: WARN/System.err(5253):
  android.content.ActivityNotFoundException: No Activity found to handle
  Intent { action=android.intent.action.VIEW data=file:///sdcard/Main
  Agar Kahoon.mp3 type=/audio/mp3 }
  05-05 15:44:40.582: WARN/System.err(5253):     at
  android.app.Instrumentation.checkStartActivityResult
  (Instrumentation.java:1471)
  05-05 15:44:40.582: WARN/System.err(5253):     at
  android.app.Instrumentation.execStartActivity(Instrumentation.java:
  1441)
  05-05 15:44:40.593: WARN/System.err(5253):     at
  android.app.Activity.startActivityForResult(Activity.java:2526)
  05-05 15:44:40.602: WARN/System.err(5253):     at
  android.app.Activity.startActivity(Activity.java:2570)
  05-05 15:44:40.602: WARN/System.err(5253):     at
  test.mp3file.MusicTest.onCreate(MusicTest.java:25)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
  1122)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
  2104)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
  2157)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.ActivityThread.access$1800(ActivityThread.java:112)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.os.Handler.dispatchMessage(Handler.java:88)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.os.Looper.loop(Looper.java:123)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  android.app.ActivityThread.main(ActivityThread.java:3739)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  java.lang.reflect.Method.invokeNative(Native Method)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  java.lang.reflect.Method.invoke(Method.java:515)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
  (ZygoteInit.java:739)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
  05-05 15:44:40.612: WARN/System.err(5253):     at
  dalvik.system.NativeStart.main(Native Method)

     In fact I used this approach to play file, because I want the
  internal music application with Gui buttons on the display  during
  playback. Is it possible to call the internal music application when
  we play with the MediaPlayer object ??

  Please help. Thanks in advance.

  Asif- Hide quoted text -

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



[android-developers] Re: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-22 Thread Ask

Hi Dianne,

 Please respond.

On Apr 21, 6:27 pm, Ask asifk1...@gmail.com wrote:
 executing code from the SD card is a security hole for your app, no
 matter how short a time you have the code there.

   now I am successful in writing file in the /data/app-private/ dir
 rather than /sdcard. So one problem is solved.

    but still I cant invoke intents in the method which is called
 dynamically using PathClassLoader.

    If android does not support dynamic loading of classes from another
 application  then my question to google engineers is that why You have
 provided the APIs like PathClassLoader , DexClassLoader and DexFile??

    why the variables (which are defined outside the invoked method but
 inside the loaded class) throwing null pointer exception and why the
 problem occurs with intents( which are used in the invoked method)
 gives null pointer exception at startActivity(intent); line. Is there
 anyway to solve this problem.

     My aim is to send the .apk files dynamically from the desktop
 using socket communication and execute one method in this .apk at
 runtime . After executing this methos I will delete this .apk file.

 Thanks,
 Asif

 On Apr 20, 1:13 pm, Dianne Hackborn hack...@android.com wrote:



  On Sun, Apr 19, 2009 at 3:37 AM, Ask asifk1...@gmail.com wrote:
   I am writing the file in the /sdcard using the application
   programmatically and the same file I am deleting when its work has been
   done. Same thing I had tried in the /data/app-private file but I could not
   write the file prgrammatically.. Is there any way to write in the private
   dir programmatically using changing permissions??

  I am having a lot of trouble visualizing what you are trying to do, but if
  you are getting in to situations where you are trying to write to an app
  directory with a different UID, you really need to step back and rethink
  what you are doing.

  Also, executing code from the SD card is a security hole for your app, no
  matter how short a time you have the code there.

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

  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see and
  answer them.- Hide quoted text -

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



[android-developers] Re: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-21 Thread Ask



executing code from the SD card is a security hole for your app, no
matter how short a time you have the code there.

  now I am successful in writing file in the /data/app-private/ dir
rather than /sdcard. So one problem is solved.

   but still I cant invoke intents in the method which is called
dynamically using PathClassLoader.

   If android does not support dynamic loading of classes from another
application  then my question to google engineers is that why You have
provided the APIs like PathClassLoader , DexClassLoader and DexFile??

   why the variables (which are defined outside the invoked method but
inside the loaded class) throwing null pointer exception and why the
problem occurs with intents( which are used in the invoked method)
gives null pointer exception at startActivity(intent); line. Is there
anyway to solve this problem.

My aim is to send the .apk files dynamically from the desktop
using socket communication and execute one method in this .apk at
runtime . After executing this methos I will delete this .apk file.

Thanks,
Asif


On Apr 20, 1:13 pm, Dianne Hackborn hack...@android.com wrote:
 On Sun, Apr 19, 2009 at 3:37 AM, Ask asifk1...@gmail.com wrote:
  I am writing the file in the /sdcard using the application
  programmatically and the same file I am deleting when its work has been
  done. Same thing I had tried in the /data/app-private file but I could not
  write the file prgrammatically.. Is there any way to write in the private
  dir programmatically using changing permissions??

 I am having a lot of trouble visualizing what you are trying to do, but if
 you are getting in to situations where you are trying to write to an app
 directory with a different UID, you really need to step back and rethink
 what you are doing.

 Also, executing code from the SD card is a security hole for your app, no
 matter how short a time you have the code there.

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

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ConditionVariable Usage

2009-04-21 Thread Ask

Please help on this.

Thanks

On Apr 21, 5:45 pm, Asif k asifk1...@gmail.com wrote:
 Hi,

 I'm trying to use a ConditionVariable to control the execution
 sequence of two threads. I can create a ConditionVariable in one
 thread and block on it. But I would like to be able to access it from
 another Thread  and unblock it from that thread.. ?

    Blocked Thread i am planning to keep as GUI thread and it should
 update the messages which are sent by b/g thread on the screen during
 its block state and will be unblocked by b/g thread in the end by
 calling open(); method.

   Can you please the proper way to accomplish this??

 Thanks,
 Asif
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-20 Thread Ask

Can DexClassLoader solve this above problem?? I have not downloaded
early look sdk yet.. Will The application which is running on sdk 1.0
run on 1.5 without an problem??

On Apr 19, 3:37 pm, Ask asifk1...@gmail.com wrote:
 fadden,

  but rather why are you getting the

 NullPointerException.

     I am getting null pointer exception due to the variables which are
 defined outside the Method which is to be invoked but inside the
 activity. If I will define the same variable inside the method..
 application works nicely. If I am invoking intent in the method then
 it is throwing same exception at startAcitivity(intent). Can
 DexclassLoader fix all this problems??

 Presumably you are running as root, and/or have changed the
 permissions on /data/dalvik-cache.

   I could not understand this.Can you please clearify.. Yes I had
 changed the permissions of the /data/dalvik-cache

 I am writing the file in the /sdcard using the application programmatically 
 and the same file I am deleting when its work has been done. Same thing I 
 had tried in the /data/app-private file but I could not write the file 
 prgrammatically.. Is there any way to write in the private dir 
 programmatically using changing permissions??

 On Apr 18, 12:45 am, fadden fad...@android.com wrote:



  On Apr 17, 6:24 am, Ask asifk1...@gmail.com wrote:

   The application will be residing in the /sdcard/ and I am loading it
   dynamically using PathClassLoader API.
   and using Method.invoke() function I am invoking the method residing
   in that class.

  Presumably you are running as root, and/or have changed the
  permissions on /data/dalvik-cache.

  If you have the 1.5 early look SDK, you can start using
  DexClassLoader, which allows you to choose where the output of
  dexopt will go.  You should probably use the app's private storage
  area on /data rather than /sdcard if that's feasible.- Hide quoted text -

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



[android-developers] Re: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-19 Thread Ask

fadden,

 but rather why are you getting the
NullPointerException.


I am getting null pointer exception due to the variables which are
defined outside the Method which is to be invoked but inside the
activity. If I will define the same variable inside the method..
application works nicely. If I am invoking intent in the method then
it is throwing same exception at startAcitivity(intent). Can
DexclassLoader fix all this problems??


Presumably you are running as root, and/or have changed the
permissions on /data/dalvik-cache.

  I could not understand this.Can you please clearify.. Yes I had
changed the permissions of the /data/dalvik-cache

I am writing the file in the /sdcard using the application programmatically 
and the same file I am deleting when its work has been done. Same thing I had 
tried in the /data/app-private file but I could not write the file 
prgrammatically.. Is there any way to write in the private dir 
programmatically using changing permissions??





On Apr 18, 12:45 am, fadden fad...@android.com wrote:
 On Apr 17, 6:24 am, Ask asifk1...@gmail.com wrote:

  The application will be residing in the /sdcard/ and I am loading it
  dynamically using PathClassLoader API.
  and using Method.invoke() function I am invoking the method residing
  in that class.

 Presumably you are running as root, and/or have changed the
 permissions on /data/dalvik-cache.

 If you have the 1.5 early look SDK, you can start using
 DexClassLoader, which allows you to choose where the output of
 dexopt will go.  You should probably use the app's private storage
 area on /data rather than /sdcard if that's feasible.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-17 Thread Ask

Mark,

The application will be residing in the /sdcard/ and I am loading it
dynamically using PathClassLoader API.
and using Method.invoke() function I am invoking the method residing
in that class.

Yes it may violate the model but I need it in my application

If not, are both applications executing as the same user ID and in the
same process?

  both are different application and I think both have different user
IDs. Is there any way to run both application as the same userID and
in the same process.???

Regards,

Asif
On Apr 17, 6:04 pm, Mark Murphy mmur...@commonsware.com wrote:
     I am calling a method of another .apk file dynamically at runtime
  in my application. I can execute it successfully if method does not
  contain any variable which is defined outside of that method.

 Are you using remote services?

 If not, are both applications executing as the same user ID and in the
 same process?

 If not, how are you doing this, since it seems to violate the Android
 security model?

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ 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] Re: java.lang.reflect.InvocationTargetException during calling a function of another application at runtime

2009-04-17 Thread Ask

means that exception is coming due to different user IDs??

why cant that method use any variable of the activity??


  Regarding Loading and ulloading of .apk in the /sdcard, I am making
sure to put it in the card only when I am executing my application and
after competion of my application I am deleting it from /sdcard
programmatically.

Please give any idea to get rid of that exception...

On Apr 17, 6:44 pm, Mark Murphy mmur...@commonsware.com wrote:
  The application will be residing in the /sdcard/ and I am loading it
  dynamically using PathClassLoader API.
  and using Method.invoke() function I am invoking the method residing
  in that class.

 Do not do that unless you have some means of ensuring that the code you
 are loading off that SD card is your code, and not some piece of malware.

    both are different application and I think both have different user
  IDs. Is there any way to run both application as the same userID and
  in the same process.???

 http://developer.android.com/guide/topics/manifest/application-elemen...

 http://developer.android.com/guide/topics/manifest/manifest-element.h...

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ 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] Re: C\C++ support for application level

2009-04-16 Thread Ask



Please give some suggestions..

On Apr 15, 5:35 pm, Asif k asifk1...@gmail.com wrote:
 Hi,

    I want to ask to google engineers that whether future sdk releases
 will provide any C\C++ support for application developement?? If no..
 then Can you please tell me the disadvantage of these languages??

   As per my knowledge and experience, runtime environment is not
 needed to execute C\C++ application. So why cant we directly run any
 application which is written in C\C++?? Is there any way to bypass DVM
 to execute a code?? Core android librarys are C\C++ only...

 Regardz,

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

2009-04-09 Thread Ask

yess, I got it using setSelection() method

On Apr 9, 2:53 pm, Ask asifk1...@gmail.com wrote:
 Hi Jef,

 Thanks 4 ur reply.
 Its working fine 4 EditText..

 But here there is no API to set cursor position like
 EditText.setcursorPosition(),

 I am updating EditText at different stages of application execution
 programatically using EditText.append();
 But cursor position is remaining at the first line only. I want cursor
 to be visible at the end..

 Is there anyway to accomplish it??

 On Apr 9, 12:11 pm, Jeffrey Sharkey jeffrey.shar...@gmail.com wrote:



  This might be a difference between how TextView and EditText behave.
  If you're trying to let them edit text, use an EditText.  :)

  j

  On Apr 8, 11:42 pm, Asif k asifk1...@gmail.com wrote:

   Hi all,

       In the android reference site, it is written in the
   serCursorVisible section that cursor is visible by default and you can
   give its value as either true or false to change the its visibility
   on the GUI screen.

      But in my case , cursor is remaining invisible irrespective of
   setting the visibility true or false using android:cursorVisible =
   true  in the layout/main.xml.

      Should I do something more to make cursor visible on the GUI screen
   or its a bug in android???

   Please respond...

   regardz,

   Asif- Hide quoted text -

  - Show quoted text -- Hide quoted text -

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



[android-developers] Re: setCursorVisible in the TextView

2009-04-09 Thread Ask

Hi Jef,

Thanks 4 ur reply.
Its working fine 4 EditText..

But here there is no API to set cursor position like
EditText.setcursorPosition(),

I am updating EditText at different stages of application execution
programatically using EditText.append();
But cursor position is remaining at the first line only. I want cursor
to be visible at the end..

Is there anyway to accomplish it??

On Apr 9, 12:11 pm, Jeffrey Sharkey jeffrey.shar...@gmail.com wrote:
 This might be a difference between how TextView and EditText behave.
 If you're trying to let them edit text, use an EditText.  :)

 j

 On Apr 8, 11:42 pm, Asif k asifk1...@gmail.com wrote:



  Hi all,

      In the android reference site, it is written in the
  serCursorVisible section that cursor is visible by default and you can
  give its value as either true or false to change the its visibility
  on the GUI screen.

     But in my case , cursor is remaining invisible irrespective of
  setting the visibility true or false using android:cursorVisible =
  true  in the layout/main.xml.

     Should I do something more to make cursor visible on the GUI screen
  or its a bug in android???

  Please respond...

  regardz,

  Asif- Hide quoted text -

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



[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Ask

Hi all,

Thanks 4 ur reply.

Actually I want to call some methods of one Activity
(test.check.Test1.java) from another activity (my current activity) at
runtime in the separate Thread. In the main GUI  Thread this works
fine.

This Test1.java activity resides in the test.check.apk file which is
stored in the /sdcard. This is simply activity class with only one
function xyz() (which I want to call) and returns a String Hellooo
Man as follows

package test.check;

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

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

public String xyz(){
return Hellooo Man;
}
}.

But during the execution of this function from another activity
(another .apk) at runtime in the separate Thread causes exception at
this line

Object o = c.newInstance();

which I came to know during debugging , otherwise class is Loaded
nicely and also loaded method xyz() without any problem.
But to execute that method I need to create Obect instance and then
Method.invoke(o);

I hope u got it now.

Dianne:: Exception race is as follows,

04-08 11:57:08.802: ERROR/AndroidRuntime(240): Uncaught handler:
thread Thread-8 exiting due to uncaught exception
04-08 11:57:08.812: ERROR/AndroidRuntime(240):
java.lang.RuntimeException: Can't create handler inside thread that
has not called Looper.prepare()
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
android.os.Handler.init(Handler.java:111)
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
android.app.Activity.init(Activity.java:660)
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
test.check.Test1.init(Test1.java:6)
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
java.lang.Class.newInstance(Native Method)
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
android.giude.SocketFTP.SocketFTP.readTheFile(SocketFTP.java:128)
04-08 11:57:08.812: ERROR/AndroidRuntime(240): at
android.giude.SocketFTP.SocketFTP$1.run(SocketFTP.java:50)


Mariano : I have not used Looper.prepare(),
 Is it required?? If yes then where and how to define
handler for that?
On Apr 7, 10:20 pm, Dianne Hackborn hack...@android.com wrote:
 Also you need to look at the exception stack trace.  It will show you who is
 trying to create a Handler.

 On Tue, Apr 7, 2009 at 9:44 AM, Streets Of Boston
 flyingdutc...@gmail.comwrote:







  But do you want a Looper and Handler in your thread 't'?
  Why do you load it in another thread?
  Are you planning in dispatching and handling messages in this thread
  't'?

  If not, don't start adding all this stuff just to make the run-time
  happy.

  Put a breakpoint in your default constructor of your test.check.Test1
  class and see which line of code needs a Handler or Looper.

  What are you trying to accomplish? It looks like you're trying to load
  and construct a class from an APK (check.apk). Are you initializing an
  Activity from this APK called 'Test1'? If so, I understand why it may
  need a looper/handler. But if you're loading an Activity (Test1)
  within another Activity (the one trying to load check.apk), you may
  get into a heap of other trouble. But i'm not an expert on this at
  all. Google engineers will know much more about this.

  On Apr 7, 10:55 am, Ask asifk1...@gmail.com wrote:
   Hi Streets,

   I dont think this is the case.

   Same code executes nicely If I call that method in the onCreate()
   method (i.e. main thread itself)

   problem occurs in the Object creation if I will call this method
   readTheFile() in the Thread.
   Can you give any info. regarding how I can define Looper and Handler
   in my code to execute it without any error.???

   On Apr 7, 7:00 pm, Streets Of Boston flyingdutc...@gmail.com wrote:

It could be that during the construction of class test.check.Test1, a
Handler or something similar (i.e. something needing the main-thread's
message-queue) is constructed. Look at your test.check.Test1
implementation and see if this is the case.

If this is the case, you will get an exception if the constructor of
test.check.Test1 is executed on any other thread than the main-thread
with the message queue.

You would have gotten the same exception if you would have called 'new
test.check.Test1()'.

On Apr 7, 9:17 am, Ask asifk1...@gmail.com wrote:

 Is there any handler needed for that?? Any Idea???

 On Apr 7, 3:58 pm, Ask asifk1...@gmail.com wrote:

  Hi,

  I am using Reflection APIs in the background thread to call a
  method
  dynamically from another application but I am getting the
  Exception:

  java.lang.RuntimeException: Can't create handler inside thread
  that
  has not called Looper.prepare() 

  at a line : Object o = c.newInstance();

  my code in the Thread

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Ask

yess right, in short i was trying to instantiate a view comp.
Still not clear logic for using Looper.
might be Google engineers can answer this.

On Apr 8, 6:14 pm, Mariano Kamp mariano.k...@gmail.com wrote:
 Glad it works.

 Well, what you were trying to instantiate was a View Component, weren't you?
 I don't think it matters that you were using reflection for it.Why a view
 component needs the looper before it is attached to an active Window, I
 don't know.



 On Wed, Apr 8, 2009 at 2:31 PM, Ask asifk1...@gmail.com wrote:

  It works nice after I had added only one line : Looper.prepare(); in
  the begining of the
  public void run(); method.

  But still I could not understand,

  How Looper.prepare(); provides a handler to Object o = c.newInstance
  (); Line???

  In short, got the solution but wants some clearification.

  Regards,
  Asif

  On Apr 8, 11:44 am, Ask asifk1...@gmail.com wrote:
   Hi all,

   Thanks 4 ur reply.

   Actually I want to call some methods of one Activity
   (test.check.Test1.java) from another activity (my current activity) at
   runtime in the separate Thread. In the main GUI  Thread this works
   fine.

   This Test1.java activity resides in the test.check.apk file which is
   stored in the /sdcard. This is simply activity class with only one
   function xyz() (which I want to call) and returns a String Hellooo
   Man as follows

   package test.check;

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

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

       public String xyz(){
           return Hellooo Man;
       }

   }.

   But during the execution of this function from another activity
   (another .apk) at runtime in the separate Thread causes exception at
   this line

   Object o = c.newInstance();

   which I came to know during debugging , otherwise class is Loaded
   nicely and also loaded method xyz() without any problem.
   But to execute that method I need to create Obect instance and then
   Method.invoke(o);

   I hope u got it now.

   Dianne:: Exception race is as follows,

   04-08 11:57:08.802: ERROR/AndroidRuntime(240): Uncaught handler:
   thread Thread-8 exiting due to uncaught exception
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):
   java.lang.RuntimeException: Can't create handler inside thread that
   has not called Looper.prepare()
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   android.os.Handler.init(Handler.java:111)
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   android.app.Activity.init(Activity.java:660)
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   test.check.Test1.init(Test1.java:6)
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   java.lang.Class.newInstance(Native Method)
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   android.giude.SocketFTP.SocketFTP.readTheFile(SocketFTP.java:128)
   04-08 11:57:08.812: ERROR/AndroidRuntime(240):     at
   android.giude.SocketFTP.SocketFTP$1.run(SocketFTP.java:50)

   Mariano : I have not used Looper.prepare(),
                Is it required?? If yes then where and how to define
   handler for that?
   On Apr 7, 10:20 pm, Dianne Hackborn hack...@android.com wrote:

Also you need to look at the exception stack trace.  It will show you
  who is
trying to create a Handler.

On Tue, Apr 7, 2009 at 9:44 AM, Streets Of Boston
flyingdutc...@gmail.comwrote:

 But do you want a Looper and Handler in your thread 't'?
 Why do you load it in another thread?
 Are you planning in dispatching and handling messages in this thread
 't'?

 If not, don't start adding all this stuff just to make the run-time
 happy.

 Put a breakpoint in your default constructor of your test.check.Test1
 class and see which line of code needs a Handler or Looper.

 What are you trying to accomplish? It looks like you're trying to
  load
 and construct a class from an APK (check.apk). Are you initializing
  an
 Activity from this APK called 'Test1'? If so, I understand why it may
 need a looper/handler. But if you're loading an Activity (Test1)
 within another Activity (the one trying to load check.apk), you may
 get into a heap of other trouble. But i'm not an expert on this at
 all. Google engineers will know much more about this.

 On Apr 7, 10:55 am, Ask asifk1...@gmail.com wrote:
  Hi Streets,

  I dont think this is the case.

  Same code executes nicely If I call that method in the onCreate()
  method (i.e. main thread itself)

  problem occurs in the Object creation if I will call this method
  readTheFile() in the Thread.
  Can you give any info. regarding how I can define Looper and
  Handler
  in my code to execute

[android-developers] Re: Server/Client in different machines

2009-04-07 Thread Ask

Can you send the exception you are getting or some code snippets,

it can be some io exception...

On Apr 7, 4:58 pm, Lillian Brandão lbrolive...@gmail.com wrote:
 I've already done at the server machines:
 redir add tcp:7000:7000.

 --
 Lillian Brandão



 On Tue, Apr 7, 2009 at 8:47 AM, Ask asifk1...@gmail.com wrote:

  Have you done port forwarding at server machine??

  Any message which is coming to the server should be redirected towards
  the emulator port : 7000

  On Apr 7, 4:35 pm, Lillian Brandão lbrolive...@gmail.com wrote:
   Hi all,

   I have an application client/server and I want to install this
  application
   in differente machines. The server is located in IP_SERVER, listening
  port
   7000.
   I want to start a cliente in another machine with IP_Y and connect to the
   server on the different machine.

   I've started the server and I've created the socket like this:
   ... new ServerSocket(7000);

   I've started the client and I've created the socket like this:
   ...new Socket(SERVER_IP, 7000)

   But the client did not connect to the server. I've already set the
   INTERNET_PERMISSION.
   Any suggestions how to do it?
   Anybody else have already done a client/server application that
  communicate
   between differente machines?

   Thanks in advance,
   Lillian Brandão.- Hide quoted text -

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



[android-developers] Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Ask

Hi,

I am using Reflection APIs in the background thread to call a method
dynamically from another application but I am getting the Exception:

java.lang.RuntimeException: Can't create handler inside thread that
has not called Looper.prepare() 

at a line : Object o = c.newInstance();

my code in the Thread is as follows,
onCreate

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);


hh_text = (TextView)findViewById(R.id.server_start);


Thread t = new Thread()
{
public void run()
{
readTheFile();



}

};
t.start();
}


public void readTheFile() {
try {

 PathClassLoader loader = new PathClassLoader( /sdcard/
test.check.apk, ClassLoader.getSystemClassLoader());
 Class c = null;

 c = loader.loadClass(test.check.Test1);


  Log.i(See, Test Class Found );

  Method method = c.getMethod(xyz, null);

  Object o = c.newInstance();  // This line throws exception
  String s = (String) method.invoke(o);
  Log.i(See,Got method:  + s);
 } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }


Please help.. If you know the issue.

On Apr 6, 7:14 pm, Ask asifk1...@gmail.com wrote:
 Thanx Mark for your quick reply. I will try it out and get back

 On Apr 6, 6:49 pm, Mark Murphy mmur...@commonsware.com wrote:



  Asif k wrote:
      But in my case, I am getting all 3 messages at a time after
   activity execution completed.

  That is probably because you are doing long-running work on the UI thread.

   Is there any API available, using which
   I can show the status during the execution also.

  Anything long-running should be in a background thread, in the activity
  or wrapped in a service. Then, use Handler or runOnUiThread() or
  something so the background thread can have the UI thread update your
  TextView.

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

  Android App Developer Training:http://commonsware.com/training.html- Hide 
  quoted text -

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



[android-developers] Re: Server/Client in different machines

2009-04-07 Thread Ask

Have you done port forwarding at server machine??

Any message which is coming to the server should be redirected towards
the emulator port : 7000

On Apr 7, 4:35 pm, Lillian Brandão lbrolive...@gmail.com wrote:
 Hi all,

 I have an application client/server and I want to install this application
 in differente machines. The server is located in IP_SERVER, listening port
 7000.
 I want to start a cliente in another machine with IP_Y and connect to the
 server on the different machine.

 I've started the server and I've created the socket like this:
 ... new ServerSocket(7000);

 I've started the client and I've created the socket like this:
 ...new Socket(SERVER_IP, 7000)

 But the client did not connect to the server. I've already set the
 INTERNET_PERMISSION.
 Any suggestions how to do it?
 Anybody else have already done a client/server application that communicate
 between differente machines?

 Thanks in advance,
 Lillian Brandão.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Ask

Is there any handler needed for that?? Any Idea???

On Apr 7, 3:58 pm, Ask asifk1...@gmail.com wrote:
 Hi,

 I am using Reflection APIs in the background thread to call a method
 dynamically from another application but I am getting the Exception:

 java.lang.RuntimeException: Can't create handler inside thread that
 has not called Looper.prepare() 

 at a line : Object o = c.newInstance();

 my code in the Thread is as follows,
 onCreate

 public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         setContentView(R.layout.main);

         hh_text = (TextView)findViewById(R.id.server_start);

         Thread t = new Thread()
                 {
             public void run()
             {
                 readTheFile();

             }

                 };
                 t.start();
             }

 public void readTheFile() {
         try {

                  PathClassLoader loader = new PathClassLoader( /sdcard/
 test.check.apk, ClassLoader.getSystemClassLoader());
                                  Class c = null;

                  c = loader.loadClass(test.check.Test1);

               Log.i(See, Test Class Found );

               Method method = c.getMethod(xyz, null);

               Object o = c.newInstance();  // This line throws exception
               String s = (String) method.invoke(o);
               Log.i(See,Got method:  + s);
              } catch (Exception e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
                 }     }

 Please help.. If you know the issue.

 On Apr 6, 7:14 pm, Ask asifk1...@gmail.com wrote:



  Thanx Mark for your quick reply. I will try it out and get back

  On Apr 6, 6:49 pm, Mark Murphy mmur...@commonsware.com wrote:

   Asif k wrote:
   But in my case, I am getting all 3 messages at a time after
activity execution completed.

   That is probably because you are doing long-running work on the UI thread.

Is there any API available, using which
I can show the status during the execution also.

   Anything long-running should be in a background thread, in the activity
   or wrapped in a service. Then, use Handler or runOnUiThread() or
   something so the background thread can have the UI thread update your
   TextView.

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

   Android App Developer Training:http://commonsware.com/training.html-Hide 
   quoted text -

  - Show quoted text -- Hide quoted text -

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



[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Ask

Hi Streets,

I dont think this is the case.

Same code executes nicely If I call that method in the onCreate()
method (i.e. main thread itself)

problem occurs in the Object creation if I will call this method
readTheFile() in the Thread.
Can you give any info. regarding how I can define Looper and Handler
in my code to execute it without any error.???

On Apr 7, 7:00 pm, Streets Of Boston flyingdutc...@gmail.com wrote:
 It could be that during the construction of class test.check.Test1, a
 Handler or something similar (i.e. something needing the main-thread's
 message-queue) is constructed. Look at your test.check.Test1
 implementation and see if this is the case.

 If this is the case, you will get an exception if the constructor of
 test.check.Test1 is executed on any other thread than the main-thread
 with the message queue.

 You would have gotten the same exception if you would have called 'new
 test.check.Test1()'.

 On Apr 7, 9:17 am, Ask asifk1...@gmail.com wrote:



  Is there any handler needed for that?? Any Idea???

  On Apr 7, 3:58 pm, Ask asifk1...@gmail.com wrote:

   Hi,

   I am using Reflection APIs in the background thread to call a method
   dynamically from another application but I am getting the Exception:

   java.lang.RuntimeException: Can't create handler inside thread that
   has not called Looper.prepare() 

   at a line : Object o = c.newInstance();

   my code in the Thread is as follows,
   onCreate

   public void onCreate(Bundle icicle) {
           super.onCreate(icicle);
           setContentView(R.layout.main);

           hh_text = (TextView)findViewById(R.id.server_start);

           Thread t = new Thread()
                   {
               public void run()
               {
                   readTheFile();

               }

                   };
                   t.start();
               }

   public void readTheFile() {
           try {

                    PathClassLoader loader = new PathClassLoader( /sdcard/
   test.check.apk, ClassLoader.getSystemClassLoader());
                                    Class c = null;

                    c = loader.loadClass(test.check.Test1);

                 Log.i(See, Test Class Found );

                 Method method = c.getMethod(xyz, null);

                 Object o = c.newInstance();  // This line throws exception
                 String s = (String) method.invoke(o);
                 Log.i(See,Got method:  + s);
                } catch (Exception e) {
                           // TODO Auto-generated catch block
                           e.printStackTrace();
                   }     }

   Please help.. If you know the issue.

   On Apr 6, 7:14 pm, Ask asifk1...@gmail.com wrote:

Thanx Mark for your quick reply. I will try it out and get back

On Apr 6, 6:49 pm, Mark Murphy mmur...@commonsware.com wrote:

 Asif k wrote:
     But in my case, I am getting all 3 messages at a time after
  activity execution completed.

 That is probably because you are doing long-running work on the UI 
 thread.

  Is there any API available, using which
  I can show the status during the execution also.

 Anything long-running should be in a background thread, in the 
 activity
 or wrapped in a service. Then, use Handler or runOnUiThread() or
 something so the background thread can have the UI thread update your
 TextView.

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

 Android App Developer 
 Training:http://commonsware.com/training.html-Hidequotedtext -

- Show quoted text -- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -- Hide quoted text -

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



[android-developers] Re: Displaying real time information during the execution of an activity

2009-04-06 Thread Ask

Thanx Mark for your quick reply. I will try it out and get back

On Apr 6, 6:49 pm, Mark Murphy mmur...@commonsware.com wrote:
 Asif k wrote:
     But in my case, I am getting all 3 messages at a time after
  activity execution completed.

 That is probably because you are doing long-running work on the UI thread.

  Is there any API available, using which
  I can show the status during the execution also.

 Anything long-running should be in a background thread, in the activity
 or wrapped in a service. Then, use Handler or runOnUiThread() or
 something so the background thread can have the UI thread update your
 TextView.

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

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: DexClassLoader Feature in the Cupcake

2009-03-25 Thread Ask



   Please respond.. Whether DexFile class can solve this purpose?

On Mar 25, 11:52 am, Asif k asifk1...@gmail.com wrote:
 Hi all,

    Can anyone please provide some information regarding the reflection
 API DexclassLoader, which will be includeed in cupcake release?? In
 the latest development of the cupcake, whether this feature is added
 or still to be done??

    I f already included then any reference which will explain about
 how to download that cupcake source from the repo, compile that source
 and add in the current sdk. I am using windows plateform and running
 the applications on the emulator.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: Launching adb commands programtically from android application

2009-03-20 Thread Ask

Mark,

 Then is there any way to copy one file  xyz.abc.apk from the /sdcard
to /data/app/ folder using the application. Because I want to call it
at the runtime using PathClassLoader but for that .apk file must be in
the /data/app folder.

Regardz,
Asif

On Mar 20, 5:00 pm, Mark Murphy mmur...@commonsware.com wrote:
    Is it possible to launch adb commands programatically from any
  android application?

 No. The adb program runs on your development machine, not a device.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ 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
-~--~~~~--~~--~--~---