# Android processing text input and convert in string

**URL:** https://discourse.processing.org/t/android-processing-text-input-and-convert-in-string/23741
**Category:** Processing for Android
**Created:** [September 8, 2020, 4:09pm UTC](https://discourse.processing.org/t/android-processing-text-input-and-convert-in-string/23741 "2020-09-08T16:09:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Purr](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@Purr](https://discourse.processing.org/u/Purr)
#### Post date: [September 8, 2020, 4:09pm UTC](https://discourse.processing.org/t/android-processing-text-input-and-convert-in-string/23741/1 "2020-09-08T16:09:00Z")

</div>

Hi there,

I was working on an app in java and I want now to convert on android app.  
The problem is I was using g4p controls and I know that this lib is not working on android.  
I really need this value cause with this I can make dynamic connection to send value on Puredata.

Do you have any solutions to help me on this code?

My old code here:  
import oscP5._;  
import netP5._;  
import controlP5._;  
import g4p\_controls._;

GTextField txf1;  
GTextField txf2;  
ControlP5 controlP5;  
Knob myDial;  
Slider mySlider;  
String newuserinput = “”;  
String userinput = “” ;  
String portinput = “”;  
int newportinput = 0 ;

OscP5 oscP5;  
NetAddress myRemoteLocation;

int sliderValue = 100;

void setup() {  
size(400,400);  
smooth();  
frameRate(25);

txf1 = new GTextField(this, 10, 10, 200, 20);  
txf2 = new GTextField(this, 30, 30, 200, 20);  
txf1.setPromptText("");  
txf1.setText(""); // works  
txf2.setPromptText("");  
txf2.setText(""); // works

// create a new instance of oscP5.  
// 12000 is the port number you are listening for incoming osc messages.  
oscP5 = new OscP5(this, 0000);  
myRemoteLocation = new NetAddress(userinput, 0000);  
controlP5 = new ControlP5(this);

mySlider = controlP5.addSlider(“sliderValue”,0, 127)  
.setPosition(100,100)  
.setSize(50, 200);

}

void draw() {  
background(0);  
fill(255, 0, 0);  
;  
println(sliderValue);  
if (keyPressed && key == ENTER){  
println(txf1.getText());  
newuserinput = (txf1.getText());  
if (keyPressed && key == ENTER){  
println(txf2.getText());  
portinput = (txf2.getText());  
newportinput = Integer.parseInt (portinput);  
oscP5 = new OscP5(this, newportinput);  
controlP5 = new ControlP5(this);  
myRemoteLocation = new NetAddress(newuserinput,newportinput);  
}  
}  
}  
void mousePressed() {  
/\* in the following different ways of creating osc messages are shown by example _/  
//OscMessage myMessage = new OscMessage(int(knobValue));  
 [//myMessage.add](https://myMessage.add)();  
OscMessage myMessage = new OscMessage("/fadder1");  
myMessage.add(sliderValue);  
/_ send the message \*/  
oscP5.send(myMessage, myRemoteLocation);  
}

I hope you can help me,

Purr

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [September 14, 2020, 8:37pm UTC](https://discourse.processing.org/t/android-processing-text-input-and-convert-in-string/23741/2 "2020-09-14T20:37:07Z")

</div>

[Here](https://github.com/EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android/blob/master/Seekbar%20(Slider)) is an android slider (seekbar), with a textView counter.  
I’ll try to code a knob as well.
