Search in sources :

Example 56 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project Klyph by jonathangerbaud.

the class FeedBackActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    ImageView companyLogo = (ImageView) findViewById(R.id.company_logo);
    Button suggestButton = (Button) findViewById(R.id.suggest_button);
    Button bugButton = (Button) findViewById(R.id.bug_button);
    Button gPlusButton = (Button) findViewById(R.id.bug_g_plus);
    setTitle(R.string.menu_feedback);
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_background_transparent_gradient));
    suggestButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.feedback_support_mail_address) });
            intent.putExtra(Intent.EXTRA_SUBJECT, "Suggest feedback " + getString(R.string.about_version, ApplicationUtil.getAppVersion(FeedBackActivity.this)));
            intent.putExtra(Intent.EXTRA_TEXT, "");
            startActivity(Intent.createChooser(intent, getString(R.string.feedback_send_mail)));
        }
    });
    bugButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.feedback_support_mail_address) });
            intent.putExtra(Intent.EXTRA_SUBJECT, "Bug feedback " + getString(R.string.about_version, ApplicationUtil.getAppVersion(FeedBackActivity.this)));
            intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(new StringBuilder().append("<p>Android Version : " + Build.VERSION.RELEASE + " (Api Level " + Build.VERSION.SDK_INT + ")</p>").append("<p>Device model : " + Build.BRAND + " " + Build.MODEL + "</p>").toString()));
            startActivity(Intent.createChooser(intent, getString(R.string.feedback_send_mail)));
        }
    });
    gPlusButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.google_plus_community_url))));
            } catch (ActivityNotFoundException e) {
                PhoneUtil.openURL(FeedBackActivity.this, getString(R.string.google_plus_community_url));
            }
        }
    });
    companyLogo.setClickable(true);
    companyLogo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            PhoneUtil.openURL(FeedBackActivity.this, getString(R.string.company_url));
        }
    });
}
Also used : Button(android.widget.Button) ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View)

Example 57 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project SmartAndroidSource by jaychou2012.

the class FacebookHandle method startSingleSignOn.

private boolean startSingleSignOn(Activity activity, String applicationId, String permissions, int activityCode) {
    boolean didSucceed = true;
    Intent intent = new Intent();
    intent.setClassName("com.facebook.katana", "com.facebook.katana.ProxyAuth");
    intent.putExtra("client_id", applicationId);
    if (permissions != null) {
        intent.putExtra("scope", permissions);
    }
    if (!validateAppSignatureForIntent(activity, intent)) {
        return false;
    }
    try {
        activity.startActivityForResult(intent, activityCode);
    } catch (ActivityNotFoundException e) {
        didSucceed = false;
    }
    return didSucceed;
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent)

Example 58 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project Android-Terminal-Emulator by jackpal.

the class Term method doEmailTranscript.

private void doEmailTranscript() {
    TermSession session = getCurrentTermSession();
    if (session != null) {
        // Don't really want to supply an address, but
        // currently it's required, otherwise nobody
        // wants to handle the intent.
        String addr = "user@example.com";
        Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + addr));
        String subject = getString(R.string.email_transcript_subject);
        String title = session.getTitle();
        if (title != null) {
            subject = subject + " - " + title;
        }
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_TEXT, session.getTranscriptText().trim());
        try {
            startActivity(Intent.createChooser(intent, getString(R.string.email_transcript_chooser_title)));
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, R.string.email_transcript_no_email_activity_found, Toast.LENGTH_LONG).show();
        }
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 59 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project SeriesGuide by UweTrottmann.

the class ShareUtils method startShareIntentChooser.

/**
     * Share a text snippet. Displays a share intent chooser with the given title, share type is
     * text/plain.
     */
public static void startShareIntentChooser(Activity activity, String message, @StringRes int titleResId) {
    IntentBuilder ib = ShareCompat.IntentBuilder.from(activity);
    ib.setText(message);
    ib.setChooserTitle(titleResId);
    ib.setType("text/plain");
    try {
        ib.startChooser();
    } catch (ActivityNotFoundException e) {
        // no activity available to handle the intent
        Toast.makeText(activity, R.string.app_not_available, Toast.LENGTH_LONG).show();
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) IntentBuilder(android.support.v4.app.ShareCompat.IntentBuilder)

Example 60 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project Fairphone by Kwamecorp.

the class LauncherTransitionable method onClickVoiceButton.

/**
	 * Event handler for the voice button
	 * 
	 * @param v
	 *            The view that was clicked.
	 */
public void onClickVoiceButton(View v) {
    v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
    try {
        final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        ComponentName activityName = searchManager.getGlobalSearchActivity();
        Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (activityName != null) {
            intent.setPackage(activityName.getPackageName());
        }
        startActivity(null, intent, "onClickVoiceButton");
    } catch (ActivityNotFoundException e) {
        Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivitySafely(null, intent, "onClickVoiceButton");
    }
}
Also used : SearchManager(android.app.SearchManager) ActivityNotFoundException(android.content.ActivityNotFoundException) ComponentName(android.content.ComponentName) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent)

Aggregations

ActivityNotFoundException (android.content.ActivityNotFoundException)406 Intent (android.content.Intent)365 Uri (android.net.Uri)49 PendingIntent (android.app.PendingIntent)39 View (android.view.View)39 ResolveInfo (android.content.pm.ResolveInfo)38 RecognizerIntent (android.speech.RecognizerIntent)35 PackageManager (android.content.pm.PackageManager)30 UserHandle (android.os.UserHandle)28 ComponentName (android.content.ComponentName)26 ImageView (android.widget.ImageView)24 Bundle (android.os.Bundle)23 TextView (android.widget.TextView)23 Test (org.junit.Test)23 RemoteException (android.os.RemoteException)22 Activity (android.app.Activity)21 SearchManager (android.app.SearchManager)20 DialogInterface (android.content.DialogInterface)17 SearchableInfo (android.app.SearchableInfo)15 File (java.io.File)15