android.widget.Toast Java Examples

The following examples show how to use android.widget.Toast. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From AndroidHttpCapture with MIT License 7 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else if (fam.isOpened()) {
        fam.close(true);
    } else if (mBackHandedFragment == null || !(mBackHandedFragment instanceof WebViewFragment)) {
        switchContent(WebViewFragment.getInstance());
    } else if (!mBackHandedFragment.onBackPressed()) {
        if ((System.currentTimeMillis() - exitTime) > 2000) {
            Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
            exitTime = System.currentTimeMillis();
        } else {
            finish();
            System.exit(0);
        }
    }
}
 
Example #2
Source File: MainActivity.java    From BaiDuMapSelectDemo with Apache License 2.0 7 votes vote down vote up
@Override
public void onGetPoiDetailResult(PoiDetailSearchResult poiDetailSearchResult) {
    if (poiDetailSearchResult.error != SearchResult.ERRORNO.NO_ERROR) {
        Toast.makeText(mContext, "抱歉,未找到结果", Toast.LENGTH_SHORT).show();
    } else {
        List<PoiDetailInfo> poiDetailInfoList = poiDetailSearchResult.getPoiDetailInfoList();
        if (null == poiDetailInfoList || poiDetailInfoList.isEmpty()) {
            Toast.makeText(mContext, "抱歉,检索结果为空", Toast.LENGTH_SHORT).show();
            return;
        }

        for (int i = 0; i < poiDetailInfoList.size(); i++) {
            PoiDetailInfo poiDetailInfo = poiDetailInfoList.get(i);
            if (null != poiDetailInfo) {
                Toast.makeText(mContext,
                        poiDetailInfo.getName() + ": " + poiDetailInfo.getAddress(),
                        Toast.LENGTH_SHORT).show();
            }
        }
    }
}
 
Example #3
Source File: Cardbar.java    From SimplicityBrowser with MIT License 6 votes vote down vote up
public static @CheckResult
    Toast snackBar(Context context, CharSequence message_to_show, boolean duration) {
    @SuppressLint("InflateParams")
    View view = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.custom_snackbar, null);
    AppCompatTextView message = view.findViewById(R.id.message);
    message.setText(message_to_show);
    Toast toast = new Toast(context);
    toast.setView(view);
    toast.setGravity(Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 0, 0);
    if (duration) {
        toast.setDuration(Toast.LENGTH_LONG);
    } else {
        toast.setDuration(Toast.LENGTH_SHORT);
    }
    return toast;
}
 
Example #4
Source File: ClipObjectActionBridge.java    From Clip-Stack with MIT License 6 votes vote down vote up
private void copyText(final String clips) {
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            //copy clips to clipboard
            ClipboardManager cb = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
            cb.setText(clips);

            //make toast
            String toastClips =clips;
            if ( clips.length() > 15) {
                toastClips = clips.substring(0, 15) + "…";
            }
            Toast.makeText(ClipObjectActionBridge.this,
                    getString(R.string.toast_copied, toastClips+"\n"),
                    Toast.LENGTH_SHORT
            ).show();

        }
    });

}
 
Example #5
Source File: BucketVideoFragment.java    From MediaChooser with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    getActivity().getWindow().setBackgroundDrawable(null);

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(broadcastReceiver, new IntentFilter(MediaChooserConstants.BRAODCAST_VIDEO_RECEIVER));


    if (mView == null) {
        mView = inflater.inflate(R.layout.view_grid_layout_media_chooser, container, false);
        mGridView = (GridView) mView.findViewById(R.id.gridViewFromMediaChooser);
        init();
    } else {
        if (mView.getParent() != null) {
            ((ViewGroup) mView.getParent()).removeView(mView);
        }
        if (mBucketAdapter == null || mBucketAdapter.getCount() == 0) {
            Toast.makeText(getActivity(), getActivity().getString(R.string.no_media_file_available), Toast.LENGTH_SHORT).show();
        }
    }
    return mView;
}
 
Example #6
Source File: MainActivity.java    From MediaLoader with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    initMediaLoader();
    initListView();
    findViewById(R.id.cleanCache).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            try {
                DownloadManager.getInstance(MainActivity.this).cleanCacheDir();
            } catch (IOException e) {
                Toast.makeText(MainActivity.this, "Error clean cache", Toast.LENGTH_LONG).show();
            }
        }
    });
}
 
Example #7
Source File: CheckupReminders.java    From Crimson with Apache License 2.0 6 votes vote down vote up
private void setReminder() {

        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle(getString(R.string.app_name));
        progressDialog.setMessage(getString(R.string.wait));
        progressDialog.setIndeterminate(true);
        progressDialog.setCancelable(false);

        String name = nameET.getText().toString();
        String address = addressET.getText().toString();
        String full_date = onDateEt.getText().toString();

        if (name.trim().length() > 0 && address.trim().length() > 0 && full_date.trim().length() > 0) {

            progressDialog.show();
            setReminderNow(name, address, full_date);

        } else
            Toast.makeText(this, getString(R.string.please_input), Toast.LENGTH_LONG).show();

    }
 
Example #8
Source File: PermissionHelper.java    From grafika with Apache License 2.0 6 votes vote down vote up
public static void requestCameraPermission(Activity activity, boolean requestWritePermission) {

    boolean showRationale = ActivityCompat.shouldShowRequestPermissionRationale(activity,
              Manifest.permission.CAMERA) || (requestWritePermission &&
    ActivityCompat.shouldShowRequestPermissionRationale(activity,
            Manifest.permission.WRITE_EXTERNAL_STORAGE));
    if (showRationale) {
        Toast.makeText(activity,
                "Camera permission is needed to run this application", Toast.LENGTH_LONG).show();
      } else {

        // No explanation needed, we can request the permission.

      String permissions[] = requestWritePermission ? new String[]{Manifest.permission.CAMERA,
              Manifest.permission.WRITE_EXTERNAL_STORAGE}: new String[]{Manifest.permission.CAMERA};
        ActivityCompat.requestPermissions(activity,permissions,RC_PERMISSION_REQUEST);
      }
    }
 
Example #9
Source File: ToastUtils.java    From Mount with GNU General Public License v3.0 6 votes vote down vote up
private static void show(Context context, String text, boolean isLong) {
    RxUtils.disposeSafety(sDisposable);

    if (sToast != null) {
        sToast.setText(text);
    } else {
        sToast = Toast.makeText(context, text, !isLong ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG);
    }

    sToast.show();
    sDisposable = Observable.timer(!isLong ? SHORT_DELAY : LONG_DELAY, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Consumer<Long>() {
                @Override
                public void accept(Long aLong) throws Exception {
                    sToast.cancel();
                }
            }, new Consumer<Throwable>() {
                @Override
                public void accept(Throwable throwable) throws Exception {
                    throwable.printStackTrace();
                }
            });
}
 
Example #10
Source File: ManageTexturepacksActivity.java    From MCPELauncher with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPostExecute(Void result) {
	dialog.dismiss();
	if (outFile.exists()) {
		adapter.add(outFile);
		adapter.notifyDataSetChanged();
		saveHistory();
		setTexturepack(outFile);
		Toast.makeText(ManageTexturepacksActivity.this, R.string.extract_textures_success,
				Toast.LENGTH_SHORT).show();
	} else {
		new AlertDialog.Builder(ManageTexturepacksActivity.this)
				.setMessage(
						hasSu ? R.string.extract_textures_error
								: R.string.extract_textures_no_root)
				.setPositiveButton(android.R.string.ok, null).show();
	}
}
 
Example #11
Source File: BrowserWeiboMsgFragment.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onClick(View v) {

    // This condition will satisfy only when it is not an autolinked
    // text
    // onClick action
    boolean isNotLink = layout.recontent.getSelectionStart() == -1 && layout.recontent.getSelectionEnd() == -1;
    boolean isDeleted = msg.getRetweeted_status() == null || msg.getRetweeted_status().getUser() == null;

    if (isNotLink && !isDeleted) {
        startActivity(BrowserWeiboMsgActivity.newIntent(BeeboApplication.getInstance().getAccountBean(),
                msg.getRetweeted_status(), BeeboApplication
                        .getInstance().getAccessTokenHack()));
    } else if (isNotLink) {
        Toast.makeText(getActivity(), getString(R.string.cant_open_deleted_weibo), Toast.LENGTH_SHORT).show();
    }

}
 
Example #12
Source File: ShareUtils.java    From A-week-to-develop-android-app-plan with Apache License 2.0 6 votes vote down vote up
/**
 * 设置分享回调
 * 
 * @param
 */
public static void registerCallback(final Context context) {
	mController.getConfig().cleanListeners();
	mController.getConfig().registerListener(new SnsPostListener() {

		@Override
		public void onStart() {

		}

		@Override
		public void onComplete(SHARE_MEDIA platform, int stCode,
				SocializeEntity entity) {
			if (stCode == 200) {
				Toast.makeText(context, "分享成功", Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(context, "分享失败", Toast.LENGTH_SHORT).show();
			}
		}
	});
}
 
Example #13
Source File: QrGeneratorDisplayActivity.java    From privacy-friendly-qr-scanner with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_url_gnr);

    Button btnstore = findViewById(R.id.btnstore);
    ImageView myImage = findViewById(R.id.imageView1);

    Bundle QRData = getIntent().getExtras();//from QRGenerator
    qrInputText = QRData.getString("gn");
    qrInputType = QRData.getString("type");

    Glide.with(this).load(QRGeneratorUtils.createImage(this, qrInputText, qrInputType)).into(myImage);

    btnstore.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            QRGeneratorUtils.saveCachedImageToExternalStorage(QrGeneratorDisplayActivity.this);

            Intent i = new Intent(QrGeneratorDisplayActivity.this, ScannerActivity.class);
            startActivity(i);
            Toast.makeText(QrGeneratorDisplayActivity.this, "QR code stored in gallery", Toast.LENGTH_LONG).show();
        }
    });
}
 
Example #14
Source File: SaveAttachmentTask.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(final Pair<Integer, String> result) {
  super.onPostExecute(result);
  final Context context = contextReference.get();
  if (context == null) return;

  switch (result.first()) {
    case FAILURE:
      Toast.makeText(context,
                     context.getResources().getString(R.string.error),
                     Toast.LENGTH_LONG).show();
      break;
    case SUCCESS:
      String dir = result.second();
      Toast.makeText(context,
                     dir==null? context.getString(R.string.done) : context.getString(R.string.file_saved_to, dir),
                     Toast.LENGTH_LONG).show();
      break;
    case WRITE_ACCESS_FAILURE:
      Toast.makeText(context, R.string.error,
          Toast.LENGTH_LONG).show();
      break;
  }
}
 
Example #15
Source File: UpdateManager.java    From MyBookshelf with GNU General Public License v3.0 6 votes vote down vote up
public void checkUpdate(boolean showMsg) {
    BaseModelImpl.getInstance().getRetrofitString("https://api.github.com")
            .create(IHttpGetApi.class)
            .get(MApplication.getInstance().getString(R.string.latest_release_api), AnalyzeHeaders.getMap(null))
            .flatMap(response -> analyzeLastReleaseApi(response.body()))
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new MyObserver<UpdateInfoBean>() {
                @Override
                public void onNext(UpdateInfoBean updateInfo) {
                    if (updateInfo.getUpDate()) {

                    } else if (showMsg) {
                        Toast.makeText(activity, "已是最新版本", Toast.LENGTH_SHORT).show();

                    }
                }

                @Override
                public void onError(Throwable e) {
                    if (showMsg) {
                        Toast.makeText(activity, "检测新版本出错", Toast.LENGTH_SHORT).show();
                    }
                }
            });
}
 
Example #16
Source File: SubscribedThingListingActivity.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 6 votes vote down vote up
public void deleteMultiReddit(MultiReddit multiReddit) {
    new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
            .setTitle(R.string.delete)
            .setMessage(R.string.delete_multi_reddit_dialog_message)
            .setPositiveButton(R.string.delete, (dialogInterface, i)
                    -> DeleteMultiReddit.deleteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase,
                    mAccessToken, mAccountName, multiReddit.getPath(), new DeleteMultiReddit.DeleteMultiRedditListener() {
                        @Override
                        public void success() {
                            Toast.makeText(SubscribedThingListingActivity.this,
                                    R.string.delete_multi_reddit_success, Toast.LENGTH_SHORT).show();
                            loadMultiReddits();
                        }

                        @Override
                        public void failed() {
                            Toast.makeText(SubscribedThingListingActivity.this,
                                    R.string.delete_multi_reddit_failed, Toast.LENGTH_SHORT).show();
                        }
                    }))
            .setNegativeButton(R.string.cancel, null)
            .show();
}
 
Example #17
Source File: LoginActivity.java    From xmrwallet with Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
    if (f instanceof GenerateReviewFragment) {
        if (((GenerateReviewFragment) f).backOk()) {
            super.onBackPressed();
        }
    } else if (f instanceof NodeFragment) {
        if (!((NodeFragment) f).isRefreshing()) {
            super.onBackPressed();
        } else {
            Toast.makeText(LoginActivity.this, getString(R.string.node_refresh_wait), Toast.LENGTH_LONG).show();
        }
    } else if (f instanceof LoginFragment) {
        if (((LoginFragment) f).isFabOpen()) {
            ((LoginFragment) f).animateFAB();
        } else {
            super.onBackPressed();
        }
    } else {
        super.onBackPressed();
    }
}
 
Example #18
Source File: ToolbarForActionBarActivity.java    From AndroidViewDemo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    String result = "";
    switch (item.getItemId()) {
        case R.id.ac_toolbar_copy:
            result = "Copy";
            break;
        case R.id.ac_toolbar_cut:
            result = "Cut";
            break;
        case R.id.ac_toolbar_del:
            result = "Del";
            break;
        case R.id.ac_toolbar_edit:
            result = "Edit";
            break;
        case R.id.ac_toolbar_email:
            result = "Email";
            break;
    }
    Toast.makeText(this, result, Toast.LENGTH_SHORT).show();
    return super.onOptionsItemSelected(item);
}
 
Example #19
Source File: IntentHelper.java    From fanfouapp-opensource with Apache License 2.0 5 votes vote down vote up
public static void startSmsIntent(final Context context,
        final String phoneNumber) {
    try {
        final Uri uri = Uri.parse("sms:" + phoneNumber);
        final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        intent.putExtra("address", phoneNumber);
        intent.setType("vnd.android-dir/mms-sms");
        context.startActivity(intent);
    } catch (final Exception ex) {
        Log.e(IntentHelper.TAG, "Error starting sms intent.", ex);
        Toast.makeText(context,
                "Sorry, we couldn't find any app to send an SMS!",
                Toast.LENGTH_SHORT).show();
    }
}
 
Example #20
Source File: MainActivity.java    From goprohero with MIT License 5 votes vote down vote up
public void sendModeMSTimeLapse(View view) {
	Vibrator v = (Vibrator)getSystemService(VIBRATOR_SERVICE);
       v.vibrate(80);
	Toast.makeText(getApplicationContext(), 
               "Timelapse mode!", Toast.LENGTH_SHORT).show();
	new HttpAsyncTask().execute("http://10.5.5.9/gp/gpControl/setting/70/2");
}
 
Example #21
Source File: DownLoadActivity.java    From Ruisi with Apache License 2.0 5 votes vote down vote up
/**
 * 下载完成
 */
private void downloadCompete() {
    downloadInfo.setText(fileName + "下载完成!");
    mProgressBar.setProgress(100);
    Toast.makeText(this, "下载完成,文件保存在" + FileUtil.DOWNLOAD_PATH,Toast.LENGTH_LONG).show();
    btnClose.setText("浏览");
    btnClose.setOnClickListener(v -> FileUtil.requestHandleFile(getApplicationContext(), fileName));
    btnCancel.setText("关闭");
    btnCancel.setOnClickListener(view -> finish());
}
 
Example #22
Source File: AboutToast.java    From NoteCrypt with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Display a Toast with information about the application.
 *
 * @param packageManager usually retrieved by getPackageManager()
 * @param packageName    usually retrieved by getPackageName()
 */
void createAboutToast(final PackageManager packageManager, final String packageName, final Toast toast, final Context mContext) {
    try {
        final PackageInfo pInfo = packageManager.getPackageInfo(packageName, 0);
        toast.setText(mContext.getString(R.string.toast_version) + " " + pInfo.versionName
                + mContext.getString(R.string.toast_createdBy));
        toast.show();
    } catch (NameNotFoundException e) {
        toast.setText(R.string.toast_errorVersion);
        toast.show();
    }
}
 
Example #23
Source File: MainActivity.java    From Paddle-Lite-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (grantResults[0] != PackageManager.PERMISSION_GRANTED || grantResults[1] != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show();
    }
}
 
Example #24
Source File: HyperionGrabberTileService.java    From hyperion-android-grabber with MIT License 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    Tile tile = getQsTile();
    boolean running = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TAG, false);
    String error = intent.getStringExtra(HyperionScreenService.BROADCAST_ERROR);
    tile.setState(running ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
    tile.updateTile();
    if (error != null) {
        Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show();
    }
}
 
Example #25
Source File: ArcMenuActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.arc_menu_activity);

    ArcMenu arcMenu = (ArcMenu) findViewById(R.id.arc_menu);
    ArcMenu arcMenu2 = (ArcMenu) findViewById(R.id.arc_menu_2);

    initArcMenu(arcMenu, ITEM_DRAWABLES);
    initArcMenu(arcMenu2, ITEM_DRAWABLES);

    RayMenu rayMenu = (RayMenu) findViewById(R.id.ray_menu);
    final int itemCount = ITEM_DRAWABLES.length;
    for (int i = 0; i < itemCount; i++) {
        ImageView item = new ImageView(this);
        item.setImageResource(ITEM_DRAWABLES[i]);

        final int position = i;
        rayMenu.addItem(item, new OnClickListener() {

            @Override
            public void onClick(View v) {
                Toast.makeText(ArcMenuActivity.this, "position:" + position, Toast.LENGTH_SHORT).show();
            }
        });// Add a menu item
    }
}
 
Example #26
Source File: CommCareSessionService.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
/**
 * Calls the provided runnable ensuring that if there is currently an active
 * form session being executed that it is interrupted and stored
 *
 */
public void proceedWithSavedSessionIfNeeded(Runnable callback)  {
    // save form progress, if any
    synchronized (lock) {
        if (formSaver != null) {
            Toast.makeText(CommCareApplication.instance(),
                    "Suspending existing form entry session...", Toast.LENGTH_LONG).show();
            formSaver.formSaveCallback(callback);
            formSaver = null;
            return;
        }
    }
    //No forms to be saved, just run the callback immediately
    callback.run();
}
 
Example #27
Source File: BaseDragActivity.java    From SwipeRecyclerView-master with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(SwipeMenuBridge menuBridge) {
    menuBridge.closeMenu();

    int direction = menuBridge.getDirection(); // 左侧还是右侧菜单。
    int adapterPosition = menuBridge.getAdapterPosition(); // RecyclerView的Item的position。
    int menuPosition = menuBridge.getPosition(); // 菜单在RecyclerView的Item中的Position。

    if (direction == SwipeMenuRecyclerView.RIGHT_DIRECTION) {
        Toast.makeText(BaseDragActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
    } else if (direction == SwipeMenuRecyclerView.LEFT_DIRECTION) {
        Toast.makeText(BaseDragActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition, Toast.LENGTH_SHORT).show();
    }
}
 
Example #28
Source File: WXPageActivity.java    From yanxuan-weex-demo with MIT License 5 votes vote down vote up
private void handleDecodeInternally(String code) {

    if (!TextUtils.isEmpty(code)) {
      Uri uri = Uri.parse(code);
      if (uri.getQueryParameterNames().contains("bundle")) {
        WXEnvironment.sDynamicMode = uri.getBooleanQueryParameter("debug", false);
        WXEnvironment.sDynamicUrl = uri.getQueryParameter("bundle");
        String tip = WXEnvironment.sDynamicMode ? "Has switched to Dynamic Mode" : "Has switched to Normal Mode";
        Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
        finish();
        return;
      } else if (uri.getQueryParameterNames().contains("_wx_devtool")) {
        WXEnvironment.sRemoteDebugProxyUrl = uri.getQueryParameter("_wx_devtool");
        WXEnvironment.sDebugServerConnectable = true;
        WXSDKEngine.reload();
        Toast.makeText(this, "devtool", Toast.LENGTH_SHORT).show();
        return;
      } else if (code.contains("_wx_debug")) {
        uri = Uri.parse(code);
        String debug_url = uri.getQueryParameter("_wx_debug");
        WXSDKEngine.switchDebugModel(true, debug_url);
        finish();
      } else {
        JSONObject data = new JSONObject();
        try {
          data.put("WeexBundle", Uri.parse(code).toString());
          Intent intent = new Intent(WXPageActivity.this, WXPageActivity.class);
          intent.setData(Uri.parse(data.toString()));
          startActivity(intent);
        } catch (JSONException e) {
          e.printStackTrace();
        }
      }
    }
  }
 
Example #29
Source File: SwipeDismissActivity.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss(AbsListView listView, int[] reverseSortedPositions) {
	for (int position : reverseSortedPositions) {
		mAdapter.remove(position);
	}
	Toast.makeText(this, "Removed positions: " + Arrays.toString(reverseSortedPositions), Toast.LENGTH_SHORT).show();
}
 
Example #30
Source File: TabletSessionFragment.java    From remoteyourcam-usb with Apache License 2.0 5 votes vote down vote up
@Override
public void capturedPictureReceived(int objectHandle, String filename, Bitmap thumbnail, Bitmap bitmap) {

    Log.i(TAG, "capturedPictureReceived filename: "+filename);
    if (!inStart) {
        bitmap.recycle();
        return;
    }
    showsCapturedPicture = true;
    if (isPro && liveViewToggle.isChecked()) {
        if (!showCapturedPictureDurationManual && !showCapturedPictureNever) {
            handler.postDelayed(liveViewRestarterRunner, showCapturedPictureDuration);
        } else {
            btnLiveview.setVisibility(View.VISIBLE);
        }
    }
    thumbnailAdapter.addFront(objectHandle, filename, thumbnail);
    liveView.setPicture(bitmap);
    Toast.makeText(getActivity(), filename, Toast.LENGTH_SHORT).show();
    if (currentCapturedBitmap != null) {
        currentCapturedBitmap.recycle();
    }
    currentCapturedBitmap = bitmap;
    if (bitmap == null) {
        Toast.makeText(getActivity(), "Error decoding picture. Try to reduce picture size in settings!",
                Toast.LENGTH_LONG).show();
    }
}