Thursday, February 11, 2010

PTC sites, Scams, Updates and Reviews: February 11, 2010

PTC sites, Scams, Updates and Reviews: February 11, 2010
Hi people are you worried by PTC scams like me.. wait
I found some great websites which really pays after getting my account deleted after checkout by scammy websites.I found some really cool sites which pays for 100% sure.

1. http://www.neobux.com/?r=sisconsoft
2. http://www.microworkers.com/?Id=c5e92747
3. http://viewbestads.com/ref/NjY0MTI=aXY=
4. http://revtwt.com/index.php?id=61034

If I can earn you can too

Tuesday, December 29, 2009

j2me tutorial

How to write a midlet application which records the voice of the user..?

well here is an example which does this..

first what you need to have is a J2ME wireless Toolkit which you can download using this link http://java.sun.com/products/sjwtoolkit/download-2_5.html.

Create a new project and create a java file in the src directory of your project folder and in that copy and paste this code and build the application to get your jar file binary code which you can use on the mobile phone.


import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
public class VoiceRecordMidlet extends MIDlet {
private Display display;
public void startApp() {
display = Display.getDisplay(this);
display.setCurrent(new VoiceRecordForm());
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
}
class VoiceRecordForm extends Form implements CommandListener {
private StringItem message;
private StringItem errormessage;
private final Command record, play;
private Player player;
private byte[] recordedAudioArray = null;
public VoiceRecordForm() {
super("Recording Audio");
message = new StringItem("", "Select Record to start recording.");
this.append(message);
errormessage = new StringItem("", "");
this.append(errormessage);
record = new Command("Record", Command.OK, 0);
this.addCommand(record);
play = new Command("Play", Command.BACK, 0);
this.addCommand(play);
this.setCommandListener(this);
}
public void commandAction(Command comm, Displayable disp) {
if (comm == record) {
Thread t = new Thread() {
public void run() {
try {
player = Manager.createPlayer("capture://audio?encoding=pcm");
player.realize();
RecordControl rc = (RecordControl) player.getControl("RecordControl");
ByteArrayOutputStream output = new ByteArrayOutputStream();
rc.setRecordStream(output);
rc.startRecord();
player.start();
message.setText("Recording...");
Thread.sleep(5000);
message.setText("Recording Done!");
rc.commit();
recordedAudioArray = output.toByteArray();
player.close();
} catch (Exception e) {
errormessage.setLabel("Error");
errormessage.setText(e.toString());
}
}
};
t.start();
}
else if (comm == play) {
try {
ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(recordedAudioArray);
Player p2 = Manager.createPlayer(recordedInputStream, "audio/basic");
p2.prefetch();
p2.start();
} catch (Exception e) {
errormessage.setLabel("Error");
errormessage.setText(e.toString());
}
}
}
}