Java Code Examples for android.content.ActivityNotFoundException

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 3

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: SimpleMenuItem.java

  15 
vote

public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu,this)) {
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  return false;
}
 

Example 4

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 5

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 6

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: AmenDetailFragmentActivity.java

  15 
vote

private void startShowOnMapActivity(){
  Double lat=getCurrentStatement().getObjekt().getLat();
  Double lng=getCurrentStatement().getObjekt().getLng();
  String label=getCurrentStatement().getObjekt().getName().replaceAll("\\(","").replaceAll("\\)","");
  final String uriString="https://maps.google.com/maps?q=" + lat + ','+ lng+ "("+ label+ ")"+ "&z=15";
  Log.d(TAG,"uriString for show on map: " + uriString);
  Intent showOnMapIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(uriString));
  try {
    startActivity(showOnMapIntent);
  }
 catch (  ActivityNotFoundException anf) {
    toast("No activity found to view " + uriString,Toast.LENGTH_LONG);
  }
}
 

Example 7

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 8

From project android-context, under directory /defunct/shared/.

Source file: AboutActivity.java

  15 
vote

@Override protected void onListItemClick(ListView l,View v,int position,long id){
  AboutItem item=aboutAdapter.getAboutItem(position);
  final Intent actionIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(item.getAction()));
  try {
    startActivity(actionIntent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.error_email,Toast.LENGTH_LONG).show();
  }
}
 

Example 9

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: HelpManager.java

  15 
vote

@Override public void onClick(View view){
  int id=view.getId();
  Intent i=new Intent();
switch (id) {
case R.id.help_email_bt:
    i.setAction(android.content.Intent.ACTION_SEND);
  i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL,EMAIL);
try {
startActivity(Intent.createChooser(i,"Email using..."));
}
 catch (ActivityNotFoundException e) {
Toast.makeText(this,"Sorry, could not start the email",Toast.LENGTH_SHORT).show();
}
break;
case R.id.help_website_bt:
i.setAction(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse(WEB));
try {
startActivity(i);
}
 catch (ActivityNotFoundException e) {
Toast.makeText(this,"Sorry, could not open the website",Toast.LENGTH_SHORT).show();
}
break;
}
}
 

Example 10

From project android-joedayz, under directory /Proyectos/FBConnectTest/src/com/facebook/android/.

Source file: Facebook.java

  15 
vote

/** 
 * Internal method to handle single sign-on backend for authorize().
 * @param activity The Android Activity that will parent the ProxyAuth Activity.
 * @param applicationId The Facebook application identifier.
 * @param permissions A list of permissions required for this application. If you do not require any permissions, pass an empty String array.
 * @param activityCode Activity code to uniquely identify the result Intent in the callback.
 */
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.length > 0) {
    intent.putExtra("scope",TextUtils.join(",",permissions));
  }
  if (!validateActivityIntent(activity,intent)) {
    return false;
  }
  mAuthActivity=activity;
  mAuthPermissions=permissions;
  mAuthActivityCode=activityCode;
  try {
    activity.startActivityForResult(intent,activityCode);
  }
 catch (  ActivityNotFoundException e) {
    didSucceed=false;
  }
  return didSucceed;
}
 

Example 11

From project android-ocr, under directory /android/src/edu/sfsu/cs/orange/ocr/.

Source file: HelpActivity.java

  15 
vote

@Override public boolean shouldOverrideUrlLoading(WebView view,String url){
  if (url.startsWith("file")) {
    return false;
  }
 else   if (url.startsWith("mailto:")) {
    try {
      MailTo mt=MailTo.parse(url);
      Intent i=new Intent(Intent.ACTION_SEND);
      i.setType("message/rfc822");
      i.putExtra(Intent.EXTRA_EMAIL,new String[]{mt.getTo()});
      i.putExtra(Intent.EXTRA_SUBJECT,mt.getSubject());
      context.startActivity(i);
      view.reload();
    }
 catch (    ActivityNotFoundException e) {
      Log.w(TAG,"Problem with Intent.ACTION_SEND",e);
      new AlertDialog.Builder(context).setTitle("Contact Info").setMessage("Please send your feedback to: [email protected]").setPositiveButton("Done",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          Log.d("AlertDialog","Positive");
        }
      }
).show();
    }
    return true;
  }
 else {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(url)));
    return true;
  }
}
 

Example 12

From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharing/src/com/nostra13/socialsharing/facebook/extpack/com/facebook/android/.

Source file: Facebook.java

  15 
vote

/** 
 * Internal method to handle single sign-on backend for authorize().
 * @param activity The Android Activity that will parent the ProxyAuth Activity.
 * @param applicationId The Facebook application identifier.
 * @param permissions A list of permissions required for this application. If you do not require any permissions, pass an empty String array.
 * @param activityCode Activity code to uniquely identify the result Intent in the callback.
 */
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.length > 0) {
    intent.putExtra("scope",TextUtils.join(",",permissions));
  }
  if (!validateAppSignatureForIntent(activity,intent)) {
    return false;
  }
  mAuthActivity=activity;
  mAuthPermissions=permissions;
  mAuthActivityCode=activityCode;
  try {
    activity.startActivityForResult(intent,activityCode);
  }
 catch (  ActivityNotFoundException e) {
    didSucceed=false;
  }
  return didSucceed;
}
 

Example 13

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  15 
vote

private void doEmailTranscript(){
  TermSession session=getCurrentTermSession();
  if (session != null) {
    String addr="[email protected]";
    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();
    }
  }
}
 

Example 14

From project android-tether, under directory /facebook/src/com/facebook/android/.

Source file: Facebook.java

  15 
vote

/** 
 * Internal method to handle single sign-on backend for authorize().
 * @param activity The Android Activity that will parent the ProxyAuth Activity.
 * @param applicationId The Facebook application identifier.
 * @param permissions A list of permissions required for this application. If you do not require any permissions, pass an empty String array.
 * @param activityCode Activity code to uniquely identify the result Intent in the callback.
 */
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.length > 0) {
    intent.putExtra("scope",TextUtils.join(",",permissions));
  }
  if (!validateAppSignatureForIntent(activity,intent)) {
    return false;
  }
  mAuthActivity=activity;
  mAuthPermissions=permissions;
  mAuthActivityCode=activityCode;
  try {
    activity.startActivityForResult(intent,activityCode);
  }
 catch (  ActivityNotFoundException e) {
    didSucceed=false;
  }
  return didSucceed;
}
 

Example 15

From project android-vpn-server, under directory /src/android/security/.

Source file: Credentials.java

  15 
vote

public void unlock(Context context){
  try {
    Intent intent=new Intent(UNLOCK_ACTION);
    context.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOGTAG,e.toString());
  }
}
 

Example 16

From project android-vpn-settings, under directory /src/android/security/.

Source file: Credentials.java

  15 
vote

public void unlock(Context context){
  try {
    Intent intent=new Intent(UNLOCK_ACTION);
    context.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOGTAG,e.toString());
  }
}
 

Example 17

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: ShelvesActivity.java

  15 
vote

private void startScan(int code){
  try {
    final Intent intent=new Intent(ScanIntent.INTENT_ACTION_SCAN);
    intent.putExtra(ScanIntent.INTENT_EXTRA_SCAN_MODE,ScanIntent.INTENT_EXTRA_PRODUCT_MODE);
    startActivityForResult(intent,code);
  }
 catch (  ActivityNotFoundException e) {
    UIUtilities.showToast(this,R.string.error_missing_barcode_scanner,true);
  }
}
 

Example 18

From project androidquery, under directory /auth/com/androidquery/auth/.

Source file: FacebookHandle.java

  15 
vote

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;
}
 

Example 19

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 20

From project android_packages_apps_FileManager, under directory /src/org/openintents/distribution/.

Source file: DownloadAppDialog.java

  15 
vote

/** 
 * Start an activity but prompt a toast if activity is not found (instead of crashing).
 * @param context
 * @param intent
 */
public void startSaveActivity(Intent intent){
  try {
    mContext.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(mContext,R.string.oi_distribution_update_error,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"Error starting second activity.",e);
  }
}
 

Example 21

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: Camera.java

  15 
vote

private void viewLastImage(){
  if (mThumbController.isUriValid()) {
    Uri targetUri=mThumbController.getUri();
    targetUri=targetUri.buildUpon().appendQueryParameter("bucketId",ImageManager.CAMERA_IMAGE_BUCKET_ID).build();
    Intent intent=new Intent(this,ReviewImage.class);
    intent.setData(targetUri);
    intent.putExtra(MediaStore.EXTRA_FULL_SCREEN,true);
    intent.putExtra(MediaStore.EXTRA_SHOW_ACTION_ICONS,true);
    intent.putExtra("com.android.camera.ReviewMode",true);
    try {
      startActivity(intent);
    }
 catch (    ActivityNotFoundException ex) {
      Log.e(TAG,"review image fail",ex);
    }
  }
 else {
    Log.e(TAG,"Can't view last image.");
  }
}
 

Example 22

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/app/.

Source file: PhotoPage.java

  15 
vote

public static void playVideo(Activity activity,Uri uri,String title){
  try {
    Intent intent=new Intent(Intent.ACTION_VIEW).setDataAndType(uri,"video/*").putExtra(Intent.EXTRA_TITLE,title).putExtra(MovieActivity.KEY_TREAT_UP_AS_BACK,true);
    activity.startActivityForResult(intent,REQUEST_PLAY_VIDEO);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(activity,activity.getString(R.string.video_err),Toast.LENGTH_SHORT).show();
  }
}
 

Example 23

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: Util.java

  15 
vote

public static void openMaps(Context context,double latitude,double longitude){
  try {
    String url=String.format("http://maps.google.com/maps?f=q&q=(%s,%s)",latitude,longitude);
    ComponentName compName=new ComponentName(MAPS_PACKAGE_NAME,MAPS_CLASS_NAME);
    Intent mapsIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url)).setComponent(compName);
    context.startActivity(mapsIntent);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"GMM activity not found!",e);
    String url=String.format("geo:%s,%s",latitude,longitude);
    Intent mapsIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
    context.startActivity(mapsIntent);
  }
}
 

Example 24

From project android_packages_apps_Nfc, under directory /src/com/android/nfc/.

Source file: NfcRootActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=getIntent();
  if (intent != null && intent.hasExtra(EXTRA_LAUNCH_INTENT)) {
    final Intent launchIntent=intent.getParcelableExtra(EXTRA_LAUNCH_INTENT);
    if (launchIntent != null) {
      try {
        startActivity(launchIntent);
      }
 catch (      ActivityNotFoundException e) {
      }
    }
  }
  finish();
}
 

Example 25

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/record/.

Source file: UriRecord.java

  15 
vote

@Override public void onClick(View view){
  RecordUtils.ClickInfo info=(RecordUtils.ClickInfo)view.getTag();
  try {
    info.activity.startActivity(info.intent);
    info.activity.finish();
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"Failed to launch activity for intent " + info.intent,e);
  }
}
 

Example 26

From project apg, under directory /src/org/thialfihar/android/apg/.

Source file: DecryptActivity.java

  15 
vote

private void openFile(){
  String filename=mFilename.getText().toString();
  Intent intent=new Intent(Intent.ACTION_GET_CONTENT);
  intent.addCategory(Intent.CATEGORY_OPENABLE);
  intent.setData(Uri.parse("file://" + filename));
  intent.setType("*/*");
  try {
    startActivityForResult(intent,Id.request.filename);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.noFilemanagerInstalled,Toast.LENGTH_SHORT).show();
  }
}
 

Example 27

From project apps-for-android, under directory /Photostream/src/com/google/android/photostream/.

Source file: ViewPhotoActivity.java

  15 
vote

@Override public void onPostExecute(Flickr.Location location){
  if (location != null) {
    final Intent intent=new Intent(RADAR_ACTION);
    intent.putExtra(RADAR_EXTRA_LATITUDE,location.getLatitude());
    intent.putExtra(RADAR_EXTRA_LONGITUDE,location.getLongitude());
    try {
      startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      Toast.makeText(ViewPhotoActivity.this,R.string.error_cannot_find_radar,Toast.LENGTH_SHORT).show();
    }
  }
 else {
    Toast.makeText(ViewPhotoActivity.this,R.string.error_cannot_find_location,Toast.LENGTH_SHORT).show();
  }
}
 

Example 28

From project Barcamp-Bangalore-Android-App, under directory /actionbar/src/com/markupartist/android/widget/.

Source file: ActionBar.java

  15 
vote

@Override public void performAction(View view){
  try {
    mContext.startActivity(mIntent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(mContext,mContext.getText(R.string.actionbar_activity_not_found),Toast.LENGTH_SHORT).show();
  }
}
 

Example 29

From project BazaarUtils, under directory /src/com/congenialmobile/adad/.

Source file: AdView.java

  15 
vote

public void openIntent(String url){
  if (DEBUG_ADAD)   Log.d(TAG,"AdView :: JavaScriptInterface :: openIntent(" + url + "), mBazaarInstalled="+ mBazaarInstalled);
  if ((url == null) || (url.length() == 0))   return;
  if (mBazaarInstalled) {
    if (url.toLowerCase().startsWith("http://cafebazaar.ir/app/?id="))     url="bazaar://details?id=" + url.substring(29);
    if (url.toLowerCase().startsWith("http://cafebazaar.ir/app/"))     url="bazaar://details?id=" + url.substring(25);
    if (url.toLowerCase().startsWith("http://cafebazaar.ir/?id="))     url="bazaar://details?id=" + url.substring(25);
    if (url.toLowerCase().startsWith("http://cafebazaar.ir/vouchers/"))     url="bazaar://vouchers" + url.substring(30);
  }
  Intent i=new Intent(Intent.ACTION_VIEW);
  i.setData(Uri.parse(url));
  try {
    mContext.startActivity(i);
  }
 catch (  ActivityNotFoundException e) {
    Log.w(TAG,"AdView :: JavaScriptInterface :: ActivityNotFoundException:" + url);
  }
}
 

Example 30

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: AdministrationAbout.java

  15 
vote

private void sendContactEmail(int stringId){
  try {
    Intent msg=new Intent(Intent.ACTION_SEND);
    msg.setType("text/plain");
    msg.putExtra(Intent.EXTRA_EMAIL,new String[]{getString(stringId)});
    String subject="[" + getString(R.string.app_name) + "] ";
    msg.putExtra(Intent.EXTRA_SUBJECT,subject);
    AdministrationAbout.this.startActivity(Intent.createChooser(msg,"Send email..."));
  }
 catch (  ActivityNotFoundException e) {
    Logger.logError(e);
  }
}
 

Example 31

From project bookmarktodesktop-android-application, under directory /src/be/vbsteven/bmtodesk/.

Source file: C2DM.java

  15 
vote

private void handleMessage(final Context context,final Intent intent){
  Log.d(Global.TAG + ".C2DM","C2DM message received!");
  final String url=intent.getStringExtra("url");
  Log.d(Global.TAG + ".C2DM","C2DM data: url=" + url);
  BookmarkStore store=BookmarkStore.get(context);
  IncomingBookmark bm=new IncomingBookmark();
  bm.url=url;
  bm.timestamp=System.currentTimeMillis();
  store.addIncomingBookmark(bm);
  Intent i=new Intent(Intent.ACTION_VIEW);
  i.setData(Uri.parse(url));
  i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  try {
    context.startActivity(i);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(Global.TAG,"could not find activity to handle: " + url);
  }
}
 

Example 32

From project box-android-sdk, under directory /BoxAndroidLibrary/src/com/box/androidlib/activities/.

Source file: BoxAuthentication.java

  15 
vote

/** 
 * Load the login webview.
 * @param ticket Ticket from Box API action get_ticket
 */
private void loadLoginWebview(final String ticket){
  String loginUrl=BoxConstants.LOGIN_URL + ticket;
  mLoginWebView=(WebView)findViewById(R.id.loginWebView);
  mLoginWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
  mLoginWebView.getSettings().setJavaScriptEnabled(true);
  mLoginWebView.setWebViewClient(new WebViewClient(){
    @Override public void onPageFinished(    final WebView view,    final String url){
      getAuthToken(ticket,0);
    }
    @Override public boolean shouldOverrideUrlLoading(    final WebView view,    final String url){
      if (url != null && url.startsWith("market://")) {
        try {
          view.getContext().startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(url)));
          return true;
        }
 catch (        ActivityNotFoundException e) {
        }
      }
      return false;
    }
  }
);
  mLoginWebView.loadUrl(loginUrl);
}
 

Example 33

From project buzzwords, under directory /src/com/buzzwords/.

Source file: Title.java

  15 
vote

public void onClick(View v){
  if (BuzzWordsApplication.DEBUG) {
    Log.d(TAG,"AboutUsListener OnClick()");
  }
  v.setEnabled(false);
  mContinueMusic=false;
  SoundManager sm=SoundManager.getInstance(Title.this.getBaseContext());
  sm.playSound(SoundManager.Sound.CONFIRM);
  try {
    String url=getApplication().getString(R.string.URI_fb_launcher_buzzwordsapp);
    Intent facebookIntent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
    startActivity(facebookIntent);
  }
 catch (  ActivityNotFoundException e) {
    Uri uri=Uri.parse(getApplication().getString(R.string.URI_fb_buzzwordsapp));
    Intent browserIntent=new Intent(Intent.ACTION_VIEW);
    browserIntent.setDataAndType(uri,"text/plain");
    startActivity(browserIntent);
  }
}
 

Example 34

From project callmeter, under directory /src/de/ub0r/android/callmeter/ui/.

Source file: PlansFragment.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onClick(final View v){
switch (v.getId()) {
case R.id.import_default:
    final Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(this.getString(R.string.url_rulesets)));
  try {
    this.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"no activity to load url",e);
    Toast.makeText(this.getActivity(),"no activity to load url: " + intent.getDataString(),Toast.LENGTH_LONG).show();
  }
break;
default :
break;
}
}
 

Example 35

From project cmsandroid, under directory /src/com/zia/freshdocs/widget/.

Source file: CMISAdapter.java

  15 
vote

/** 
 * Send the content using a built-in Android activity which can handle the content type.
 * @param position
 */
public void shareContent(int position){
  final NodeRef ref=getItem(position);
  downloadContent(ref,new Handler(){
    public void handleMessage(    Message msg){
      Context context=getContext();
      boolean done=msg.getData().getBoolean("done");
      if (done) {
        dismissProgressDlg();
        File file=(File)_dlThread.getResult();
        if (file != null) {
          Resources res=context.getResources();
          Uri uri=Uri.fromFile(file);
          Intent emailIntent=new Intent(Intent.ACTION_SEND);
          emailIntent.putExtra(Intent.EXTRA_STREAM,uri);
          emailIntent.putExtra(Intent.EXTRA_SUBJECT,ref.getName());
          emailIntent.putExtra(Intent.EXTRA_TEXT,res.getString(R.string.email_text));
          emailIntent.setType(ref.getContentType());
          try {
            context.startActivity(Intent.createChooser(emailIntent,res.getString(R.string.email_title)));
          }
 catch (          ActivityNotFoundException e) {
            String text="No suitable applications registered to send " + ref.getContentType();
            int duration=Toast.LENGTH_SHORT;
            Toast toast=Toast.makeText(context,text,duration);
            toast.show();
          }
        }
      }
 else {
        int value=msg.getData().getInt("progress");
        if (value > 0) {
          _progressDlg.setProgress(value);
        }
      }
    }
  }
);
}
 

Example 36

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 37

From project connectbot, under directory /src/sk/vx/connectbot/util/.

Source file: FileChooser.java

  15 
vote

public static void selectFile(Activity source,FileChooserCallback callback,int requestcode,String title){
  final File sdcard=Environment.getExternalStorageDirectory();
  if (title == null)   title=source.getString(R.string.file_chooser_select_file);
  int mode=SelectionMode.MODE_OPEN;
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(source);
  Intent intent=null;
  String filedialog;
  String appString=null;
  if (prefs == null)   return;
  filedialog=prefs.getString(PreferenceConstants.FILE_DIALOG,"built-in");
  if (filedialog.equals("OI")) {
    appString="OpenIntents File Manager";
    intent=new Intent(FileManagerIntents.ACTION_PICK_FILE);
    intent.setData(Uri.fromFile(sdcard));
    intent.putExtra(FileManagerIntents.EXTRA_TITLE,title);
    intent.putExtra(FileManagerIntents.EXTRA_BUTTON_TEXT,source.getString(android.R.string.ok));
  }
 else   if (filedialog.equals("AE")) {
    appString="AndExplorer";
    intent=new Intent(Intent.ACTION_PICK);
    intent.setDataAndType(Uri.fromFile(sdcard),MIME_TYPE_ANDEXPLORER_FILE);
    intent.putExtra(ANDEXPLORER_TITLE,title);
  }
  if (intent != null && appString != null) {
    try {
      source.startActivityForResult(intent,requestcode);
      return;
    }
 catch (    ActivityNotFoundException e1) {
      Toast.makeText(source,source.getString(R.string.error_starting_app,appString),Toast.LENGTH_LONG).show();
    }
  }
  intent=new Intent(source.getBaseContext(),FileDialog.class);
  intent.putExtra(FileDialog.START_PATH,sdcard.toString());
  intent.putExtra(FileDialog.TITLE,title);
  intent.putExtra(FileDialog.SELECTION_MODE,mode);
  source.startActivityForResult(intent,requestcode);
}
 

Example 38

From project convertcsv, under directory /ConvertCSV/src/org/openintents/convertcsv/common/.

Source file: ConvertCsvBaseActivity.java

  15 
vote

private void openFileManager(){
  String fileName=mEditText.getText().toString();
  Intent intent=new Intent(FileManagerIntents.ACTION_PICK_FILE);
  intent.setData(Uri.parse("file://" + fileName));
  if (RES_STRING_FILEMANAGER_TITLE != 0) {
    intent.putExtra(FileManagerIntents.EXTRA_TITLE,getString(RES_STRING_FILEMANAGER_TITLE));
  }
  if (RES_STRING_FILEMANAGER_BUTTON_TEXT != 0) {
    intent.putExtra(FileManagerIntents.EXTRA_BUTTON_TEXT,getString(RES_STRING_FILEMANAGER_BUTTON_TEXT));
  }
  try {
    startActivityForResult(intent,REQUEST_CODE_PICK_FILE);
  }
 catch (  ActivityNotFoundException e) {
    showDialog(DIALOG_ID_NO_FILE_MANAGER_AVAILABLE);
  }
}
 

Example 39

From project cornerstone, under directory /frameworks/base/policy/src/com/android/internal/policy/impl/.

Source file: PhoneWindowManager.java

  15 
vote

void startDockOrHome(){
  Intent dock=createHomeDockIntent();
  if (dock != null) {
    try {
      mContext.startActivity(dock);
      return;
    }
 catch (    ActivityNotFoundException e) {
    }
  }
  mContext.startActivity(mHomeIntent);
}
 

Example 40

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 41

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: GoogleLocationSettingHelper.java

  15 
vote

/** 
 * Change the value of the 'Use My Location' setting. This launches a GSF activity which has the permissions to actually make the change, prompting the user if necessary.
 */
public static void setUseLocationForServices(Context context,boolean use){
  Intent i=getSetUseLocationIntent();
  i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  i.putExtra(EXTRA_DISABLE_USE_LOCATION_FOR_SERVICES,!use);
  try {
    context.startActivity(i);
  }
 catch (  ActivityNotFoundException e) {
    Log.e("GoogleLocationSettingHelper","Problem while starting GSF location activity");
  }
}
 

Example 42

From project cropimage, under directory /src/com/droid4you/util/cropimage/.

Source file: MainActivity.java

  15 
vote

private void doTakePhotoAction(){
  Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  mImageCaptureUri=Uri.fromFile(new File(Environment.getExternalStorageDirectory(),"tmp_contact_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
  intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,mImageCaptureUri);
  try {
    intent.putExtra("return-data",false);
    startActivityForResult(intent,PICK_FROM_CAMERA);
  }
 catch (  ActivityNotFoundException e) {
    e.printStackTrace();
  }
}
 

Example 43

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 44

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 45

From project DiscogsForAndroid, under directory /src/com/discogs/utils/.

Source file: IntentIntegrator.java

  15 
vote

private AlertDialog showDownloadDialog(){
  AlertDialog.Builder downloadDialog=new AlertDialog.Builder(activity);
  downloadDialog.setTitle(title);
  downloadDialog.setMessage(message);
  downloadDialog.setPositiveButton(buttonYes,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      Uri uri=Uri.parse("market://details?id=" + BS_PACKAGE);
      Intent intent=new Intent(Intent.ACTION_VIEW,uri);
      try {
        activity.startActivity(intent);
      }
 catch (      ActivityNotFoundException anfe) {
        Log.w(TAG,"Android Market is not installed; cannot install Barcode Scanner");
      }
    }
  }
);
  downloadDialog.setNegativeButton(buttonNo,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
    }
  }
);
  return downloadDialog.show();
}
 

Example 46

From project dmix, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 47

From project DownloadProvider, under directory /src/com/mozillaonline/providers/downloads/.

Source file: DownloadReceiver.java

  15 
vote

/** 
 * Open the download that cursor is currently pointing to, since it's completed notification has been clicked.
 */
private void openDownload(Context context,Cursor cursor){
  String filename=cursor.getString(cursor.getColumnIndexOrThrow(Downloads._DATA));
  String mimetype=cursor.getString(cursor.getColumnIndexOrThrow(Downloads.COLUMN_MIME_TYPE));
  Uri path=Uri.parse(filename);
  if (path.getScheme() == null) {
    path=Uri.fromFile(new File(filename));
  }
  Intent activityIntent=new Intent(Intent.ACTION_VIEW);
  activityIntent.setDataAndType(path,mimetype);
  activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  try {
    context.startActivity(activityIntent);
  }
 catch (  ActivityNotFoundException ex) {
    Log.d(Constants.TAG,"no activity for " + mimetype,ex);
  }
}
 

Example 48

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 49

From project droidparts, under directory /extra/src/org/droidparts/util/intent/.

Source file: AndroidMarketHelper.java

  15 
vote

private void launchMarket(String query){
  try {
    Intent intent=new Intent(ACTION_VIEW,Uri.parse(query));
    ctx.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    L.e(e);
    new AbstractDialogFactory(ctx).showErrorToast();
  }
}
 

Example 50

From project dungbeetle, under directory /src/com/facebook/android/.

Source file: Facebook.java

  15 
vote

/** 
 * Internal method to handle single sign-on backend for authorize().
 * @param activity The Android Activity that will parent the ProxyAuth Activity.
 * @param applicationId The Facebook application identifier.
 * @param permissions A list of permissions required for this application. If you do not require any permissions, pass an empty String array.
 * @param activityCode Activity code to uniquely identify the result Intent in the callback.
 */
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.length > 0) {
    intent.putExtra("scope",TextUtils.join(",",permissions));
  }
  if (!validateAppSignatureForIntent(activity,intent)) {
    return false;
  }
  mAuthActivity=activity;
  mAuthPermissions=permissions;
  mAuthActivityCode=activityCode;
  try {
    activity.startActivityForResult(intent,activityCode);
  }
 catch (  ActivityNotFoundException e) {
    didSucceed=false;
  }
  return didSucceed;
}
 

Example 51

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 52

From project facebook-android-sdk, under directory /facebook/src/com/facebook/android/.

Source file: Facebook.java

  15 
vote

/** 
 * Internal method to handle single sign-on backend for authorize().
 * @param activity The Android Activity that will parent the ProxyAuth Activity.
 * @param applicationId The Facebook application identifier.
 * @param permissions A list of permissions required for this application. If you do not require any permissions, pass an empty String array.
 * @param activityCode Activity code to uniquely identify the result Intent in the callback.
 */
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.length > 0) {
    intent.putExtra("scope",TextUtils.join(",",permissions));
  }
  if (!validateActivityIntent(activity,intent)) {
    return false;
  }
  mAuthActivity=activity;
  mAuthPermissions=permissions;
  mAuthActivityCode=activityCode;
  try {
    activity.startActivityForResult(intent,activityCode);
  }
 catch (  ActivityNotFoundException e) {
    didSucceed=false;
  }
  return didSucceed;
}
 

Example 53

From project farebot, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 54

From project FBReaderJ, under directory /src/org/geometerplus/android/fbreader/.

Source file: FBUtil.java

  15 
vote

public static void shareBook(Activity activity,Book book){
  try {
    final ZLPhysicalFile file=book.File.getPhysicalFile();
    if (file == null) {
      return;
    }
    final CharSequence sharedFrom=Html.fromHtml(ZLResource.resource("sharing").getResource("sharedFrom").getValue());
    activity.startActivity(new Intent(Intent.ACTION_SEND).setType(FileTypeCollection.Instance.simplifiedMimeType(file).Name).putExtra(Intent.EXTRA_SUBJECT,book.getTitle()).putExtra(Intent.EXTRA_TEXT,sharedFrom).putExtra(Intent.EXTRA_STREAM,Uri.fromFile(file.javaFile())));
  }
 catch (  ActivityNotFoundException e) {
  }
}
 

Example 55

From project FileExplorer, under directory /src/net/micode/fileexplorer/.

Source file: FavoriteList.java

  15 
vote

public void onFavoriteListItemClick(AdapterView<?> parent,View view,int position,long id){
  FavoriteItem favorite=mFavoriteList.get(position);
  if (favorite.fileInfo.IsDir) {
    FileExplorerTabActivity activity=(FileExplorerTabActivity)mContext;
    ((FileViewActivity)activity.getFragment(Util.SDCARD_TAB_INDEX)).setPath(favorite.location);
    activity.getActionBar().setSelectedNavigationItem(Util.SDCARD_TAB_INDEX);
  }
 else {
    try {
      IntentBuilder.viewFile(mContext,favorite.fileInfo.filePath);
    }
 catch (    ActivityNotFoundException e) {
      Log.e(LOG_TAG,"fail to view file: " + e.toString());
    }
  }
}
 

Example 56

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/.

Source file: SaveAsActivity.java

  15 
vote

private void startPickActivity(Intent intent){
  try {
    startActivityForResult(intent,REQUEST_CODE_PICK_FILE_OR_DIRECTORY);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.saveas_error,Toast.LENGTH_SHORT).show();
  }
}
 

Example 57

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 58

From project forMegaADK, under directory /forMageAdkLib/src/com/tomovwgti/android/accessory/.

Source file: UsbAccessoryAbstractActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=getMainActivity();
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
  try {
    startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    e.printStackTrace();
  }
  finish();
}
 

Example 59

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: PhoneFallbackEventHandler.java

  15 
vote

void startCallActivity(){
  sendCloseSystemWindows();
  Intent intent=new Intent(Intent.ACTION_CALL_BUTTON);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  try {
    mContext.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Slog.w(TAG,"No activity found for android.intent.action.CALL_BUTTON.");
  }
}
 

Example 60

From project gast-lib, under directory /app/src/root/gast/playground/sensor/aoa/.

Source file: UsbAccessoryActivity.java

  15 
vote

/** 
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Intent intent=new Intent(this,BaseActivity.class);
  Log.i(TAG,"starting ui");
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
  try {
    startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"unable to start activity",e);
  }
  finish();
}
 

Example 61

From project Gibberbot, under directory /src/com/google/zxing/integration/android/.

Source file: IntentIntegrator.java

  15 
vote

/** 
 * Invokes scanning.
 * @param stringTitle title of dialog prompting user to download BarcodeScanner
 * @param stringMessage text of dialog prompting user to download BarcodeScanner
 * @param stringButtonYes text of button user clicks when agreeing todownload Barcode Scanner (e.g. "Yes")
 * @param stringButtonNo text of button user clicks when declining todownload Barcode Scanner (e.g. "No")
 * @param stringDesiredBarcodeFormats a comma separated list of codes youwould like to scan for.
 * @return an {@link AlertDialog} if the user was prompted to download theapp, null otherwise
 * @throws InterruptedException if timeout expires before a scan completes
 */
public static AlertDialog initiateScan(Activity activity,CharSequence stringTitle,CharSequence stringMessage,CharSequence stringButtonYes,CharSequence stringButtonNo,CharSequence stringDesiredBarcodeFormats){
  Intent intentScan=new Intent("com.google.zxing.client.android.SCAN");
  intentScan.addCategory(Intent.CATEGORY_DEFAULT);
  if (stringDesiredBarcodeFormats != null) {
    intentScan.putExtra("SCAN_FORMATS",stringDesiredBarcodeFormats);
  }
  try {
    activity.startActivityForResult(intentScan,REQUEST_CODE);
    return null;
  }
 catch (  ActivityNotFoundException e) {
    return showDownloadDialog(activity,stringTitle,stringMessage,stringButtonYes,stringButtonNo);
  }
}
 

Example 62

From project gmarks-android, under directory /src/main/java/org/thomnichols/android/gmarks/.

Source file: SettingsActivity.java

  15 
vote

public boolean onPreferenceClick(Preference pref){
  final String key=pref.getKey();
  if (KEY_FULL_SYNC_ACTION.equals(key)) {
    Log.d(TAG,"Performing full sync...");
    new RemoteSyncTask(this,true).execute();
  }
 else   if (KEY_LOGOUT_ACTION.equals(key)) {
    new GmarksProvider.DatabaseHelper(this).clearCookies();
    BookmarksQueryService.getInstance().clearAuthCookies();
    new WebViewCookiesDB(this).deleteAllCookies();
    Toast.makeText(this,R.string.logged_out_msg,Toast.LENGTH_LONG).show();
  }
 else   if (KEY_SEND_FEEDBACK_ACTION.equals(key)) {
    try {
      startActivityForResult(new Intent(Intent.ACTION_SENDTO,Uri.parse(MAILTO_URI)).putExtra(Intent.EXTRA_SUBJECT,MAILTO_SUBJECT),START_EMAIL_ACTIVITY);
    }
 catch (    ActivityNotFoundException ex) {
      Toast.makeText(this,R.string.error_cant_send_email_msg,Toast.LENGTH_LONG).show();
    }
  }
 else   if (KEY_HIDE_LABELS_ACTION.equals(key)) {
    startActivityForResult(new Intent(Intent.ACTION_CHOOSER).setType(Label.CONTENT_TYPE),START_HIDE_LABELS_ACTIVITY);
  }
 else   if (KEY_FAQ_ACTION.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(FAQ_URI)));
  }
  return false;
}
 

Example 63

From project Gmote, under directory /gmoteclient/src/org/gmote/client/android/.

Source file: ButtonControl.java

  15 
vote

private void startExternalActivity(FileInfo fileInfo,String serverUrl){
  Intent intent=new Intent(Intent.ACTION_VIEW);
  String contentType=MimeTypeResolver.findMimeType(fileInfo.getAbsolutePath());
  boolean unknownContentType=contentType.equals(MimeTypeResolver.UNKNOWN_MIME_TYPE);
  if (unknownContentType) {
    if (fileInfo.getFileType() == FileType.MUSIC) {
      contentType="audio/unknown";
      unknownContentType=false;
    }
 else     if (fileInfo.getFileType() == FileType.VIDEO) {
      contentType="video/unknown";
      unknownContentType=false;
    }
  }
  String sessionId=Remote.getInstance().getSessionId();
  if (sessionId == null) {
    Log.i(DEBUG_TAG,"Null session id when trying to start an external activity");
    ActivityUtil.showMessageBox(this,"Error","Encountered a null session id. Please re-connect to the server by clicking 'menu', 'Gmote Stream' and try again");
    return;
  }
  String url=createUrlFromFilename(fileInfo,serverUrl,!unknownContentType) + "?sessionId=" + sessionId;
  if (contentType.toLowerCase().startsWith("audio/") || contentType.toLowerCase().startsWith("video/")) {
    intent.setDataAndType(Uri.parse(url.toString()),contentType);
  }
 else {
    intent.setData(Uri.parse(url.toString()));
  }
  Log.i(DEBUG_TAG,"Uri is: " + url.toString());
  try {
    startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(DEBUG_TAG,e.getMessage(),e);
    Toast.makeText(ButtonControl.this,"Gmote is unable to find an android application to play this file type: " + e.getMessage(),Toast.LENGTH_LONG).show();
  }
}
 

Example 64

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 65

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 66

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/actions/.

Source file: InsertNote.java

  15 
vote

/** 
 * Collecting additional data
 */
private void addVideo(){
  Intent i=new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
  File file=new File(Constants.getSdCardTmpFile(this));
  Log.d(TAG,"Video requested at: " + file);
  i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,Uri.fromFile(file));
  i.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY,1);
  try {
    startActivityForResult(i,MENU_VIDEO);
  }
 catch (  ActivityNotFoundException e) {
    Log.e(TAG,"Unable to start Activity to record video",e);
  }
}
 

Example 67

From project Hawksword, under directory /src/com/bw/hawksword/ocr/.

Source file: HelpActivity.java

  15 
vote

@Override public boolean shouldOverrideUrlLoading(WebView view,String url){
  if (url.startsWith("file")) {
    return false;
  }
 else   if (url.startsWith("mailto:")) {
    try {
      MailTo mt=MailTo.parse(url);
      Intent i=new Intent(Intent.ACTION_SEND);
      i.setType("message/rfc822");
      i.putExtra(Intent.EXTRA_EMAIL,new String[]{mt.getTo()});
      i.putExtra(Intent.EXTRA_SUBJECT,mt.getSubject());
      context.startActivity(i);
      view.reload();
    }
 catch (    ActivityNotFoundException e) {
      Log.w(TAG,"Problem with Intent.ACTION_SEND",e);
      new AlertDialog.Builder(context).setTitle("Contact Info").setMessage("Please send your feedback to: [email protected]").setPositiveButton("Done",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          Log.d("AlertDialog","Positive");
        }
      }
).show();
    }
    return true;
  }
 else {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(url)));
    return true;
  }
}
 

Example 68

From project Hax-Launcher, under directory /src/com/t3hh4xx0r/haxlauncher/.

Source file: Launcher.java

  15 
vote

boolean startActivitySafely(Intent intent,Object tag){
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  try {
    startActivity(intent);
    return true;
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.activity_not_found,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"Unable to launch. tag=" + tag + " intent="+ intent,e);
  }
catch (  SecurityException e) {
    Toast.makeText(this,R.string.activity_not_found,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"Launcher does not have the permission to launch " + intent + ". Make sure to create a MAIN intent-filter for the corresponding activity "+ "or use the exported attribute for this activity. "+ "tag="+ tag+ " intent="+ intent,e);
  }
  return false;
}
 

Example 69

From project HeLauncher, under directory /src/com/handlerexploit/launcher_reloaded/.

Source file: Launcher.java

  15 
vote

public void onButtonSMS(View view){
  try {
    startActivity(new Intent().setClassName("com.android.mms","com.android.mms.ui.ConversationList"));
  }
 catch (  ActivityNotFoundException e) {
    makeToast(NOT_SUPPORTED);
  }
catch (  SecurityException e) {
    makeToast(NOT_SUPPORTED);
  }
}
 

Example 70

From project hsDroid, under directory /src/de/nware/app/hsDroid/ui/.

Source file: Certifications.java

  15 
vote

private void openPDF(File file){
  if (file.exists()) {
    Uri path=Uri.fromFile(file);
    Intent intent=new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(path,"application/pdf");
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    try {
      startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      showToast(getString(R.string.error_NoPdfApp));
    }
  }
 else {
    showToast(getString(R.string.text_file) + " \"" + file+ "\" "+ getString(R.string.text_NotFound));
  }
}
 

Example 71

From project HSR-Timetable, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 72

From project huiswerk, under directory /print/zxing-1.6/android/src/com/google/zxing/client/android/result/.

Source file: ResultHandler.java

  15 
vote

void launchIntent(Intent intent){
  if (intent != null) {
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    try {
      activity.startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      AlertDialog.Builder builder=new AlertDialog.Builder(activity);
      builder.setTitle(R.string.app_name);
      builder.setMessage(R.string.msg_intent_failed);
      builder.setPositiveButton(R.string.button_ok,null);
      builder.show();
    }
  }
}
 

Example 73

From project iosched_3, under directory /android/src/com/google/android/apps/iosched/util/.

Source file: UIUtils.java

  15 
vote

public static void safeOpenLink(Context context,Intent linkIntent){
  try {
    context.startActivity(linkIntent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(context,"Couldn't open link",Toast.LENGTH_SHORT).show();
  }
}
 

Example 74

From project IRC-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 75

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/.

Source file: Main.java

  15 
vote

public void run(){
  if (mIntent == null) {
    mIntent=new Intent();
    mIntent.setAction(Intent.ACTION_VIEW);
  }
  mIntent.setDataAndType(Uri.parse("file://" + mInstanceState.filename),"text/plain");
  try {
    startActivity(mIntent);
  }
 catch (  ActivityNotFoundException e) {
  }
  mIntent=null;
}
 

Example 76

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/usb/.

Source file: UsbAccessoryUriActivity.java

  15 
vote

public void onClick(DialogInterface dialog,int which){
  if (which == AlertDialog.BUTTON_POSITIVE) {
    Intent intent=new Intent(Intent.ACTION_VIEW,mUri);
    intent.addCategory(Intent.CATEGORY_BROWSABLE);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
      startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"startActivity failed for " + mUri);
    }
  }
  finish();
}
 

Example 77

From project k-9, under directory /src/com/fsck/k9/crypto/.

Source file: Apg.java

  15 
vote

/** 
 * Select the signature key.
 * @param activity
 * @param pgpData
 * @return success or failure
 */
@Override public boolean selectSecretKey(Activity activity,PgpData pgpData){
  android.content.Intent intent=new android.content.Intent(Intent.SELECT_SECRET_KEY);
  intent.putExtra(EXTRA_INTENT_VERSION,INTENT_VERSION);
  try {
    activity.startActivityForResult(intent,Apg.SELECT_SECRET_KEY);
    return true;
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(activity,R.string.error_activity_not_found,Toast.LENGTH_SHORT).show();
    return false;
  }
}
 

Example 78

From project keepassdroid, under directory /src/com/keepassdroid/.

Source file: EntryEditActivity.java

  15 
vote

public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_donate:
    try {
      Util.gotoUrl(this,R.string.donate_url);
    }
 catch (    ActivityNotFoundException e) {
      Toast.makeText(this,R.string.error_failed_to_launch_link,Toast.LENGTH_LONG).show();
      return false;
    }
  return true;
case R.id.menu_toggle_pass:
if (mShowPassword) {
  item.setTitle(R.string.show_password);
  mShowPassword=false;
}
 else {
  item.setTitle(R.string.menu_hide_password);
  mShowPassword=true;
}
setPasswordStyle();
return true;
}
return super.onOptionsItemSelected(item);
}
 

Example 79

From project LitHub, under directory /LitHub-Android/src/com/markupartist/android/widget/.

Source file: ActionBar.java

  15 
vote

@Override public void performAction(View view){
  try {
    mContext.startActivity(mIntent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(mContext,mContext.getText(R.string.actionbar_activity_not_found),Toast.LENGTH_SHORT).show();
  }
}
 

Example 80

From project Locast-Android, under directory /src/com/google/zxing/integration/android/.

Source file: IntentIntegrator.java

  15 
vote

/** 
 * Invokes scanning.
 * @param stringTitle title of dialog prompting user to download Barcode Scanner
 * @param stringMessage text of dialog prompting user to download Barcode Scanner
 * @param stringButtonYes text of button user clicks when agreeing to downloadBarcode Scanner (e.g. "Yes")
 * @param stringButtonNo text of button user clicks when declining to downloadBarcode Scanner (e.g. "No")
 * @return the contents of the barcode that was scanned, or null if none was found
 * @throws InterruptedException if timeout expires before a scan completes
 */
public static void initiateScan(Activity activity,String stringTitle,String stringMessage,String stringButtonYes,String stringButtonNo){
  final Intent intentScan=new Intent("com.google.zxing.client.android.SCAN");
  intentScan.addCategory(Intent.CATEGORY_DEFAULT);
  try {
    activity.startActivityForResult(intentScan,REQUEST_CODE);
  }
 catch (  final ActivityNotFoundException e) {
    showDownloadDialog(activity,stringTitle,stringMessage,stringButtonYes,stringButtonNo);
  }
}
 

Example 81

From project MensaUPB, under directory /libs/ActionbarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 82

From project MicDroid, under directory /src/com/intervigil/micdroid/helper/.

Source file: RecordingOptionsHelper.java

  15 
vote

public static void playRecording(Context context,Recording recording){
  try {
    Intent playIntent=new Intent(Intent.ACTION_VIEW);
    playIntent.setDataAndType(Uri.fromFile(recording.asFile()),Constants.MIME_AUDIO_WAV);
    context.startActivity(playIntent);
  }
 catch (  ActivityNotFoundException e) {
    Intent playIntent=new Intent(context,RecordingPlayer.class);
    Bundle playData=new Bundle();
    playData.putParcelable(Constants.INTENT_EXTRA_RECORDING,recording);
    playIntent.putExtras(playData);
    context.startActivity(playIntent);
  }
}
 

Example 83

From project MIT-Mobile-for-Android, under directory /src/com/google/zxing/client/android/result/.

Source file: ResultHandler.java

  15 
vote

void launchIntent(Intent intent){
  if (intent != null) {
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    try {
      activity.startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      AlertDialog.Builder builder=new AlertDialog.Builder(activity);
      builder.setTitle(R.string.app_name);
      builder.setMessage(R.string.msg_intent_failed);
      builder.setPositiveButton(R.string.button_ok,null);
      builder.show();
    }
  }
}
 

Example 84

From project mixare, under directory /plugins/mixare-barcode-plugin/src/org/mixare/plugin/barcode/intent/.

Source file: IntentIntegrator.java

  15 
vote

private AlertDialog showDownloadDialog(){
  AlertDialog.Builder downloadDialog=new AlertDialog.Builder(activity);
  downloadDialog.setTitle(title);
  downloadDialog.setMessage(message);
  downloadDialog.setPositiveButton(buttonYes,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      Uri uri=Uri.parse("market://details?id=" + BS_PACKAGE);
      Intent intent=new Intent(Intent.ACTION_VIEW,uri);
      try {
        activity.startActivity(intent);
      }
 catch (      ActivityNotFoundException anfe) {
        Log.w(TAG,"Android Market is not installed; cannot install Barcode Scanner");
      }
    }
  }
);
  downloadDialog.setNegativeButton(buttonNo,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
    }
  }
);
  return downloadDialog.show();
}
 

Example 85

From project Mobile-Tour-Guide, under directory /zxing-2.0/android/src/com/google/zxing/client/android/result/.

Source file: ResultHandler.java

  15 
vote

void launchIntent(Intent intent){
  if (intent != null) {
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    Log.d(TAG,"Launching intent: " + intent + " with extras: "+ intent.getExtras());
    try {
      activity.startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      AlertDialog.Builder builder=new AlertDialog.Builder(activity);
      builder.setTitle(R.string.app_name);
      builder.setMessage(R.string.msg_intent_failed);
      builder.setPositiveButton(R.string.button_ok,null);
      builder.show();
    }
  }
}
 

Example 86

From project mWater-Android-App, under directory /android/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 87

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 88

From project NotePad, under directory /NotePad/src/org/openintents/notepad/noteslist/.

Source file: NotesList.java

  15 
vote

public void decryptTitle(String encryptedTitle){
  Intent intent=new Intent();
  intent.setAction(CryptoIntents.ACTION_DECRYPT);
  if (encryptedTitle != null) {
    intent.putExtra(CryptoIntents.EXTRA_TEXT,encryptedTitle);
    intent.putExtra(PrivateNotePadIntents.EXTRA_ENCRYPTED_TEXT,encryptedTitle);
  }
  intent.putExtra(CryptoIntents.EXTRA_PROMPT,false);
  try {
    startActivityForResult(intent,REQUEST_CODE_DECRYPT_TITLE);
  }
 catch (  ActivityNotFoundException e) {
    mDecryptionFailed=true;
    Log.e(TAG,"failed to invoke encrypt");
  }
}
 

Example 89

From project ohmagePhone, under directory /src/org/ohmage/prompt/remoteactivity/.

Source file: RemoteActivityPrompt.java

  15 
vote

/** 
 * Creates an Intent from the given 'activityName' and then launches the Intent.
 */
private void launchActivity(){
  if (callingActivity != null) {
    Intent activityToLaunch=new Intent(actionName);
    activityToLaunch.setComponent(new ComponentName(packageName,activityName));
    activityToLaunch.putExtra("input",input);
    try {
      callingActivity.startActivityForResult(activityToLaunch,REQUEST_CODE);
      launched=true;
      runs++;
    }
 catch (    ActivityNotFoundException e) {
      Toast.makeText(callingActivity,"Required component is not installed",Toast.LENGTH_SHORT).show();
    }
  }
 else {
    Log.e(TAG,"The calling Activity was null.");
  }
}
 

Example 90

From project Ohmage_Phone, under directory /src/org/ohmage/prompt/remoteactivity/.

Source file: RemoteActivityPrompt.java

  15 
vote

/** 
 * Creates an Intent from the given 'activityName' and then launches the Intent.
 */
private void launchActivity(){
  if (callingActivity != null) {
    Intent activityToLaunch=new Intent(actionName);
    activityToLaunch.setComponent(new ComponentName(packageName,activityName));
    activityToLaunch.putExtra("input",input);
    try {
      callingActivity.startActivityForResult(activityToLaunch,0);
      launched=true;
      runs++;
    }
 catch (    ActivityNotFoundException e) {
      Toast.makeText(callingActivity,"Required component is not installed",Toast.LENGTH_SHORT).show();
    }
  }
 else {
    Log.e(TAG,"The calling Activity was null.");
  }
}
 

Example 91

From project onebusaway-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 92

From project open311-android, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuItemImpl.java

  15 
vote

/** 
 * Invokes the item by calling various listeners or callbacks.
 * @return true if the invocation was handled, false otherwise
 */
public boolean invoke(){
  if (mClickListener != null && mClickListener.onMenuItemClick(this)) {
    return true;
  }
  if (mMenu.dispatchMenuItemSelected(mMenu.getRootMenu(),this)) {
    return true;
  }
  if (mItemCallback != null) {
    mItemCallback.run();
    return true;
  }
  if (mIntent != null) {
    try {
      mMenu.getContext().startActivity(mIntent);
      return true;
    }
 catch (    ActivityNotFoundException e) {
      Log.e(TAG,"Can't find activity to handle intent; ignoring",e);
    }
  }
  if (mActionProvider != null && mActionProvider.onPerformDefaultAction()) {
    return true;
  }
  return false;
}
 

Example 93

From project Orweb, under directory /src/org/torproject/android/.

Source file: OrbotHelper.java

  15 
vote

public static AlertDialog initOrbot(Activity activity,CharSequence stringTitle,CharSequence stringMessage,CharSequence stringButtonYes,CharSequence stringButtonNo,CharSequence stringDesiredBarcodeFormats){
  Intent intentScan=new Intent("org.torproject.android.START_TOR");
  intentScan.addCategory(Intent.CATEGORY_DEFAULT);
  try {
    activity.startActivityForResult(intentScan,REQUEST_CODE);
    return null;
  }
 catch (  ActivityNotFoundException e) {
    return showDownloadDialog(activity,stringTitle,stringMessage,stringButtonYes,stringButtonNo);
  }
}
 

Example 94

From project packages_apps_Camera_1, under directory /src/com/android/camera/.

Source file: MenuHelper.java

  15 
vote

private static void startCameraActivity(Activity activity,Intent intent,String className){
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
  intent.setClassName(activity.getPackageName(),className);
  CameraHolder.instance().keep();
  try {
    activity.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    intent.setComponent(null);
    activity.startActivity(intent);
  }
  activity.overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
}
 

Example 95

From project packages_apps_Camera_2, under directory /src/com/android/camera/.

Source file: MenuHelper.java

  15 
vote

private static void startCameraActivity(Activity activity,Intent intent,String className){
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
  intent.setClassName(activity.getPackageName(),className);
  CameraHolder.instance().keep();
  try {
    activity.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    intent.setComponent(null);
    activity.startActivity(intent);
  }
  activity.overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
}
 

Example 96

From project packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: DownloadAppDialog.java

  15 
vote

/** 
 * Start an activity but prompt a toast if activity is not found (instead of crashing).
 * @param context
 * @param intent
 */
public void startSaveActivity(Intent intent){
  try {
    mContext.startActivity(intent);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(mContext,R.string.oi_distribution_update_error,Toast.LENGTH_SHORT).show();
    Log.e(TAG,"Error starting second activity.",e);
  }
}
 

Example 97

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  15 
vote

/** 
 * Do some delayed cleanup after a Phone call gets disconnected. This method gets called a couple of seconds after any DISCONNECT event from the Phone; it's triggered by the DELAYED_CLEANUP_AFTER_DISCONNECT message we send in onDisconnect(). If the Phone is totally idle right now, that means we've already shown the "call ended" state for a couple of seconds, and it's now time to endInCallScreenSession this activity. If the Phone is *not* idle right now, that probably means that one call ended but the other line is still in use.  In that case, do nothing, and instead stay here on the InCallScreen.
 */
private void delayedCleanupAfterDisconnect(){
  log("delayedCleanupAfterDisconnect()...  Phone state = " + mCM.getState());
  mCM.clearDisconnected();
  boolean stayHere=phoneIsInUse() || mApp.inCallUiState.isProgressIndicationActive();
  if (stayHere) {
    log("- delayedCleanupAfterDisconnect: staying on the InCallScreen...");
  }
 else {
    if (DBG)     log("- delayedCleanupAfterDisconnect: phone is idle...");
    if (mIsForegroundActivity) {
      if (DBG)       log("- delayedCleanupAfterDisconnect: finishing InCallScreen...");
      if (VDBG)       log("- Post-call behavior:");
      if (VDBG)       log("  - mLastDisconnectCause = " + mLastDisconnectCause);
      if (VDBG)       log("  - isPhoneStateRestricted() = " + isPhoneStateRestricted());
      if ((mLastDisconnectCause != Connection.DisconnectCause.INCOMING_MISSED) && (mLastDisconnectCause != Connection.DisconnectCause.INCOMING_REJECTED) && !isPhoneStateRestricted()&& PhoneApp.sVoiceCapable) {
        final Intent intent=mApp.createPhoneEndIntentUsingCallOrigin();
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        if (VDBG) {
          log("- Show Call Log (or Dialtacts) after disconnect. Current intent: " + intent);
        }
        try {
          startActivity(intent);
        }
 catch (        ActivityNotFoundException e) {
          Log.w(LOG_TAG,"delayedCleanupAfterDisconnect: " + "transition to call log failed; intent = " + intent);
        }
      }
      endInCallScreenSession();
    }
    mApp.setLatestActiveCallOrigin(null);
  }
}