Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Fragment Code issue
    primarykey
    data
    text
    <p>I'm wondering how I can get the code below to work with my project as to combine the two so that it could work. What I have is an implemented Navigation Drawer in the app</p> <p>1st Java Code Using Fragment:</p> <pre><code>import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class PagesFragment extends Fragment { public PagesFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_pages, container, false); return rootView; } } </code></pre> <p>2nd Java Code Using Activity:</p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class AppointmentActivity extends Activity { Button sendEmail; EditText msg; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.appointment_layout); sendEmail = (Button) findViewById(R.id.sndBtn); sendEmail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { msg = (EditText) findViewById(R.id.msgTxt); String message = msg.getText().toString(); sendEmail(message); } }); } protected void sendEmail(String message) { String[] to=new String[]{"Shop@email.com"}; String subject=("Shop Appointment"); Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, to); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); startActivity(Intent.createChooser(emailIntent, "Gmail")); } } </code></pre> <p>I've tried to combine the two myself but I don't have a lot of experience dealing with android to know how to make both of these codes work side by side and not give me a force close. Anything would be helpful!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload