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);
}
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;
}
}
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.");
}
}
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();
}
}
});
}
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();
}
}
Aggregations