Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:29:14+00:00 2026-06-14T18:29:14+00:00

hey guys i need help configuring some source code to basically when a error

  • 0

hey guys i need help configuring some source code to basically when a error happens to send a crash report via email to me. Here is some code im playing with i just need someone with a little more experience with java to overlook it and help me clean it up.

Thanks,

public final class EmailUtils {

private EmailUtils()
 {
 }

private static int bytesToMb(long l)
 {
    return (int)((double)l / 1024D / 1024D);
 }

private static int getAvailableInternalMemorySize()
 {
    StatFs statfs = new StatFs(Environment.getDataDirectory().getPath());
    return bytesToMb((long)statfs.getBlockSize() * (long)statfs.getAvailableBlocks());
 }

private static String getEmailText(Context context)
 {
    String s = "";
    String s11;
    PackageInfo packageinfo =  context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
    String s1 = packageinfo.versionName;
    int i = packageinfo.versionCode;
    String s2 = packageinfo.packageName;
    String s3 = Build.MODEL;
    String s4 = android.os.Build.VERSION.RELEASE;
    String s5 = android.os.Build.VERSION.SDK;
    String s6 = Build.DEVICE;
    String s7 = Build.DISPLAY;
    String s8 = Build.ID;
    String s9 = (new  StringBuilder(String.valueOf(Build.BRAND))).append("/").append(Build.MANUFACTURER).toString();
    String s10 = Build.PRODUCT;
    s = (new StringBuilder(String.valueOf(s))).append("\n\n------------------\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Version: ").append(s1).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Version num: ").append(i).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Package: ").append(s2).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Phone Model: ").append(s3).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Android Version: ").append(s4).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("SDK Version: ").append(s5).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Device: ").append(s6).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Product: ").append(s10).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Brand: ").append(s9).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Disp: ").append(s7).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Id: ").append(s8).toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Available Internal memory: ").append(getAvailableInternalMemorySize()).append("/").append(getTotalInternalMemorySize()).append(" Mb").toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Heap size: ").append(getHeapSizeMb()).append(" Mb").toString();
    s = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = (new StringBuilder(String.valueOf(s))).append("Mar: GO").toString();
    s11 = (new StringBuilder(String.valueOf(s))).append("\n").toString();
    s = s11;

    android.content.pm.PackageManager.NameNotFoundException namenotfoundexception;

 //   namenotfoundexception.printStackTrace();
  //  if(true) 
  //    goto

}

private static int getHeapSizeMb()
 {
    return bytesToMb(Runtime.getRuntime().maxMemory());
 }

private static int getTotalInternalMemorySize()
 {
    StatFs statfs = new StatFs(Environment.getDataDirectory().getPath());
    return bytesToMb((long)statfs.getBlockSize() * (long)statfs.getBlockCount());
 }

public static void sendContactEmail(Context context)
 {
    String s = context.getResources().getString(0x7f040000);
    String s1 = "";
    String s2;
    String s3;
    Intent intent;
    try
    {
        s1 = context.getPackageManager().getPackageInfo(context.getPackageName(),  0).versionName;
    }
    catch(android.content.pm.PackageManager.NameNotFoundException  namenotfoundexception) { }
    s2 = (new StringBuilder("[SUPPORT] ")).append(s).append(" ").append(s1).toString();
    s3 = getEmailText(context);
    intent = new Intent("android.intent.action.SEND");
    intent.setType("plain/text");
    intent.putExtra("android.intent.extra.EMAIL", new String[] {
        "support@myemail.com"
    });
    intent.putExtra("android.intent.extra.SUBJECT", s2);
    intent.putExtra("android.intent.extra.TEXT", s3);
    if(context.getPackageManager().queryIntentActivities(intent, 0).size() > 0)
    {
        context.startActivity(Intent.createChooser(intent, "Send mail..."));
    } else
    {
        CustomAlertDialogBuilder customalertdialogbuilder = new CustomAlertDialogBuilder(context);
        customalertdialogbuilder.setTitle("Contact us");
        customalertdialogbuilder.setIcon(R.drawable.ic_launcher);
        customalertdialogbuilder.setMessage(Html.fromHtml("No application found to send emails.<br /><br />Please contact us at: <b>support@email.com</b>."));
        customalertdialogbuilder.setNegativeButton("Close", null);
        customalertdialogbuilder.show();
       }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:29:15+00:00Added an answer on June 14, 2026 at 6:29 pm

    My Main goal is to pull system data and intent out. Do you recommend using the ACRA way or using my string method?

    Definitely ACRA. Again, it already exists, is supported, offers multiple means of getting the data to you (including ways that do not disclose your email address), integrates with third-party services like BugSense, etc.

    To be a bit more specific about two of my code comments:

    • Never never never never never never never hard-code a resource ID hex value, such as: String s = context.getResources().getString(0x7f040000);. Those values can change with each build, particularly when you add/remove resources. Always use the resource ID symbol (e.g., R.string.foo).

    • In getEmailText(), please create one StringBuilder object and append to it. Do not create 30 or so of them, using each once and discarding it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys! I need some help writing a code that creates an array in
Hey Guys...need help. Working on a project and get this error on the Output
Hey guys need some more help I have 3 tables USERS, PROFILEINTERESTS and INTERESTS
Hey guys i need some help with logic in my app. I have an
Hey guys, I need some help, how can I sum a list from a
Hey guys I need some help with this: I have two view controllers, let's
Hey guys was hoping you could help me out. basically i'm working on a
Hey guys. I need help for a project for school. Essentially, I need to
hey guys, I need help considering win32com in Python: I have a routine that
Hey guys I need a tad bit of help. I need my streamwriter to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.