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