Search in sources :

Example 81 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project OneClickAndroid by cyngn.

the class UsbActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OneClickStats.sendEvent(this, OneClickStats.Categories.PAGE_SHOWN, OneClickStats.Actions.PAGE_ADB);
    if (adbIsEnabled()) {
        startActivity(new Intent(getBaseContext(), PtpActivity.class));
        finish();
        return;
    }
    setContentView(R.layout.usb);
    ImageView instructionView = (ImageView) findViewById(R.id.usb_instructions);
    DecelerateInterpolator interpolator = new DecelerateInterpolator(2.0f);
    AnimationSet instructionAnimations = new AnimationSet(true);
    instructionAnimations.setInterpolator(interpolator);
    TranslateAnimation instructionMoveAnimation = new TranslateAnimation(0, 0, 250, 0);
    instructionMoveAnimation.setDuration(1000);
    instructionMoveAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionMoveAnimation);
    // we want them to read the instructions first! so we give them a few seconds
    AlphaAnimation instructionFadeAnimation = new AlphaAnimation(0.0f, 1.0f);
    instructionFadeAnimation.setDuration(1000);
    instructionFadeAnimation.setStartOffset(500);
    instructionFadeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionFadeAnimation);
    instructionView.setAnimation(instructionAnimations);
    // continue button should take even longer
    AlphaAnimation buttonAnimation = new AlphaAnimation(0.0f, 1.0f);
    buttonAnimation.setDuration(750);
    buttonAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    buttonAnimation.setStartOffset(1000);
    findViewById(R.id.next).setAnimation(buttonAnimation);
    OnClickListener openUsbListener = new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setClassName("com.android.settings", "com.android.settings.DevelopmentSettings");
            try {
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.BUTTON_CLICK, OneClickStats.Actions.BTN_ADB);
                startActivity(intent);
                startService(new Intent(getBaseContext(), UsbDebuggingMonitorService.class));
            } catch (ActivityNotFoundException e) {
                // we want to know if this happens, right?
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.SWITCH_ERROR, OneClickStats.Actions.ERR_ADB);
            }
        }
    };
    findViewById(R.id.next).setOnClickListener(openUsbListener);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ActivityNotFoundException(android.content.ActivityNotFoundException) TranslateAnimation(android.view.animation.TranslateAnimation) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet) ImageView(android.widget.ImageView) View(android.view.View) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 82 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 83 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project android by owncloud.

the class UploadListActivity method openFileWithDefault.

/**
     * Open file with app associates with its MIME type. If MIME type unknown, show list with all apps.
     */
private void openFileWithDefault(String localPath) {
    Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW);
    File file = new File(localPath);
    String mimetype = MimetypeIconUtil.getBestMimeTypeByFilename(localPath);
    if ("application/octet-stream".equals(mimetype)) {
        mimetype = "*/*";
    }
    myIntent.setDataAndType(Uri.fromFile(file), mimetype);
    try {
        startActivity(myIntent);
    } catch (ActivityNotFoundException e) {
        showSnackMessage(getString(R.string.file_list_no_app_for_file_type));
        Log_OC.i(TAG, "Could not find app for sending log history.");
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) OCFile(com.owncloud.android.datamodel.OCFile) File(java.io.File)

Example 84 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project mobile-android by photo.

the class FeatherActivity method showInfoScreen.

/**
	 * Display the big info screen Flip the main image with the infoscreen view.
	 */
private void showInfoScreen() {
    createInfoScreenAnimations(true);
    // Add the infoscreen view to the UI.
    ViewGroup view = (ViewGroup) mViewFlipper.findViewById(R.id.infocreeen_container);
    if (null != view && view.getChildCount() == 0) {
        UIUtils.getLayoutInflater().inflate(R.layout.feather_infoscreen, view, true);
    }
    mViewFlipper.setDisplayedChild(1);
    TextView text = (TextView) mViewFlipper.findViewById(R.id.version_text);
    text.setText("v " + FeatherActivity.SDK_VERSION);
    mViewFlipper.findViewById(R.id.aviary_infoscreen_submit).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            String url = "http://www.aviary.com";
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            try {
                startActivity(i);
            } catch (ActivityNotFoundException e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) ViewGroup(android.view.ViewGroup) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) FeatherIntent(com.aviary.android.feather.library.content.FeatherIntent) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ToolbarView(com.aviary.android.feather.widget.ToolbarView)

Example 85 with ActivityNotFoundException

use of android.content.ActivityNotFoundException in project mobile-android by photo.

the class FilterManager method searchOrDownloadPlugin.

public void searchOrDownloadPlugin(final String packageName, final int type, final boolean search) {
    logger.info("searchOrDownloadPlugin: " + packageName + ", search: " + search);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    if (search)
        intent.setData(Uri.parse("market://search?q=" + packageName));
    else
        intent.setData(Uri.parse("market://details?id=" + packageName));
    try {
        String name = FeatherIntent.PluginType.getName(type);
        if (null != name) {
            HashMap<String, String> attrs = new HashMap<String, String>();
            attrs.put("assetType", name);
            Tracker.recordTag("content: addMoreClicked", attrs);
        }
        getBaseContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(getBaseContext(), R.string.feather_activity_not_found, Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }
}
Also used : HashMap(java.util.HashMap) ActivityNotFoundException(android.content.ActivityNotFoundException) FeatherIntent(com.aviary.android.feather.library.content.FeatherIntent) Intent(android.content.Intent)

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