[android-beginners] Re: How to call an intent of an installed application

2010-03-26 Thread Dan Liew
To call APN_SETTINGS you would do something like the following:

 Intent test = new Intent();

 test.setAction(android.settings.APN_SETTINGS);
 startActivity(test);

I have only learnt one way to start other intents in my applications
and that is by explicitly referencing the package name and class name.
For example if my package was com.android.mypackage and my class was
Called Super then I would start it with the following code

Intent test = new Intent();
test.setClassName(com.android.mypackage,com.android.mypackage.Super);
startActivity(test);

No doubt there are better ways. You can also get results from
Activities by calling startActivityForResult(intent, intentCode);

In your Android manifest you can setup intents so other applications
can call one of your applications as well although I do not know how
to do this. I advise you take a look at

http://developer.android.com/guide/topics/intents/intents-filters.html

http://developer.android.com/resources/faq/commontasks.html#opennewscreen

Happy programming!

On Mar 26, 9:42 am, rocky84 rocky84 hulkman...@gmail.com wrote:
 Hello all,

 as using the adb shell command adb shell am start -a
 android.settings.APN_SETTINGS
 i can call the APN settigns intent.
 if i installed a new app (say abc.apk) could anybody please let me know how
 can i call the intent
 of that particular application??

 my installed applicationa are stored in location /data/app-private
 thanks in advance

 rocky

-- 
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.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

To unsubscribe from this group, send email to 
android-beginners+unsubscribegooglegroups.com or reply to this email with the 
words REMOVE ME as the subject.


[android-beginners] Re: Importing a class from another project in Eclipse. Application fails to run with ClassNotFoundException

2010-03-17 Thread Dan Liew
Thanks for the reply. Yes my activity is listed in the manifest file.
It's definitely a problem with using 'RectangleDrawer' which is in
another project because if I remove all references to that class from
'HelloAndroid' then it will run without errors.

On Mar 16, 6:10 pm, brucko geoff.bruck...@gmail.com wrote:
  E/AndroidRuntime( 2976): java.lang.RuntimeException: Unable to
  instantiate activity ComponentInfo{com.example.helloandroid/
  com.example.helloandroid.HelloAndroid}:
  java.lang.ClassNotFoundException:
  com.example.helloandroid.HelloAndroid in loader
  dalvik.system.pathclassloa...@44948c38
  E/AndroidRuntime( 2976): Caused by: java.lang.ClassNotFoundException:
  com.example.helloandroid.HelloAndroid in loader
  dalvik.system.pathclassloa...@44948c38

 If you haven't had this run before...Did you remember to put
 HelloAndroid in your manifest?

-- 
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.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Importing a class from another project in Eclipse. Application fails to run with ClassNotFoundException

2010-03-16 Thread Dan Liew
Hi I've be looking all over the internet to find a solution to this
but I haven't seen one posted so here's my problem.

I have two Android projects in Eclipse 'HelloAndroid' and 'cam'. I
wanted to use one of the classes in cam. This Class 'RectangleDrawer'
also has an static nested class called RectangleDrawerCallback which I
also use.

The code in HelloAndroid is as follows:

import com.android.cam.RectangleDrawer;
import com.android.cam.RectangleDrawer.RectangleDrawerCallBack;

//more imports ...

public class HelloAndroid extends Activity implements
RectangleDrawerCallBack   {
/** Called when the activity is first created. */
private static final String TAG = HelloAndroid;
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE); // remove program
title bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); 
//enable fullscreen
super.onCreate(savedInstanceState);
RectangleDrawer test = new RectangleDrawer(this,16,800,480,this);
setContentView(test, new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

}

public void finishedDrawingRectangle(Rect drawnRectangle) {
// TODO Auto-generated method stub
Log.d(TAG,I've drawn rectangle: + 
drawnRectangle.toShortString());
}

}

Eclipse then requested that I add the 'Cam' project to the 'Java Build
Path' so I did this. Okay no build errors so far... I did 'Project 
Clean...' just in case something wasn't update properly.

So then I tried to run the application on my phone (google nexus one)
and the application crashes. The error log is as follows:

D/AndroidRuntime( 2956):
D/AndroidRuntime( 2956):  AndroidRuntime START

D/AndroidRuntime( 2956): CheckJNI is OFF
D/dalvikvm( 2956): Precise GC configured ON
D/dalvikvm( 2956): creating instr width table
D/AndroidRuntime( 2956): --- registering native functions ---
D/ddm-heap( 2956): Got feature list request
D/AndroidRuntime( 2956): Shutting down VM
D/dalvikvm( 2956): DestroyJavaVM waiting for non-daemon threads to
exit
D/dalvikvm( 2956): DestroyJavaVM shutting VM down
D/dalvikvm( 2956): HeapWorker thread shutting down
D/dalvikvm( 2956): HeapWorker thread has shut down
D/jdwp( 2956): JDWP shutting down net...
I/dalvikvm( 2956): Debugger has detached; object registry had 1
entries
D/dalvikvm( 2956): VM cleaning up
E/AndroidRuntime( 2956): ERROR: thread attach failed
D/dalvikvm( 2956): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 2963):
D/AndroidRuntime( 2963):  AndroidRuntime START

D/AndroidRuntime( 2963): CheckJNI is OFF
D/dalvikvm( 2963): Precise GC configured ON
D/dalvikvm( 2963): creating instr width table
D/AndroidRuntime( 2963): --- registering native functions ---
D/ddm-heap( 2963): Got feature list request
D/AndroidRuntime( 2963): Shutting down VM
D/dalvikvm( 2963): DestroyJavaVM waiting for non-daemon threads to
exit
D/dalvikvm( 2963): DestroyJavaVM shutting VM down
D/dalvikvm( 2963): HeapWorker thread shutting down
D/dalvikvm( 2963): HeapWorker thread has shut down
D/jdwp( 2963): JDWP shutting down net...
I/dalvikvm( 2963): Debugger has detached; object registry had 1
entries
D/dalvikvm( 2963): VM cleaning up
E/AndroidRuntime( 2963): ERROR: thread attach failed
D/dalvikvm( 2963): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 2970):
D/AndroidRuntime( 2970):  AndroidRuntime START

D/AndroidRuntime( 2970): CheckJNI is OFF
D/dalvikvm( 2970): Precise GC configured ON
D/dalvikvm( 2970): creating instr width table
D/AndroidRuntime( 2970): --- registering native functions ---
D/ddm-heap( 2970): Got feature list request
I/ActivityManager(   80): Starting activity: Intent
{ act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x1000
cmp=com.example.helloandroid/.HelloAndroid }
D/AndroidRuntime( 2970): Shutting down VM
D/dalvikvm( 2970): DestroyJavaVM waiting for non-daemon threads to
exit
D/dalvikvm( 2970): DestroyJavaVM shutting VM down
D/dalvikvm( 2970): HeapWorker thread shutting down
D/dalvikvm( 2970): HeapWorker thread has shut down
D/jdwp( 2970): JDWP shutting down net...
I/dalvikvm( 2970): Debugger has detached; object registry had 1
entries
D/dalvikvm( 2970): VM cleaning up
E/AndroidRuntime( 2970): ERROR: thread attach failed
I/ActivityManager(   80): Start proc com.example.helloandroid for
activity com.example.helloandroid/.HelloAndroid: pid=2976 uid=10059
gids={}
D/dalvikvm( 2970): LinearAlloc 0x0 used 639500 of 5242880 (12%)
I/WindowManager(   80): Setting rotation to 1, animFlags=0
I/ActivityManager(   80): Config changed: { scale=1.0 imsi=440/20
loc=en_GB touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34}
V/RenderScript_jni(  148): surfaceChanged
V/RenderScript(  148): setSurface 800 442 0x124898
D/ddm-heap( 2976): Got feature list request
I/dalvikvm( 2976): Failed resolving 

[android-beginners] Re: How to rotate a bitmap?

2010-02-09 Thread Dan Liew
You sort of have the right idea but your numbers aren't quite right:

Using points as (x,y) with (0,0) being the top left corner of images:

Your clockface bitmap is 800x480 therefore the centre is at
(400,240)(not (240,400) as you said)
Your clock hand bitmap is 60x140 with your stated centre of rotation
at (30,110)

If you place your clock hand bitmap at (400,240) in the clockface
bitmap the top left pixel (0,0) of your clock hand bitmap will be at
(400,240) which is not what you want as you figured out.

You need to translate along x y to move the clock hand bitmap in to
the correct position. So to have (30,110) of your clock hand bitmap at
(400,240) in the clock face bitmap the clock face bitmap needs to
placed at the following location:

(400 -30, 240 - 110 )   = (370,130)

If you try and draw this on paper it will probably make more sense to
you.

Just a small bit of advice. I'm not sure doing these co-ordinates
explicitly is a good idea as not all phones have a screen resolution
of 800x480. Have a read of 
http://developer.android.com/guide/practices/screens_support.html



On Feb 3, 5:42 pm, BobG bobgard...@aol.com wrote:
 I have a clock in the center of an 800x480 bitmap, and I have a 60x140
 clock hand/dial needle with center of rot at 30,110 in the bitmap. To
 place the center of rotation in the center of the bitmap, do I plave
 the needle bitmap using the top left coord offset 30,100 from the
 center, which is 240,400? Thanks so far. Im stumped.

-- 
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.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: no text displayed on emulator in Hello World program

2009-12-22 Thread Dan Liew
When you say you see the default Android text do you mean you see
this?
http://mobilitysite.com/wp-content/uploads/2007/11/android-boot-thumb.jpg

or

http://www.redmondpie.com/wp-content/uploads/2009/09/AndroidEmulatorforWindows1.png

Because if this is what you're talking about then there may not be a
problem. The two images I referenced earlier are the boot screens so
you may not be waiting long enough for the emulator to boot up (On my
system it takes more than a minute for the emulated android OS to be
running ready to launch an application I've written).

On Nov 16, 1:42 am, cybereality cybereal...@gmail.com wrote:
 I am having the same problem on Eclipse. The 'hello, android' text
 does not show up, even though the program compiles and I followed
 every instruction exactly. The emulator pops up but just shows the
 default android text and nothing happens. Can anyone help?

 On Nov 11, 8:17 pm, Bossco juanbos...@gmail.com wrote:

  Hello, I'm using NetBeans, and I have the same problem, theemulator
  does not show the text.

  I got this error:

  Device's package manager not ready to install new packages

  On Nov 5, 9:59 am, Walker Rowe wer...@walkerrowe.com wrote:

   Hi,

   Following the tutorial I wrote the hello world application shown below
   and eclipse shows the console messages shown at the bottom.  Problem
   is theemulatorlaunched just has normal graphical display and does
   not show the message Hello, Android.

   package com.rosewoodhillfarm.helloandroid;

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

   public class HelloAndroid extends Activity {
       /** Called when the activity is first created. */
       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           TextView tv = new TextView(this);
           tv.setText(Hello, Android);
           setContentView(tv);
       }

   }

   [2009-11-05 12:37:57 - Android Project]--
   [2009-11-05 12:37:57 - Android Project]Android Launch!
   [2009-11-05 12:37:57 - Android Project]adb is running normally.
   [2009-11-05 12:37:57 - Android Project]Performing
   com.rosewoodhillfarm.helloandroid.HelloAndroid activity launch
   [2009-11-05 12:37:57 - Android Project]Automatic Target Mode:
   Preferred AVD 'my_avd' is not available. Launching newemulator.
   [2009-11-05 12:37:57 - Android Project]Launching a newemulatorwith
   Virtual Device 'my_avd'
   [2009-11-05 12:38:01 - Android Project]Newemulatorfound:
  emulator-5554
   [2009-11-05 12:38:01 - Android Project]Waiting for HOME
   ('android.process.acore') to be launched...
   [2009-11-05 12:38:34 - Android Project]HOME is up on device
   'emulator-5554'
   [2009-11-05 12:38:34 - Android Project]Uploading Android Project.apk
   onto device 'emulator-5554'
   [2009-11-05 12:38:34 - Android Project]Installing Android
   Project.apk...
   [2009-11-05 12:38:48 - Android Project]Success!
   [2009-11-05 12:38:48 - Android Project]Starting activity
   com.rosewoodhillfarm.helloandroid.HelloAndroid on device
   [2009-11-05 12:38:56 - Android Project]ActivityManager: Starting:
   Intent { cmp=com.rosewoodhillfarm.helloandroid/.HelloAndroid }

-- 
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.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en