List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:com.appnexus.opensdk.mediatednativead.InMobiNativeAdResponse.java
boolean setResources(final InMobiNative imNative) { this.imNative = imNative; try {/*from www .ja v a2s .c o m*/ nativeElements.put(InMobiSettings.NATIVE_ELEMENT_OBJECT, imNative); JSONObject response = new JSONObject((String) imNative.getAdContent()); title = JsonUtil.getJSONString(response, InMobiSettings.KEY_TITLE); callToAction = JsonUtil.getJSONString(response, InMobiSettings.KEY_CALL_TO_ACTION); description = JsonUtil.getJSONString(response, InMobiSettings.KEY_DESCRIPTION); JSONObject iconObject = JsonUtil.getJSONObject(response, InMobiSettings.KEY_ICON); iconUrl = JsonUtil.getJSONString(iconObject, InMobiSettings.KEY_URL); JSONObject imageObject = JsonUtil.getJSONObject(response, InMobiSettings.KEY_IMAGE); imageUrl = JsonUtil.getJSONString(imageObject, InMobiSettings.KEY_URL); if (JsonUtil.getJSONDouble(response, InMobiSettings.KEY_RATING) >= 0) { rating = new Rating(JsonUtil.getJSONDouble(response, InMobiSettings.KEY_RATING), 5); } landingUrl = JsonUtil.getJSONString(response, InMobiSettings.KEY_LANDING_URL); clickListener = new View.OnClickListener() { @Override public void onClick(View v) { imNative.reportAdClick(null); // no additional params passed in for click tracking onAdClicked(); if (v != null && landingUrl != null && !landingUrl.isEmpty()) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(landingUrl)); browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); onAdWillLeaveApplication(); v.getContext().startActivity(browserIntent); } } }; return true; } catch (Exception e) { // Catches JSONException for parsing, // ClassCastException for String casting, // NPE for null imNative } return false; }
From source file:com.netpace.expressit.activity.UploadImageStoryActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (!isGalleryPhoto) { this.onBackPressed(); } else {//from w ww . j a v a 2 s . c o m Intent intent = new Intent(UploadImageStoryActivity.this, MediaOptionsActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } return true; case R.id.menu_item_img_gallery: if (isValidate()) { // close the keyboard. InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(titleTextView.getWindowToken(), 0); getMediaKeyFromRemoteServer(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:samples.piggate.com.piggateCompleteExample.buyOfferActivity.java
public void backButton() { Intent slideactivity = new Intent(buyOfferActivity.this, Activity_Logged.class); slideactivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions .makeCustomAnimation(getApplicationContext(), R.anim.slidefromleft, R.anim.slidetoright).toBundle(); startActivity(slideactivity, bndlanimation); }
From source file:no.ntnu.idi.socialhitchhiking.utility.ShareOnFacebook.java
/** * Action for do not share button. When pressed application goes back to main and deletes activity stack. * @param button/*w w w.j a v a2s . co m*/ */ public void doNotShare(View button) { Intent intent = new Intent(ShareOnFacebook.this, Main.class); startActivity(intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); showToast("Trip created"); finish(); }
From source file:li.klass.fhem.appwidget.view.widget.medium.TargetStateWidgetView.java
@Override protected void fillWidgetView(Context context, RemoteViews view, FhemDevice<?> device, WidgetConfiguration widgetConfiguration) { String payload = widgetConfiguration.payload.get(1); String state = device.getEventMapStateFor(payload); view.setTextViewText(R.id.button, state); PendingIntent pendingIntent;/* w w w . j a v a2 s . c om*/ if (requiresAdditionalInformation(state)) { Intent actionIntent = new Intent(context, TargetStateAdditionalInformationActivity.class); actionIntent.putExtra(BundleExtraKeys.DEVICE_NAME, device.getName()); actionIntent.putExtra(BundleExtraKeys.DEVICE_TARGET_STATE, payload); actionIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); pendingIntent = PendingIntent.getActivity(context, widgetConfiguration.widgetId, actionIntent, FLAG_UPDATE_CURRENT); } else { Intent actionIntent = new Intent(Actions.DEVICE_SET_STATE); actionIntent.setClass(context, DeviceIntentService.class); actionIntent.putExtra(BundleExtraKeys.DEVICE_NAME, device.getName()); actionIntent.putExtra(BundleExtraKeys.DEVICE_TARGET_STATE, payload); pendingIntent = PendingIntent.getService(context, widgetConfiguration.widgetId, actionIntent, FLAG_UPDATE_CURRENT); } view.setOnClickPendingIntent(R.id.button, pendingIntent); openDeviceDetailPageWhenClicking(R.id.main, view, device, widgetConfiguration, context); }
From source file:no.ntnu.idi.socialhitchhiking.utility.ShareOnFacebook.java
/** * Post to facebook wall and goes back to main screen deleting activity stack. * @param button/*from ww w . j a v a 2 s. c om*/ */ public void share(View button) { // if (! facebook.isSessionValid()) { // loginAndPostToWall(); // postToWall(messageToPost); // } // else { postToWall(messageToPost); Intent intent = new Intent(ShareOnFacebook.this, Main.class); startActivity(intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); // } }
From source file:org.openplans.rcavl.LocationService.java
public void realStart(Intent intent) { String url = intent.getStringExtra("pingUrl"); String email = intent.getStringExtra("email"); String password = intent.getStringExtra("password"); pingInterval = intent.getIntExtra("pingInterval", 60); Notification notification = new Notification(R.drawable.icon, "Ridepilot Mobile", System.currentTimeMillis()); Intent appIntent = new Intent(this, RCAVL.class); appIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, appIntent, 0); notification.setLatestEventInfo(this, "Ridepilot Mobile", "connected", pi); notification.flags |= Notification.FLAG_NO_CLEAR; startForeground(66786, notification); thread = new LocationServiceThread(url, email, password); new Thread(thread).start(); }
From source file:fr.itinerennes.ItineRennesApplication.java
/** * Inits ACRA and strict mode./* w w w. jav a 2 s . co m*/ * * @see android.app.Application#onCreate() */ @Override public final void onCreate() { if (Conf.ACRA_ENABLED) { // The following line triggers the initialization of ACRA ACRA.init(this); } setupStrictMode(); final Intent i = new Intent(this, LoadingActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); startActivity(i); super.onCreate(); }
From source file:samples.piggate.com.piggateCompleteExample.Activity_SingIn.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _piggate = new Piggate(this, null); //Initialize the Piggate object getSupportActionBar().setTitle("Login"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); setContentView(R.layout.activity_login); //EditTexts for user email and password editEmail = (EditText) findViewById(R.id.editText1); editPass = (EditText) findViewById(R.id.editText2); Button login = (Button) findViewById(R.id.buttonlogin); errorDialog = new AlertDialog.Builder(this).create(); errorDialog.setTitle("Login error"); errorDialog.setMessage("There is an error with the login"); errorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override//w w w. jav a 2s .c o m public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); networkErrorDialog = new AlertDialog.Builder(this).create(); networkErrorDialog.setTitle("Network error"); networkErrorDialog.setMessage("There is an error with the network connection"); networkErrorDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); //OnClick listener for the login button //Handles the login request to the server with the email and password fields login.setOnClickListener(new View.OnClickListener() { @Override synchronized public void onClick(View v) { String email = editEmail.getText().toString(); String pass = editPass.getText().toString(); //If the internet connection is working if (checkInternetConnection() == true) { if (editEmail.getText().toString().equals("") || editPass.getText().toString().equals("")) { if (editEmail.getText().toString().equals("")) editEmail.setError("Enter your email"); if (editPass.getText().toString().equals("")) editPass.setError("Enter your password"); } else { loadingDialog = ProgressDialog.show(v.getContext(), "Singing In", "Wait a few seconds", true); RequestParams params = new RequestParams(); params.put("email", email); params.put("password", pass); //Request of the Piggate object. Handles the login into the application with the user email and password _piggate.RequestOpenSession(params).setListenerRequest(new Piggate.PiggateCallBack() { //Method onComplete for JSONObject //When the request is correct start Activity_Logged activity @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONObject data) { loadingDialog.dismiss(); Intent slideactivity = new Intent(Activity_SingIn.this, Activity_Logged.class); slideactivity .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slidefromright, R.anim.slidetoleft).toBundle(); startActivity(slideactivity, bndlanimation); } //Method onError for JSONObject //If there's an error with the request displays the error message to the user @Override public void onError(int statusCode, Header[] headers, String msg, JSONObject data) { loadingDialog.dismiss(); runOnUiThread(new Runnable() { @Override public void run() { errorDialog.show(); } }); } //Method onComplete for JSONArray @Override public void onComplete(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } //Method onError for JSONArray @Override public void onError(int statusCode, Header[] headers, String msg, JSONArray data) { //Unused } }).exec(); } } else { //If the internet connection is not working networkErrorDialog.show(); } } }); }
From source file:com.netpace.expressit.activity.UploadImageStoryActivity.java
private void publishMediaOnRemoteServer() { dialog.setMessage("Publish data on XIT"); Media media = new Media(); media.setMediaShortURL(fileKey);/*from www. j a va 2s .c om*/ media.setMediaName(fileKey + "." + FileUtils.getFileExtension(img_filePath)); media.setMediaCaption(titleTextView.getText().toString()); media.setMediaType(MediaTypeEnum.IMAGE); Meta meta = new Meta(); meta.setWidth(widthAfter); meta.setHeight(heightAfter); media.setMeta(meta); ADMediaSharingUtil.getRestClient(UploadImageStoryActivity.this) .load(AppConstants.DOMAIN_URL + AppConstants.PUBLISH_MEDIA_URL).setJsonObjectBody(media).asString() .withResponse().setCallback(new FutureCallback<Response<String>>() { @Override public void onCompleted(Exception e, Response<String> result) { if (dialog.isShowing()) dialog.dismiss(); if (e == null && result.getHeaders().getResponseCode() == HttpStatus.SC_OK) { Toast.makeText(UploadImageStoryActivity.this, "Uploaded Successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(UploadImageStoryActivity.this, SlideMenuActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { Toast.makeText(UploadImageStoryActivity.this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } } }); }