Wednesday, June 10, 2009

Android API Rotaion 3d

Here the Example Extracted from API Demos

Rotation 3d

package com.dci;

import com.dci.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;

public class Transition3d extends Activity implements
AdapterView.OnItemClickListener, View.OnClickListener
{
private ListView mPhotosList;
private ViewGroup mContainer;
private ImageView mImageView;

// Names of the photos we show in the list
private static final String[] PHOTOS_NAMES = new String[]
{
"Lyon",
"Livermore",
"Tahoe Pier",
"Lake Tahoe",
"Grand Canyon",
"Bodie"
};

// Resource identifiers for the photos we want to display
private static final int[] PHOTOS_RESOURCES = new int[]
{
R.drawable.photo1,
R.drawable.photo2,
R.drawable.photo3,
R.drawable.photo4,
R.drawable.photo5,
R.drawable.photo6
};

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

setContentView(R.layout.animations_main_screen);

mPhotosList = (ListView) findViewById(android.R.id.list);
mImageView = (ImageView) findViewById(R.id.picture);
mContainer = (ViewGroup) findViewById(R.id.container);

// Prepare the ListView
final ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_list_item_1, PHOTOS_NAMES);

mPhotosList.setAdapter(adapter);
mPhotosList.setOnItemClickListener(this);

// Prepare the ImageView
mImageView.setClickable(true);
mImageView.setFocusable(true);
mImageView.setOnClickListener(this);

// Since we are caching large views, we want to keep their cache
// between each animation
mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
}

/**
* Setup a new 3D rotation on the container view.
*
* @param position the item that was clicked to show a picture, or -1 to show the list
* @param start the start angle at which the rotation must begin
* @param end the end angle of the rotation
*/
private void applyRotation(int position, float start, float end) {
// Find the center of the container
final float centerX = mContainer.getWidth() / 2.0f;
final float centerY = mContainer.getHeight() / 2.0f;

// Create a new 3D rotation with the supplied parameter
// The animation listener is used to trigger the next animation
final Rotate3dAnimation rotation =
new Rotate3dAnimation(start, end, centerX, centerY, 310.0f, true);
rotation.setDuration(500);
rotation.setFillAfter(true);
rotation.setInterpolator(new AccelerateInterpolator());
rotation.setAnimationListener(new DisplayNextView(position));

mContainer.startAnimation(rotation);
}

public void onItemClick(AdapterView parent, View v, int position, long id) {
// Pre-load the image then start the animation
mImageView.setImageResource(PHOTOS_RESOURCES[position]);
applyRotation(position, 0, 90);
}

public void onClick(View v) {
applyRotation(-1, 180, 90);
}

/**
* This class listens for the end of the first half of the animation.
* It then posts a new action that effectively swaps the views when the container
* is rotated 90 degrees and thus invisible.
*/
private final class DisplayNextView implements Animation.AnimationListener {
private final int mPosition;

private DisplayNextView(int position) {
mPosition = position;
}

public void onAnimationStart(Animation animation) {
}

public void onAnimationEnd(Animation animation) {p
mContainer.post(new SwapViews(mPosition));
}

public void onAnimationRepeat(Animation animation) {
}
}

/**
* This class is responsible for swapping the views and start the second
* half of the animation.
*/
private final class SwapViews implements Runnable
{
private final int mPosition;

public SwapViews(int position)
{
mPosition = position;
}

public void run() {
final float centerX = mContainer.getWidth() / 2.0f;
final float centerY = mContainer.getHeight() / 2.0f;
Rotate3dAnimation rotation;

if (mPosition > -1) {
mPhotosList.setVisibility(View.GONE);
mImageView.setVisibility(View.VISIBLE);
mImageView.requestFocus();

rotation = new Rotate3dAnimation(90, 180, centerX, centerY, 310.0f, false);
} else {
mImageView.setVisibility(View.GONE);
mPhotosList.setVisibility(View.VISIBLE);
mPhotosList.requestFocus();

rotation = new Rotate3dAnimation(90, 0, centerX, centerY, 310.0f, false);
}

rotation.setDuration(500);
rotation.setFillAfter(true);
rotation.setInterpolator(new DecelerateInterpolator());

mContainer.startAnimation(rotation);
}
}

}


/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.dci;

import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.graphics.Camera;
import android.graphics.Matrix;

public class Rotate3dAnimation extends Animation
{
private final float mFromDegrees;
private final float mToDegrees;
private final float mCenterX;
private final float mCenterY;
private final float mDepthZ;
private final boolean mReverse;
private Camera mCamera;

/**
* Creates a new 3D rotation on the Y axis. The rotation is defined by its
* start angle and its end angle. Both angles are in degrees. The rotation
* is performed around a center point on the 2D space, definied by a pair
* of X and Y coordinates, called centerX and centerY. When the animation
* starts, a translation on the Z axis (depth) is performed. The length
* of the translation can be specified, as well as whether the translation
* should be reversed in time.
*
* @param fromDegrees the start angle of the 3D rotation
* @param toDegrees the end angle of the 3D rotation
* @param centerX the X center of the 3D rotation
* @param centerY the Y center of the 3D rotation
* @param reverse true if the translation should be reversed, false otherwise
*/
public Rotate3dAnimation(float fromDegrees, float toDegrees,
float centerX, float centerY, float depthZ, boolean reverse)
{
mFromDegrees = fromDegrees;
mToDegrees = toDegrees;
mCenterX = centerX;
mCenterY = centerY;
mDepthZ = depthZ;
mReverse = reverse;
}

@Override
public void initialize(int width, int height, int parentWidth, int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
mCamera = new Camera();
}

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final float fromDegrees = mFromDegrees;
float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

final float centerX = mCenterX;
final float centerY = mCenterY;
final Camera camera = mCamera;

final Matrix matrix = t.getMatrix();

camera.save();
if (mReverse) {
camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
} else {
camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
}
camera.rotateY(degrees);
camera.getMatrix(matrix);
camera.restore();

matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}
}



Create One Folder name anim
keep the two file on to that





and save it as layout_bottom_to_top_slide.xml

and one more file




save it as slide_right.xml











save it as a animations_main_screen.xml

onKeyEvent Object Moving in Android Graphics

on Key Event Object Moving example on android

package com.dci.object;

import com.dci.object.DemoGameView.GameThread;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

public class DemoObjectMove extends Activity
{
private static final int MENU_PAUSE = Menu.FIRST;

private static final int MENU_RESUME = Menu.FIRST + 1;

private static final int MENU_START = Menu.FIRST + 2;

private static final int MENU_STOP = Menu.FIRST + 3;

private GameThread mGameThread;

private DemoGameView mGameView;


@Override
public boolean onCreateOptionsMenu(Menu menu)
{
super.onCreateOptionsMenu(menu);

menu.add(0, MENU_START, 0, R.string.menu_start);
menu.add(0, MENU_STOP, 0, R.string.menu_stop);
menu.add(0, MENU_PAUSE, 0, R.string.menu_pause);
menu.add(0, MENU_RESUME, 0, R.string.menu_resume);

return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case MENU_START:
mGameThread.doStart();
return true;
case MENU_STOP:
mGameThread.setState(GameThread.STATE_LOSE);
return true;
case MENU_PAUSE:
mGameThread.pause();
return true;
case MENU_RESUME:
mGameThread.unpause();
return true;
}

return false;
}

/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);


requestWindowFeature(Window.FEATURE_NO_TITLE);


setContentView(R.layout.main);

mGameView =(DemoGameView) findViewById(R.id.game);
mGameThread = mGameView.getThread();

mGameThread.setState(GameThread.STATE_READY);
}

@Override
protected void onPause()
{
super.onPause();

mGameView.getThread().pause();

}
}


View For the Above activity


package com.dci.object;

import com.dci.object.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class DemoGameView extends SurfaceView implements SurfaceHolder.Callback
{

class GameThread extends Thread
{
// States Used In Our Demo Game Object

public static final int STATE_LOSE = 1;
public static final int STATE_PAUSE = 2;
public static final int STATE_READY = 3;
public static final int STATE_RUNNING = 4;
public static final int STATE_WIN = 5;

private int mMode;
private boolean mRun = false;

// Co ordinates

private float x;
private float y;

// To control the Speed the Variable is craeted
private static final int SPEED = 100;

//Movements of the Object Variables
private boolean dRight;
private boolean dLeft;
private boolean dUp;
private boolean dDown;

// Canvas Specs.
private int mCanvasWidth;
private int mCanvasHeight;

private long mLastTime;

private Bitmap mDciObject;

private SurfaceHolder mSurfaceHolder;

//Constructor
public GameThread(SurfaceHolder surfaceHolder, Context context,
Handler handler)
{
mSurfaceHolder = surfaceHolder;
mContext = context;

x = 0;
y = 0;

mDciObject = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.snowflake);

}
//Start The Game
public void doStart()
{
synchronized (mSurfaceHolder)
{
// Initialize game here!

x = 0;
y = 50;

mLastTime = System.currentTimeMillis() + 100;
setState(STATE_RUNNING);
}
}
public void pause()
{
synchronized (mSurfaceHolder)
{
if (mMode == STATE_RUNNING)
setState(STATE_PAUSE);
}
}

@Override
public void run()
{
while (mRun)
{
Canvas c = null;
try
{
c = mSurfaceHolder.lockCanvas(null);
synchronized (mSurfaceHolder)
{
if (mMode == STATE_RUNNING)
updateGame();
doDraw(c);
}
}
finally
{
if (c != null)
{
mSurfaceHolder.unlockCanvasAndPost(c);
}
}
}
}
public void setRunning(boolean b)
{
mRun = b;
}
public void setState(int mode)
{
synchronized (mSurfaceHolder)
{
setState(mode, null);
}
}
public void setState(int mode, CharSequence message)
{
synchronized (mSurfaceHolder)
{
mMode = mode;
}
}
public void setSurfaceSize(int width, int height)
{

synchronized (mSurfaceHolder)
{
mCanvasWidth = width;
mCanvasHeight = height;
}
}
public void unpause()
{
// Move the real time clock up to now
synchronized (mSurfaceHolder)
{
mLastTime = System.currentTimeMillis() + 100;
}
setState(STATE_RUNNING);
}

boolean doKeyDown(int keyCode, KeyEvent msg)
{
boolean handled = false;
synchronized (mSurfaceHolder)
{
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT)
{
dRight = true;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT)
{
dLeft = true;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_UP)
{
dUp = true;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
{
dDown = true;
handled = true;
}
return handled;
}
}
boolean doKeyUp(int keyCode, KeyEvent msg)
{
boolean handled = false;
synchronized (mSurfaceHolder)
{
if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT)
{
dRight = false;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT)
{
dLeft = false;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_UP)
{
dUp = false;
handled = true;
}
if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
{
dDown = false;
handled = true;
}
return handled;
}
}
private void doDraw(Canvas canvas)
{
// empty canvas
canvas.drawARGB(255,0,0,40);

canvas.drawBitmap(mDciObject, x, y, new Paint());
}

private void updateGame()
{

long now = System.currentTimeMillis();

if (mLastTime > now)
return;
double elapsed = (now - mLastTime) / 1000.0;
mLastTime = now;


if (dUp)
y -= elapsed * SPEED;
if (dDown)
y += elapsed * SPEED;
if (y < 0)
y = 0;
else if (y >= mCanvasHeight - mDciObject.getHeight())
y = mCanvasHeight - mDciObject.getHeight();
if (dLeft)
x -= elapsed * SPEED;
if (dRight)
x += elapsed * SPEED;
if (x < 0)
x = 0;
else if (x >= mCanvasWidth - mDciObject.getWidth())
x = mCanvasWidth - mDciObject.getWidth();
}
}
private Context mContext;

private GameThread thread;

public DemoGameView(Context context,AttributeSet atts)
{
super(context,atts);

SurfaceHolder holder = getHolder();
holder.addCallback(this);

thread = new GameThread(holder, context, new Handler()
{
@Override
public void handleMessage(Message m)
{
// Use for pushing back messages.
}
});

setFocusable(true);

}
public GameThread getThread()
{
return thread;
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent msg)
{
return thread.doKeyDown(keyCode, msg);
}

@Override
public boolean onKeyUp(int keyCode, KeyEvent msg)
{
return thread.doKeyUp(keyCode, msg);
}

@Override
public void onWindowFocusChanged(boolean hasWindowFocus)
{
if (!hasWindowFocus)
thread.pause();
}


public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height)
{
thread.setSurfaceSize(width, height);
}


public void surfaceCreated(SurfaceHolder holder)
{

thread.setRunning(true);
thread.start();
}
public void surfaceDestroyed(SurfaceHolder holder)
{

boolean retry = true;
thread.setRunning(false);
while (retry)
{
try
{
thread.join();
retry = false;
}
catch (InterruptedException e)
{
}
}
}

}

Android Graphics Tutorial

How To draw a circle in android?

Follow the Steps U will get how to a draw a circle .........

These is the NewCircle Activity Class

package com.android;

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

public class NewCircle extends Activity
{


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new CircleView(this, 25, 25, 20));

}
}



This is the Circle View Class


package com.android;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

public class CircleView extends View
{

// Variables
private final float x;
private final float y;
private final int r;
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

// Constructor
public CircleView(Context context, float x, float y, int r) {
super(context);
mPaint.setColor(0xFFFF0000);
this.x = x;
this.y = y;
this.r = r;
}

/ canvas onDraw Method for drawing a circle

@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawCircle(x, y, r, mPaint);
}
}

Thursday, February 12, 2009

Convertion

Question

How can I convert my Java classes to an executable .EXE file for Windows?

Answer

This is a very common question asked in the comp.lang.java newsgroup. Its often useful to have an executable application when deploying your applications to a specific platform, but remember to make your .class files available for users running Unix/Macintosh/other platforms.

Microsoft used to provide a free system development kit (SDK), for Java, which includes the jexegen tool.
This will convert class files into a .EXE form. The only disadvantage is that users need a Microsoft Java Virtual Machine (JVM) installed.
Microsoft no longer supports this however, and you should transition to a new Win 32 Java system.
See http://java.sun.com/ for the latest version of a Java interpreter for Winodws.

Though I've not used these tools personally, others have recommended Visual Age for Java, and
Duckware's Java to Windows EXE (Java2Exe) application available from http://www.duckware.com/java2exe/index.html

Jad FAQ .....

FAQ

Q1: Is the source code of Jad available?
A1: Currently I have no plans to release the Jad source code for any purposes including porting to other computer platforms.

Q2: What is the option -dead for?
A2: This option forces Jad to decompile the dead portions of bytecode. For example, non-optimizing compilation of the following code can produce the dead bytecode: if (false)
{
...
}
This option should be on by default, but the incorrect dead bytecode can crash Jad.

Q3: Why does Jad fail to generate the throws clause in the method declarations like the one in int divide(int a, int b) throws DivideByZero { ... } ?
A3: This throws clause is represented in the Java class files by the Exceptions attribute. The Java Virtual Machine itself doesn't use these attributes (well, at least, the common implementations of JVM), so they can be stripped out of the Java class files. Jad has no way of restoring this information in full if it's missing from the class file.

Q4: Why does Jad generate weird-looking static fields like class$java$lang$Float and static methods class$(String)?
A4: These fields/methods are the internal representation of the .class expression and automatically generated by compiler. For example, java.lang.Thread.class is translated into the following: ...
((class$java$lang$Thread == null) ?
(class$java$lang$Thread = class$("java.lang.Thread")) :
class$java$lang$Thread);
...
static Class class$(String s)
{
try
{
return Class.forName(s);
}
catch(ClassNotFoundException ex)
{
throw new NoClassDefFoundError(ex.getMessage());
}
}
static Class class$java$lang$Thread;
This is fixed in 1.5.8. The explanation for the previous versions: Jad doesn't convert all that back to the original expression, but apparently the Sun JDK 1.2 compiler is able to compile "the long format" successfully. JDK 1.3 compiler doesn't accept names containing class$, so in order to recompile the decomplied class you need to change all expressions similar to the conditional expression above to .class and remove static methods/fields whose names start with class$.

Q5: Jad refuses to decompile my class file saying "Class file version mismatch". What can I do?
A5: Use -debug option. Jad then complains about the version mismatch, but attempts to decompile the file anyway. Note that this works starting from the version 1.5.6e.

Q6: Jad fails to decompile my class file, it spits out a bunch of gotos and JVM instructions. Why is that?
A6: There could be several possible reasons: the class file has been obfuscated or it was produced by non-JDK Java compiler or some functions were inlined by Java compiler. Generally Jad works best with class files generated by Sun Java compilers. If you encounter such a behaviour, please send me a bug report with attached .class files.

Q7: How to decompile jar or zip archive with classes?
A7: "Unjar" (jar xvf ) or unzip (using unzip or WinZip) the archive into a directory on your hard drive. Then see the next answer.

Q8: How to decompile the whole class tree?
A8: Run jad -r [-d] [] **/*.class
On Unix the last argument should be in single quotes. For more information please read Readme.txt.

Q9: Why do I get "Class <>List not found" from the compiler?
A9: There are two List classes: java.awt.List and java.util.List. If Jad generates two import directives: import java.awt.*;
import java.util.*;
and your class actually uses the List class, the compiler will complain. Prior version 1.5.7d use the command-line option -pi to prevent Jad from combining the import directives.

Q10: How to make the command-line options -ff -nonlb -space -t to be on by default?
A10: Use the environment variable JAD_OPTIONS to permanently override the default settings. The example for Windows: set JAD_OPTIONS=-ff+ -nonlb+ -t+ -space+

Q11: How to extract Java classes from an executable file (.exe)?
A11: Use the Java-Split utility written by the Decafe Pro team. Download it from http://decafe.hypermart.net/javasplit.htm. Or use J++Extract from http://www.multimania.com/dolmen/productions.

Q12: What does the error message "JavaClassFileParseException: Invalid tag value 0x0" mean exactly?
A12: It means that your file is not a valid Java class and Jad was unable to parse it successfully. Either the file was broken (for example, during download) or the package this class belongs to contains a custom Java class loader that modifies (or decrypts) Java classes after reading them into the memory. In both cases Jad cannot decompile this file as it is.

.class to .java File Conversion

Jad:--

Jad, the fast JAva Decompiler, is a program that reads one or more Java class files and converts them into Java source files which can be compiled again.
Jad is a 100% pure C++ program and it generally works several times faster than decompilers written in Java. Jad doesn't use the Java runtime for its functioning, therefore no special setup is required (like changes to the CLASSPATH variable).

Jad is not open source but it is free to use.

Make sure to download the GUI interface, FrontEnd Plus .

On Windows, a file association with the .class extension is made so if you click on a class file then the decompiled is shown in FrontEnd Plus right away.

JadJad, the fast JAva Decompiler, is a program that reads one or more Java class files and converts them into Java source files which can be compiled again.
Jad is a 100% pure C++ program and it generally works several times faster than decompilers written in Java. Jad doesn't use the Java runtime for its functioning, therefore no special setup is required (like changes to the CLASSPATH variable).
Jad is not open source but it is free to use.
Make sure to download the GUI interface, FrontEnd Plus .
On Windows, a file association with the .class extension is made so if you click on a class file then the decompiled is shown in FrontEnd Plus right away.


Installation

Unzip jad.zip file into any appropriate directory on your hard drive. This will create two files:
- an executable file named 'jad.exe' (Windows 9x/NT/2000) or 'jad' (UNIX)
- README file 'Readme.txt', which contains the short user's manual
For UNIX users: make 'jad' executable: chmod a+x jad
No further setup is required.

Wednesday, February 11, 2009

Mobile Technology Ecosystem

To learn more about J2ME follow our setup guide and build your hello world application. Then look over the examples included with the J4ME distribution to see more complex examples.

Mobile Technology Ecosystem

When do I use J2ME?
What is the best technology for me?
These are good questions because J2ME is not the best solution for all types of applications.
Like with desktop applications your first decision is whether a web or desktop application is best. "Web 2.0" features have made traditional web applications very sophisticated, however, the same can not be said about the Mobile Web. Still this is the way to go for data driven applications because they are much easier to develop and work on all phones. If you need fancy UIs, to perform computations, or access to peripherals like Bluetooth, than your choice is J2ME or one its peers.
Web browsing on your phone is typically done through WAP (Wireless Application Protocol). WAP is similar to HTML but is very basic. Over time phones will adopt regular HTML in favor of WAP. The iPhone already does this and Google's Android will continue this trend.
Mobile applications must be written in the environment supported by the phone. J2ME is the most widely supported platform, but it is not on every phone. Where you don't find J2ME you'll find BREW. There are some other options such as Symbian and Windows Mobile.
BREW is found on about 1/3 of phones in the U.S.; notably it is Verizon's platform of choice. For all intents and purposes BREW is a C++ solution. It has some advantages over J2ME but most consider it to be a closed platform. As such the vast majority of phone applications are written in J2ME and some are occasionally ported to BREW.
Symbian is a phone operating system found on Nokias and other phones. Unlike BREW, however, it is not mutually exclusive with J2ME. For example AT&T's Nokia phones also run J2ME. Symbian applications are written in C++ and give more access to the phone than J2ME does. However, they are harder to write and run in fewer places.
Windows Mobile is a stripped down version of Windows that Microsoft releases for phones. As you might have guessed programming it can be done using stripped down versions of the languages used on Windows. For example C++ with MFC or ATL, .NET, and even J2ME.
Further complicating things are smartphones. No matter the carrier they run the platform that is best for them. For example BlackBerry phones use J2ME (and proprietary Java classes). While the iPhone does not officially support any language.
Hopefully this chart simplifies things. An "X" means it is fully supported and a "/" means it is supported on some phones. The columns for phones mean that phone supports a technology no matter the carrier.

AT&T Verizon Sprint T-Mobile BlackBerry Windows iMobile iPhone

WAP x x x x x x x
J2ME x x x x x x
BREW x
Symbian
Windows Mobile x