Search in sources :

Example 6 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project AnimeTaste by daimajia.

the class SettingActivity method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.only_for_wifi:
            break;
        case R.id.use_hd:
            break;
        case R.id.suggestion:
            Intent intent = new Intent(mContext, FeedbackActivity.class);
            startActivity(intent);
            break;
        case R.id.recommend:
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getText(R.string.share_title));
            shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, getText(R.string.share_app_body));
            startActivity(Intent.createChooser(shareIntent, getText(R.string.share_via)));
            break;
        case R.id.focus_us:
            mWeibo = new SinaWeibo(mContext);
            mWeibo.setPlatformActionListener(this);
            mWeibo.authorize();
            break;
        case R.id.cancel_auth:
            ShareSDK.getPlatform(mContext, SinaWeibo.NAME).removeAccount();
            ShareSDK.getPlatform(mContext, QZone.NAME).removeAccount();
            mSharedPreferences.edit().remove("login").commit();
            MobclickAgent.onEvent(mContext, "logout");
            Toast.makeText(mContext, R.string.logout_success, Toast.LENGTH_SHORT).show();
            break;
        case R.id.rate_for_us:
            Uri uri = Uri.parse("market://details?id=" + mContext.getPackageName());
            Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
            try {
                startActivity(goToMarket);
                MobclickAgent.onEvent(mContext, "rate");
            } catch (ActivityNotFoundException e) {
                Toast.makeText(mContext, R.string.can_not_open_market, Toast.LENGTH_SHORT).show();
            }
            break;
        case R.id.clear_cache:
            new Thread() {

                @Override
                public void run() {
                    super.run();
                    CacheUtils.deleteCache(mContext);
                }
            }.start();
            Toast.makeText(mContext, R.string.clear_ok, Toast.LENGTH_SHORT).show();
            break;
        default:
            break;
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) SinaWeibo(cn.sharesdk.sina.weibo.SinaWeibo) Intent(android.content.Intent) Uri(android.net.Uri)

Example 7 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project PhotoPicker by donglua.

the class PhotoPickerFragment method openCamera.

private void openCamera() {
    try {
        Intent intent = captureManager.dispatchTakePictureIntent();
        startActivityForResult(intent, ImageCaptureManager.REQUEST_TAKE_PHOTO);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ActivityNotFoundException e) {
        // TODO No Activity Found to handle Intent
        e.printStackTrace();
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) IOException(java.io.IOException)

Example 8 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project Libraries-for-Android-Developers by eoecn.

the class SearchView method onVoiceClicked.

private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent, searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent, searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) SearchableInfo(android.app.SearchableInfo) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) RecognizerIntent(android.speech.RecognizerIntent)

Example 9 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project android_frameworks_base by ParanoidAndroid.

the class PlatLogoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mToast = Toast.makeText(this, "", Toast.LENGTH_LONG);
    mToast.setView(makeView());
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mContent = new ImageView(this);
    mContent.setImageResource(com.android.internal.R.drawable.platlogo_alt);
    mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    final int p = (int) (32 * metrics.density);
    mContent.setPadding(p, p, p, p);
    mContent.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mToast.show();
            mContent.setImageResource(com.android.internal.R.drawable.platlogo);
        }
    });
    mContent.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            try {
                startActivity(new Intent(Intent.ACTION_MAIN).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS).addCategory("com.android.internal.category.PLATLOGO"));
            //.setClassName("com.android.systemui","com.android.systemui.BeanBag"));
            } catch (ActivityNotFoundException ex) {
                android.util.Log.e("PlatLogoActivity", "Couldn't find a bag of beans.");
            }
            finish();
            return true;
        }
    });
    setContentView(mContent);
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) ImageView(android.widget.ImageView) DisplayMetrics(android.util.DisplayMetrics) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 10 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project android_frameworks_base by ParanoidAndroid.

the class Credentials method install.

public void install(Context context, String type, byte[] value) {
    try {
        Intent intent = KeyChain.createInstallIntent();
        intent.putExtra(type, value);
        context.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Log.w(LOGTAG, e.toString());
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent)

Aggregations

ActivityNotFoundException (android.content.ActivityNotFoundException)384 Intent (android.content.Intent)343 Uri (android.net.Uri)45 View (android.view.View)38 PendingIntent (android.app.PendingIntent)37 RecognizerIntent (android.speech.RecognizerIntent)35 ResolveInfo (android.content.pm.ResolveInfo)33 UserHandle (android.os.UserHandle)28 ComponentName (android.content.ComponentName)24 PackageManager (android.content.pm.PackageManager)23 Bundle (android.os.Bundle)23 ImageView (android.widget.ImageView)23 RemoteException (android.os.RemoteException)22 TextView (android.widget.TextView)22 SearchManager (android.app.SearchManager)20 SearchableInfo (android.app.SearchableInfo)15 File (java.io.File)15 DialogInterface (android.content.DialogInterface)14 AlertDialog (android.app.AlertDialog)13 Context (android.content.Context)13