Skip to content

Instantly share code, notes, and snippets.

View ameliacv's full-sized avatar

Mujtahidah ameliacv

View GitHub Profile
private static final int OPEN_THING = 99;
public void openGallery() {
int preference = ScanConstants.OPEN_MEDIA;
Intent intent = new Intent(this, ScanActivity.class);
intent.putExtra(ScanConstants.OPEN_INTENT_PREFERENCE, preference);
startActivityForResult(intent, OPEN_THING);
}
public void openCamera() {
int preference = ScanConstants.OPEN_CAMERA;
Intent intent = new Intent();
final PendingIntent pendingIntent = PendingIntent.getActivity(
CONTEXT, 0, intent, 0);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(CONTEXT)
.setSmallIcon(YOUR_ICON)
.setContentTitle(mContext.getString(R.string.label_upload_video));
mBuilder.setContentIntent(pendingIntent);
notificationManager =
Intent intent = new Intent(WHAT EVER YOU WANT);
//u can put extra data too
PendingIntent pendingIntent = PendingIntent.getActivity(CONTEXT, 1, intent, 0);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(CONTEXT)
.setSmallIcon(YOUR ICON)
.setContentTitle(CONTEXT.getString(R.string.alert_success_upload))
.setContentText(BLAH);
mBuilder.setContentIntent(pendingIntent);