Sorry for my ignorance as I am very new to Java and Android app design. I am using Android Studio along with an imported library of functions (RobotRaconteur) to design an application to connect and send a message / data to a Tcp service running on my PC -- all local connections.
The trouble is I cannot get Android Studio to recognize any of my "mathq" scripts (another set of scripts I created) or any of their functions within.
**************I believe the error lies within improperly importing or directory placement of these files... **************************
These mathq functions allow the android app to call a function as if it was built into the app -- even thought the function and processing, or in this case the adding of two numbers sent from the application, is done on the actual service on my PC.
PICTURE OF COMPILATION ERROR AND PROJECT DIRECTORY: http://tinypic.com/r/2k4i1e/8
Thanks in advance :)
package com.example.michael.smartbutton;
import com.robotraconteur.*;
import com.example.michael.smartbutton.mathq.*;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View; //view is any type of widget
import android.widget.Button;
import android.widget.TextView;
//import com.example.michael.smartbutton.example.math.*;
//import com.example.michael.example.math.*;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button mikesButton = (Button)findViewById(R.id.mikesButton); //typecast to Button -- we called them the same thing as the ID in XML
mikesButton.setOnClickListener( //Beginning of CLick event listener
new Button.OnClickListener() { //Interface for our Callback method
public void onClick(View v){ //callback method
TextView mikesText = (TextView)findViewById(R.id.mikesText);
mikesText.setText("Short click sent");
//////BEGGINING OF ROBOT RACONTEUR
//Create and register a TcpTransport
TcpTransport t=new TcpTransport(); //from java sample
RobotRaconteurNode.s().registerTransport(t); //from java sample
//Register the Create_interface service type
RobotRaconteurNode.s().registerServiceType(new mathqFactory());
MathSolver m = (MathSolver)RobotRaconteurNode.s().connectService("tcp://199.172.0.129:1234/example.math/MathSolver",null,null,null,"example.math.MathSolver");
m.add(10,11);
//Connect to the service
// Create c=(Create)RobotRaconteurNode.s().connectService("tcp://localhost:2354/{0}/Create",null,null,null,"experimental.create.Create");
//FROM JAVA DOC
//Shutdown the node. This must be called or the program won't exit.
RobotRaconteurNode.s().shutdown();
}
}
);
mikesButton.setOnLongClickListener(
new Button.OnLongClickListener(){
public boolean onLongClick(View v){
TextView mikesText = (TextView)findViewById(R.id.mikesText);
mikesText.setText("that was a long one!");
return true; //you need to tell android you handled this click. then onClick listener can go to sleep for now
}
}
); //Finger is on button for > a second
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}