• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor building first app #HelpNeeded#

DOWNgrading solved the problem??? Wow, would never have thought of doing that.

The current problem you're describing sounds like there's some problems in the click handlers. Can you share that code?
 
yes i downgraded to 4.10.1 and it built straight away, i wouldnt have got there without your pointers tho mate. hopefully you have advice for my last thorn in my side
thanks again for all your input mate

Code:
package com.example.blueflametest1;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ((Button) findViewById(R.id.btnOK)).setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                String box1 = ((EditText)findViewById(R.id.edit1)).getText().toString();
                String box2 = ((EditText)findViewById(R.id.edit2)).getText().toString();
                String box3 = ((EditText)findViewById(R.id.edit3)).getText().toString();
                String box4 = ((EditText)findViewById(R.id.edit4)).getText().toString();
                String box5 = ((EditText)findViewById(R.id.edit5)).getText().toString();
                String box6 = ((EditText)findViewById(R.id.edit6)).getText().toString();
                String box7 = ((EditText)findViewById(R.id.edit7)).getText().toString();
                String box8 = ((EditText)findViewById(R.id.edit8)).getText().toString();
                String box9 = ((EditText)findViewById(R.id.edit9)).getText().toString();
                String box10 = ((EditText)findViewById(R.id.edit10)).getText().toString();
                String box11 = ((EditText)findViewById(R.id.edit11)).getText().toString();
                String box12 = ((EditText)findViewById(R.id.edit12)).getText().toString();
                String box13 = ((EditText)findViewById(R.id.edit13)).getText().toString();
                Intent mail = new Intent(Intent.ACTION_SEND);
                mail.setType("message/rfc822");
                startActivity(Intent.createChooser(mail, "Send email via:"));
            }
        });
    }
}

[\code]
 
About what I suspected - the email isn't fully connected to the form data.

Your series of this:
Code:
String box1 = ((EditText)findViewById(R.id.edit1)).getText().toString();
is getting the text from the text field, but there's nothing putting it into the email.

It looks like you're trying to get a bunch of different entries and put that all together. With names like box1 and box2, I can't tell the intent, but you probably want to put it together into a single message with that information neatly formed so that you can read it easily.

I'll give you an example, just making some things up on my end - you should be able to modify this to fit your needs. For the example, I'm going to assume that:
  • box1 is Customer's First Name
  • box2 is Customer's Last Name
  • box3 is Customer's email address
  • box4 is the problem being reported
  • box5 is a detailed description of the problem
I'm going to leave it at 5 boxes for the example:
Code:
public void onClick(View v) {
    String firstName = ((EditText)findViewById(R.id.edit1)).getText().toString();
    String lastName = ((EditText)findViewById(R.id.edit2)).getText().toString();
    String emailAddress = ((EditText)findViewById(R.id.edit3)).getText().toString();
    String problem = ((EditText)findViewById(R.id.edit4)).getText().toString();
    String problemDetails = ((EditText)findViewById(R.id.edit5)).getText().toString();

    String message = "From: " + firstName + " " + lastName + "\n";
    message += "Email: " + emailAddress + "\n\n"; // double line space
    message += "Problem: " + problem + "\n";
    message += "Details:\n" + problemDetails;
So now you have all the entered text all together in a single string.

Then, you need to send that string, and some other info, to the mail intent:
Code:
    Intent mail = new Intent(Intent.ACTION_SEND);
    mail.setType("message/rfc822");
    mail.putExtra(Intent.EXTRA_EMAIL, new String[] { "gizmorepairs@gizmorepairs.com" }); // sets who the email goes to
    mail.putExtra(Intent.EXTRA_SUBJECT, "Android App Response");
    mail.putExtra(Intent.EXTRA_TEXT, message);
    startActivity(Intent.createChooser(mail, "Send email via:"));
}

That should get the text & other stuff you need into the email. Here's some SO answers I found that seem relevant and may be helpful to you working out the last bits:
https://stackoverflow.com/questions/4883199/using-android-intent-action-send-for-sending-email

Hope that helps!
 
Big help tony, exactly what I was looking for .. I will try it out tomorrow and give some feedback. I can't thank you enough for all your help !!!
 
I'm still learning too - and I actually learned some stuff helping out. I'm glad I could help you get things working!
 
Hi tony, you are now my android god so I hope you don't mind me messaging again :)
Would you know of anyway to bypass the email client and have the information sent directly from the app ?
 
Thanks for the reply tony after doing some reading I have decided to abandon this route as it requires hardcoding the login and password into the app. Thanks again
 
Back
Top Bottom