List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:com.example.carsharing.LongWayActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { photouri = Uri/* w w w .ja va 2 s. com*/ .fromFile(new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), IMAGE_FILE_NAME2)); System.out.println("abc"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_long_way); activity_drawer = new Drawer(this, R.id.long_way_layout); mDrawerToggle = activity_drawer.newdrawer(); mDrawerLayout = activity_drawer.setDrawerLayout(); // standard_date = new SimpleDateFormat("yyyy-MM-dd", Locale.SIMPLIFIED_CHINESE); primary_date = new SimpleDateFormat("yyyyMMdd", Locale.SIMPLIFIED_CHINESE); queue = Volley.newRequestQueue(this); exchange = (ImageView) findViewById(R.id.longway_exchange); exchange.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String temp = startplace.getText().toString(); startplace.setText(endplace.getText().toString()); endplace.setText(temp); } }); bdriver = true; datebutton = (Button) findViewById(R.id.longway_dates); increase = (Button) findViewById(R.id.longway_increase); decrease = (Button) findViewById(R.id.longway_decrease); s1 = (TextView) findViewById(R.id.longway_count); sure = (Button) findViewById(R.id.longway_sure); sure.setEnabled(false); startplace = (EditText) findViewById(R.id.longway_start_place); endplace = (EditText) findViewById(R.id.longway_end_place); noteinfo = (EditText) findViewById(R.id.longway_remarkText); commute = findViewById(R.id.drawer_commute); shortway = findViewById(R.id.drawer_shortway); longway = findViewById(R.id.drawer_longway); drawericon = (ImageView) findViewById(R.id.drawer_icon); drawername = (TextView) findViewById(R.id.drawer_name); drawernum = (TextView) findViewById(R.id.drawer_phone); carbrand = (EditText) findViewById(R.id.longway_CarBrand); model = (EditText) findViewById(R.id.longway_CarModel); color = (EditText) findViewById(R.id.longway_color); setting = findViewById(R.id.drawer_setting); licensenum = (EditText) findViewById(R.id.longway_Num); licensenum.addTextChangedListener(numTextWatcher); carbrand.addTextChangedListener(detTextWatcher); color.addTextChangedListener(coTextWatcher); model.addTextChangedListener(moTextWatcher); startplace.addTextChangedListener(spTextWatcher); endplace.addTextChangedListener(epTextWatcher); final TextView content = (TextView) findViewById(R.id.longway_content); longway_group = (RadioGroup) findViewById(R.id.longway_radiobutton); passangerRadioButton = (RadioButton) findViewById(R.id.longway_radioButton02); driverRadioButton = (RadioButton) findViewById(R.id.longway_radioButton01); personalcenter = findViewById(R.id.drawer_personalcenter); taxi = findViewById(R.id.drawer_taxi); // judge the value of "pre_page" Bundle bundle = this.getIntent().getExtras(); String PRE_PAGE = bundle.getString("pre_page"); if (PRE_PAGE.compareTo("ReOrder") == 0) { // startplace.setText(bundle.getString("stpmapname")); bstart = true; endplace.setText(bundle.getString("epmapname")); bend = true; datebutton.setText(bundle.getString("re_longway_startdate")); bdate = true; } // judge the value of "pre_page" // SharedPreferences sharedPref = this.getSharedPreferences(getString(R.string.PreferenceDefaultName), Context.MODE_PRIVATE); UserPhoneNumber = sharedPref.getString(getString(R.string.PreferenceUserPhoneNumber), "0"); // database db = new DatabaseHelper(getApplicationContext(), UserPhoneNumber, null, 1); db1 = db.getWritableDatabase(); about = findViewById(R.id.drawer_respond); about.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent about = new Intent(LongWayActivity.this, AboutActivity.class); startActivity(about); } }); setting.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent setting = new Intent(LongWayActivity.this, SettingActivity.class); startActivity(setting); } }); // database end taxi.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); } }); personalcenter.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent personalcenter = new Intent(LongWayActivity.this, PersonalCenterActivity.class); personalcenter.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(personalcenter); } }); // RadioGroup longway_group.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int checkedId) { // TODO Auto-generated method stub18 // ID // """"textView if (checkedId == passangerRadioButton.getId()) { bpassenager = true; bdriver = false; licensenum.setEnabled(false); carbrand.setEnabled(false); color.setEnabled(false); model.setEnabled(false); licensenum.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); carbrand.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); color.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); model.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return source.length() < 1 ? dest.subSequence(dstart, dend) : ""; } } }); content.setText(getString(R.string.warningInfo_seatNeed)); licensenum.setHintTextColor(Color.parseColor("#cccccc")); carbrand.setHintTextColor(Color.parseColor("#cccccc")); color.setHintTextColor(Color.parseColor("#cccccc")); model.setHintTextColor(Color.parseColor("#cccccc")); licensenum.setInputType(InputType.TYPE_NULL); carbrand.setInputType(InputType.TYPE_NULL); color.setInputType(InputType.TYPE_NULL); model.setInputType(InputType.TYPE_NULL); } else { bpassenager = false; bdriver = true; licensenum.setEnabled(true); carbrand.setEnabled(true); color.setEnabled(true); model.setEnabled(true); licensenum.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); carbrand.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); color.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); model.setFilters(new InputFilter[] { new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { return null; } } }); content.setText(getString(R.string.warningInfo_seatOffer)); licensenum.setHintTextColor(Color.parseColor("#9F35FF")); carbrand.setHintTextColor(Color.parseColor("#9F35FF")); color.setHintTextColor(Color.parseColor("#9F35FF")); model.setHintTextColor(Color.parseColor("#9F35FF")); // licensenum.setText(""); // carbrand.setText(""); // color.setText(""); // model.setText(""); licensenum.setInputType(InputType.TYPE_CLASS_TEXT); carbrand.setInputType(InputType.TYPE_CLASS_TEXT); color.setInputType(InputType.TYPE_CLASS_TEXT); model.setInputType(InputType.TYPE_CLASS_TEXT); // start! selectcarinfo(UserPhoneNumber); // end! } confirm(); } private void selectcarinfo(final String phonenum) { // TODO Auto-generated method stub String carinfo_selectrequest_baseurl = getString(R.string.uri_base) + getString(R.string.uri_CarInfo) + getString(R.string.uri_selectcarinfo_action); Log.d("carinfo_selectrequest_baseurl", carinfo_selectrequest_baseurl); StringRequest stringRequest = new StringRequest(Request.Method.POST, carinfo_selectrequest_baseurl, new Response.Listener<String>() { @Override public void onResponse(String response) { // TODO Auto-generated method stub Log.d("carinfo_select", response); String jas_id = null; JSONObject json1 = null; try { json1 = new JSONObject(response); JSONObject json = json1.getJSONObject("result"); jas_id = json.getString("id"); if (jas_id.compareTo("") != 0) { // carinfochoosing_type = 2; carbrand.setText(json.getString("carBrand")); model.setText(json.getString("carModel")); licensenum.setText(json.getString("carNum")); color.setText(json.getString("carColor")); } { carinfochoosing_type = 1; } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub Log.e("carinfo_selectresult_result", error.getMessage(), error); } }) { protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("phonenum", phonenum); return params; } }; queue.add(stringRequest); } }); sure.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if (longway_group.getCheckedRadioButtonId() == passangerRadioButton.getId()) userrole = "p"; else userrole = "d"; // start! Context phonenumber = LongWayActivity.this; SharedPreferences filename = phonenumber .getSharedPreferences(getString(R.string.PreferenceDefaultName), Context.MODE_PRIVATE); username = filename.getString("refreshfilename", "0"); longway_request(username, userrole, datebutton.getText().toString(), startplace.getText().toString(), endplace.getText().toString(), noteinfo.getText().toString()); // end! } private void longway_request(final String longway_phonenum, final String longway_userrole, final String longway_startdate, final String longway_startplace, final String longway_destination, final String longway_noteinfo) { // TODO Auto-generated method stub String longway_addrequest_baseurl = getString(R.string.uri_base) + getString(R.string.uri_LongwayPublish) + getString(R.string.uri_addpublish_action); // + "phonenum=" + longway_phonenum // + "&userrole=" + longway_userrole // + "&startdate=" + standard_longway_startdate // + "&startplace=" + longway_startplace // + "&destination=" + longway_destination // + "¬einfo=" + longway_noteinfo; // Log.d("longway_baseurl",longway_addrequest_baseurl); StringRequest stringRequest = new StringRequest(Request.Method.POST, longway_addrequest_baseurl, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.d("longway_result", response); JSONObject json1 = null; try { json1 = new JSONObject(response); requestok = json1.getBoolean("result"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (requestok == true) { if (carinfochoosing_type == 1) { // add // start! carinfo(longway_phonenum, licensenum.getText().toString(), carbrand.getText().toString(), model.getText().toString(), color.getText().toString(), String.valueOf(sum), 1); // end! } else { // update // start! carinfo(longway_phonenum, licensenum.getText().toString(), carbrand.getText().toString(), model.getText().toString(), color.getText().toString(), String.valueOf(sum), 2); // end! } Intent sure = new Intent(LongWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "true"); sure.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(sure); } else { // Toast errorinfo = // Toast.makeText(getApplicationContext(), // "", Toast.LENGTH_LONG); // errorinfo.show(); Intent sure = new Intent(LongWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "false"); sure.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(sure); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("longway_result", error.getMessage(), error); // Toast errorinfo = Toast.makeText(null, // "", Toast.LENGTH_LONG); // errorinfo.show(); Intent sure = new Intent(LongWayActivity.this, OrderResponseActivity.class); sure.putExtra(getString(R.string.request_response), "false"); sure.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(sure); } }) { protected Map<String, String> getParams() { // POSTgetParams // start try { test_date = primary_date.parse(longway_startdate); standard_longway_startdate = standard_date.format(test_date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } // end! Map<String, String> params = new HashMap<String, String>(); params.put(getString(R.string.uri_phonenum), longway_phonenum); params.put(getString(R.string.uri_userrole), longway_userrole); params.put(getString(R.string.uri_startplace), longway_startplace); params.put(getString(R.string.uri_destination), longway_destination); params.put(getString(R.string.uri_startdate), standard_longway_startdate); params.put(getString(R.string.uri_noteinfo), longway_noteinfo); return params; } }; queue.add(stringRequest); } }); // start! shortway.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent shortway = new Intent(LongWayActivity.this, ShortWayActivity.class); startActivity(shortway); } }); longway.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); } }); commute.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mDrawerLayout.closeDrawer(findViewById(R.id.left_drawer)); Intent commute = new Intent(LongWayActivity.this, CommuteActivity.class); startActivity(commute); } }); // end! increase.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub sum++; s1.setText("" + sum); confirm(); } }); decrease.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub sum--; if (sum < 0) { sum = 0; } s1.setText("" + sum); confirm(); } }); datebutton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub showDialog(DATE_DIALOG); } }); }
From source file:org.wso2.iot.agent.services.operation.OperationManager.java
/** * Ring the device./* w ww. jav a 2 s.c o m*/ * * @param operation - Operation object. */ public void ringDevice(org.wso2.iot.agent.beans.Operation operation) { operation.setStatus(resources.getString(R.string.operation_value_completed)); resultBuilder.build(operation); Intent intent = new Intent(context, AlertActivity.class); intent.putExtra(resources.getString(R.string.intent_extra_type), resources.getString(R.string.intent_extra_ring)); intent.putExtra(resources.getString(R.string.intent_extra_message_text), resources.getString(R.string.intent_extra_stop_ringing)); intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Ringing is activated on the device"); } }
From source file:org.wso2.emm.agent.services.operation.OperationManager.java
/** * Configure device VPN profile.//from www .j av a 2 s . c o m * * @param operation - Operation object. */ public void configureVPN(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { String serverAddress = null; JSONObject result = new JSONObject(); try { JSONObject vpnData = new JSONObject(operation.getPayLoad().toString()); if (!vpnData.isNull(resources.getString(R.string.intent_extra_server))) { serverAddress = (String) vpnData.get(resources.getString(R.string.intent_extra_server)); } } catch (JSONException e) { operation.setStatus(resources.getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing VPN payload."); resultBuilder.build(operation); throw new AndroidAgentException("Invalid JSON format.", e); } if (serverAddress != null) { Intent intent = new Intent(context, AlertActivity.class); intent.putExtra(resources.getString(R.string.intent_extra_message_text), resources.getString(R.string.toast_message_vpn)); intent.putExtra(resources.getString(R.string.intent_extra_operation_id), operation.getId()); intent.putExtra(resources.getString(R.string.intent_extra_payload), operation.getPayLoad().toString()); intent.putExtra(resources.getString(R.string.intent_extra_type), Constants.Operation.VPN); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); context.startActivity(intent); } if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "VPN configured"); } operation.setStatus(resources.getString(R.string.operation_value_completed)); operation.setPayLoad(result.toString()); resultBuilder.build(operation); }
From source file:dev.ukanth.ufirewall.Api.java
public static void showAlertDialogActivity(Context ctx, String title, String message) { Intent dialog = new Intent(ctx, AlertDialogActivity.class); dialog.putExtra("title", title); dialog.putExtra("message", message); dialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(dialog);/*from www . j av a2 s. com*/ }
From source file:au.com.infiniterecursion.vidiom.utils.PublishingUtils.java
public void launchEmailIntentWithCurrentVideo(final Activity activity, final String latestVideoFile_absolutepath) { Log.d(TAG, "launchEmailIntentWithCurrentVideo starting"); Intent i = new Intent(Intent.ACTION_SEND); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // XXX hardcoded video mimetype i.setType("video/mp4"); i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + latestVideoFile_absolutepath)); activity.startActivity(i);/*from www .j av a 2s.com*/ }
From source file:co.beem.project.beem.FbTextService.java
public void startForeGroundWithnotification(int statusStringId) { // Notification note=new Notification(R.drawable.ic_stat_pending_notification, // getString(R.string.notification_welcome), // System.currentTimeMillis()); isStartingForeground = true;//from ww w.jav a 2s . co m Intent i = new Intent(this, FbTextMainActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); if (statusStringId == 0) { int statusState = mSettings.getInt(FbTextApplication.STATUS_KEY, 0); statusStringId = statusState == 0 ? R.string.notification_online : R.string.notification_invisible; } Notification note = new NotificationCompat.Builder(this).setContentTitle(getString(statusStringId)) .setContentText(getString(R.string.notification_description)) .setSmallIcon(R.drawable.ic_stat_pending_notification).setContentIntent(pi).build(); /*note.setLatestEventInfo(this, getString(statusStringId), getString(R.string.notification_description), pi);*/ note.flags |= Notification.FLAG_NO_CLEAR; startForeground(1080, note); }
From source file:dev.ukanth.ufirewall.Api.java
@SuppressLint("InlinedApi") public static void showInstalledAppDetails(Context context, String packageName) { final String SCHEME = "package"; final String APP_PKG_NAME_21 = "com.android.settings.ApplicationPkgName"; final String APP_PKG_NAME_22 = "pkg"; final String APP_DETAILS_PACKAGE_NAME = "com.android.settings"; final String APP_DETAILS_CLASS_NAME = "com.android.settings.InstalledAppDetails"; Intent intent = new Intent(); final int apiLevel = Build.VERSION.SDK_INT; if (apiLevel >= 9) { // above 2.3 intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromParts(SCHEME, packageName, null); intent.setData(uri);//w w w .j av a 2 s . c o m } else { // below 2.3 final String appPkgName = (apiLevel == 8 ? APP_PKG_NAME_22 : APP_PKG_NAME_21); intent.setAction(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClassName(APP_DETAILS_PACKAGE_NAME, APP_DETAILS_CLASS_NAME); intent.putExtra(appPkgName, packageName); } context.startActivity(intent); }