I believe that I have stated the variables at the top of the code under EditText however i am still getting this error message would anyone be able to take a look and maybe find a solution. by no means am i an expert at code im just trying to pass my uni module :D
package com.example.richard.bradfordcoursefinder;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Main4Activity extends AppCompatActivity {
EditText email, name;
Button send;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
email = (EditText) findViewById(R.id.email);
name = (EditText) findViewById(R.id.name);
send = (Button) findViewById(R.id.send);
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = email.getText().toString();
String name = name.getText().toString();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{name});
intent.putExtra(Intent.EXTRA_SUBJECT, email);
intent.setType("message/rfc822");
startActivity(Intent.createChooser(intent, "Select Email App"
));
}
});
}
}