Geraint Deadman
Posts: 0
Joined: Fri May 09, 2014 3:10 pm

Import problems

I am trying to use some imported Java code:
import android.support.v7.app.ActionBarActivity;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.os.Bundle;

public class MainActivity extends ActionBarActivity {
Button btnSOS;

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

setContentView(R.layout.activity_main);
btnSOS =(Button)findViewById(R.id.btnSOS);
btnSOS.setOnClickListener(new View.OnClickListener() {

Code: Select all

@Override 
public void onClick(View v)  
{ 
 sendSMS("+442033226145","SOS Request!"); 

 Log.i("SOS", "Request Sent!"); 
 Toast.makeText(MainActivity.this, "Your Clicked SOS", Toast.LENGTH_LONG) 
 .show(); 
} 

private void sendSMS(String phoneNumber, String message)  
{ 
SmsManager sms = SmsManager.getDefault(); 
sms.sendTextMessage(phoneNumber, null, message, null, null); 

} 

});

}

}

that will send a message to a predefined number with a predefined message, but it it is finding the imports part of the code and Import is only available in ES6, can you point me in the right direction or help me to resolve these problems.

Many thanks guys

Geraint Deadman
Posts: 0
Joined: Fri May 09, 2014 3:10 pm

Import problems

Image

An image of the error i am getting

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Import problems

Hi Geraint,

This is Java. You can use only JavaScript, CSS and HTML code within Appery.io.

Return to “Issues”