[android-beginners] Re: using an API not in the SDK

2009-03-20 Thread David Turner
There is no procedure; whatever means you find to achieve this would break
when the system is updated over the air with changes that modify/remove the
non-public API
(and believe me, internal changes between releases are *very* numerous).
Then your users will start to hate you and give you 1-star ratings, etc...

On Thu, Mar 19, 2009 at 12:08 AM, AndRaj rajendran.b...@gmail.com wrote:


 Hi All,

 If I want to use non-SDK API. what I wann to do. Is there any
 procedure to do that...

 On Feb 23, 2:28 am, Romain Guy romain...@google.com wrote:
  Don't usenon-SDKAPIs.
 
 
 
  On Sat, Feb 21, 2009 at 8:12 PM, surferdude datruesur...@gmail.com
 wrote:
 
   Hello,
 
   I'm trying to write my first android application which executes
   commands I feed to it on the comandline. I looked through the public
   git repository and found android.os.exec which should meet my needs
   fine, however I noticed that it isn't part of the SDK. When I try to
   add the class to my project and call it via createsubprocess(), it
   compiles fine but i get a force close as soon as it tries to run on
   the emulator or my device. According to the ddms logs, its getting
   stuck at an unsatisfied link error. Below are the three files in my
   project... if anyone could help me out, it would be much appreciated
 
   ---
 
   testapp.java:
 
   ---
 
   package com.android.testapp;
 
   import android.app.Activity;
   import android.os.Bundle;
   import com.android.testapp.exec;
 
   public class testapp extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
 
  exec.createSubprocess(ls,null,null);
  }
 
   }
 
   ---
 
   exec.java
   ---
   package com.android.testapp;
 
   import java.io.FileDescriptor;
 
   /**
* @hide
* Tools for executing commands.  Not for public consumption.
*/
 
   public class exec
   {
  /**
   * @param cmd The command to execute
   * @param arg0 The first argument to the command, may be null
   * @param arg1 the second argument to the command, may be null
   * @return the file descriptor of the started process.
   *
   */
  public static FileDescriptor createSubprocess(
  String cmd, String arg0, String arg1) {
  return createSubprocess(cmd, arg0, arg1, null);
  }
 
  /**
   * @param cmd The command to execute
   * @param arg0 The first argument to the command, may be null
   * @param arg1 the second argument to the command, may be null
   * @param processId A one-element array to which the process ID of
   the
   * started process will be written.
   * @return the file descriptor of the started process.
   *
   */
   public static native FileDescriptor createSubprocess(
  String cmd, String arg0, String arg1, int[] processId);
 
   public static native void setPtyWindowSize(FileDescriptor fd,
 int row, int col, int xpixel, int ypixel);
  /**
   * Causes the calling thread to wait for the process associated
   with the
   * receiver to finish executing.
   *
   * @return The exit value of the Process being waited on
   *
   */
  public static native int waitFor(int processId);
   }
 
   ---
 
   androidmanifest.xml
   ---
 
   ?xml version=1.0 encoding=utf-8?
   manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.android.testapp
android:versionCode=1
android:versionName=1.0.0
  application android:icon=@drawable/icon android:label=@string/
   app_name
  activity android:name=testapp
android:label=@string/app_name
  intent-filter
  action android:name=android.intent.action.MAIN /
  category
   android:name=android.intent.category.LAUNCHER /
  /intent-filter
  /activity
  /application
   /manifest
 
  --
  Romain Guy
  Android framework engineer
  romain...@android.com
 
  Note: please don't send private questions to me, as I don't have time
  to provide private support.  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 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] As the Key is pressed the onKeyDown method is never called

2009-03-20 Thread gganesh

Hi ,
I wrote a custom view where i use onDraw() to apply a color and call
a method insert() to do some modification and call invalidate in
insert() method to redraw ,so onDraw and insert method will be
calling recursively .I wrote a onKeyDown method but this is never
called as i press the relevant key ,i could not figure out the resons
please help me out.

boolean flag = true;
public void onDraw(Canvas c)
{

Paint p=new Paint();
p.setColor(Color.RED);
p.setTextSize(50.0f);
p.setAntiAlias(true);
c.drawARGB(23, 44, 145, 78);
if(flag)
{
c.drawColor(Color.BLUE);
}
else
{
c.drawColor(Color.RED);
}
Log.v(TAG,In onDraw);
c.drawText(hello , 100, 100, p);
insert();
}
public void insert()
{
if(flag)
{
flag=false;
}
else
{
flag=true;
}
 Log.v(TAG,In hello method);
 try {
Thread.sleep(250);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 invalidate();

}
public boolean onKeyDown(int keycode ,KeyEvent ke)
{

if(keycode==KeyEvent.KEYCODE_DPAD_CENTER)
{
Log.v(TAG,In KEY PRESS EVENT);
}
return false;
}
--~--~-~--~~~---~--~~
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] What's the correct way to switch off the emulator?

2009-03-20 Thread anakin

All,

I always close the emulator window to switch off but sometimes I found
emulator process is still hanging there which will get me some error
when I launch another new process. So what's the correct way to switch
off the emulator?

Thanks

--~--~-~--~~~---~--~~
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] ADT download links all dead

2009-03-20 Thread dougal2

Anyone know where to get the ADT eclipse plugin now?

The following are all dead links (404):

https://dl-ssl.google.com/android/eclipse/
http://dl-ssl.google.com/android/eclipse/
http://code.google.com/android/adt_download.html

--~--~-~--~~~---~--~~
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] Connecting via USB - how to use a computer's internet rather than wifi

2009-03-20 Thread G

Hi,

Just curious if I am able to use a computer's Internet connection
whilst connected via USB.  There is no wireless network, so my only
option is to connect the phone to the computer to obtain a connection.

If it is possible, my second question is:

If I were to connect like this, how might I address a webserver
running on the computer?  Using the emulator I would connect via
10.0.2.2, but obviously this won't work once running on the phone, as
the address is not correct for the usb - pc connection.

I hope this makes sense!

Regards,

G

--~--~-~--~~~---~--~~
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: How do I set the value of an EditText

2009-03-20 Thread Lovedumplingx

That's what I thought too but I crash the task every time the activity
that contains this code is started:

EditText userText = (EditText) findViewById(R.id.userText);
userText.setText(userParam);

This is the basic way I thought to have the value set but it crashes
every time.

On Mar 19, 10:53 pm, Isaac Waller ad...@isaacwaller.com wrote:
 A String _is_ a CharSequence. There is no need for a cast.

 On Mar 19, 3:35 pm, Will sem...@gmail.com wrote:

  Cast the String to a CharSequence.

  String x = foo;
 EditTextET;
  ET.setText((CharSequence) x);

  On Mar 19, 10:43 am, Lovedumplingx lovedumpli...@gmail.com wrote:

   Ok...so I've scoured and scoured and played and fiddled but I can't
   figure it out.

   I want to allow the user to set preferences for an application and I
   want the preferences to be displayed in theEditTextarea if/when they
   come back to change them again.

   In my head I'm thinking I would be able to use setText() but no...that
   takes a CharSequence and I have a string and don't know how to make a
   CharSequence (which according to what I've read is supposed to be a
   read-only thing anyway).

   So...does anyone know how to put text into anEditTextfield without
   relying on the XML?  I really want to do this via application
   preferences.

   Thanks.
--~--~-~--~~~---~--~~
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: Display Icons

2009-03-20 Thread deepdr...@googlemail.com

Each activity with
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
in your AndroidManifest.xml will show up in the launcher.
So if you want to see only one icon for one activity in the launcher,
then only that one activity should have the quoted intent filter set.

--
http://www.deepdroid.com

On Mar 20, 12:09 am, moblmojo grantk...@hotmail.com wrote:
 How do you get only one icon to display in the main menu? All of
 my .java files have their own separate icon in the main menu. Is this
 because of the activity or the .java file, or what? They all use the
 same icon, although I have only specified it in the main application
 activity.

 Users can click a different icon and get into the activity without
 going through the main application menu.

 I want one icon displayed only, any help?
--~--~-~--~~~---~--~~
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: Connecting via USB - how to use a computer's internet rather than wifi

2009-03-20 Thread deepdr...@googlemail.com

you do not get IP / internet connection via the USB cable.

--
http://www.deepdroid.com


On Mar 20, 1:29 pm, G g.white...@gmail.com wrote:
 Hi,

 Just curious if I am able to use a computer's Internet connection
 whilst connected via USB.  There is no wireless network, so my only
 option is to connect the phone to the computer to obtain a connection.

 If it is possible, my second question is:

 If I were to connect like this, how might I address a webserver
 running on the computer?  Using the emulator I would connect via
 10.0.2.2, but obviously this won't work once running on the phone, as
 the address is not correct for the usb - pc connection.

 I hope this makes sense!

 Regards,

 G
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---