i new to the android programming. I've tried to create a IRC bot. I've used the Pircbot libraries. My app can connect to the server but i can't understand how to show the chat's output in the android's textview. Can you help me? Pircbot print it in the Android Logcat, are there a way to print Logcat in a textView? Thank You so much
This is my starting_bot.java:
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
public class starting_bot extends MainActivity {
private irc_connection mAuthTask = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAuthTask = new irc_connection();
mAuthTask.execute((Void) null);
setContentView(R.layout.started_bot);
}
public class irc_connection extends AsyncTask<Void, Void, Boolean> {
@Override
protected void onPreExecute(){
}
@Override
protected void onProgressUpdate(Void[] values) {
};
@Override
protected Boolean doInBackground(Void... params) {
//ESEGUIRE OPERAZIONI IN BACKGROUND
BotClass bot = new BotClass("nickname123");
try {
bot.setVerbose(true);
bot.connect("irc server");
//bot.sendMessage("nickserv","IDENTIFY <your password>" );
bot.joinChannel("#ircchannel");
Log.d("BOT:", "CONNESSO!");
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
@Override
protected void onPostExecute(final Boolean success) {
}
@Override
protected void onCancelled() {
mAuthTask = null;
}
}
that is my output page:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/output_java"/>
</LinearLayout>