List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
From source file:com.app.jdy.activity.GoldActivity.java
private void initView() { mContext = this; notice_tip = getResources().getString(R.string.no_more_product); linearLayout_net_error = (LinearLayout) findViewById(R.id.linearLayout_net_error); linearLayout_content = (LinearLayout) findViewById(R.id.linearLayout_content); //imageLayout_net_error = (LinearLayout) findViewById(R.id.imageLayout_net_error); back_img = (ImageView) findViewById(R.id.back_img); title_tv = (TextView) findViewById(R.id.title_tv); right_img = (ImageView) findViewById(R.id.right_img); right_img.setBackgroundResource(R.drawable.search); right_img.setOnClickListener(this); if (flag == 0) { request_url = URLs.GETPRODUCTLIST; title_tv.setText(""); back_img.setVisibility(View.INVISIBLE); } else if (flag == 1) { request_url = URLs.FOLLOWLIST_URL; title_tv.setText("?"); back_img.setVisibility(View.VISIBLE); menu = new SlidingMenu(this); menu.setMode(SlidingMenu.RIGHT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f);//from w w w .ja v a 2 s . co m menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); View view = LayoutInflater.from(mContext).inflate(R.layout.search_popuwindow, null); edit_search = (EditText) view.findViewById(R.id.edit_search); lv_search = (ListView) view.findViewById(R.id.lv_search); searchListViewAdapter = new SearchListViewAdapter(strs, mContext); lv_search.setAdapter(searchListViewAdapter); lv_search.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) { TextView tv = (TextView) view.findViewById(R.id.tv_search); Intent intent = new Intent(); intent.setAction("org.jdy.action.LV_SEARCH_BROADCAST"); intent.putExtra("search_ProdType", CommonUtils.CodeForName(tv.getText().toString())); intent.putExtra("reqFlag", 1); sendBroadcast(intent); menu.showContent(); }; }); btn_search = (Button) view.findViewById(R.id.btn_search); btn_search.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CommonUtils.HideKeyBoard(mContext, edit_search); Intent intent = new Intent(); intent.setAction("org.jdy.action.KEYWORD_SEARCH_BROADCAST"); intent.putExtra("search_keyWord", edit_search.getText().toString()); intent.putExtra("reqFlag", 1); sendBroadcast(intent); menu.showContent(); } }); menu.setMenu(view); slidingMenuLayout = (LinearLayout) findViewById(R.id.slidingmenu); final Bitmap bitmap = BitmapUtils.readBitMap(mContext, R.drawable.sliding_bg, slidingMenuLayout.getMeasuredWidth(), slidingMenuLayout.getMeasuredHeight()); slidingMenuLayout.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() { @Override public boolean onPreDraw() { slidingMenuLayout.getViewTreeObserver().removeOnPreDrawListener(this); BitmapUtils.blur(bitmap, slidingMenuLayout); return true; } }); } back_img.setOnClickListener(this); order_layout = (LinearLayout) findViewById(R.id.order_layout); line_minSubsAmount = (LinearLayout) findViewById(R.id.line_minSubsAmount); line_expeAnnuRevnue = (LinearLayout) findViewById(R.id.line_expeAnnuRevnue); line_period = (LinearLayout) findViewById(R.id.line_period); orderLayouts.add(line_minSubsAmount); orderLayouts.add(line_expeAnnuRevnue); orderLayouts.add(line_period); line_expeAnnuRevnue.setOnClickListener(this); line_minSubsAmount.setOnClickListener(this); line_period.setOnClickListener(this); ATListview = (MyListView) findViewById(R.id.gold_Listview); ATListview.setOnItemClickListener(new onClickview()); listViewAdapter = new ListViewAdapter(mContext, productList); ATListview.setAdapter(listViewAdapter); mPullRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.gold_pull_refresh_scrollview); /** * */ lvSearchReceiver = new LV_SEARCH_BROADCAST(); IntentFilter intentFilter2 = new IntentFilter("org.jdy.action.LV_SEARCH_BROADCAST"); registerReceiver(lvSearchReceiver, intentFilter2); keyWordSearchReceiver = new KeyWordSearchReceiver(); IntentFilter intentFilter3 = new IntentFilter("org.jdy.action.KEYWORD_SEARCH_BROADCAST"); registerReceiver(keyWordSearchReceiver, intentFilter3); /** * ? */ mPullRefreshScrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() { @Override public void onRefresh(PullToRefreshBase<ScrollView> refreshView) { pageNumber++; notice_tip = getResources().getString(R.string.no_more_product); new QueryProductListTask().execute(); mPullRefreshScrollView.onRefreshComplete(); } }); new QueryProductListTask().execute(); }
From source file:com.zion.htf.ui.fragment.ArtistSoundcloudFragment.java
/** * Starts the service and request the activity to bind to it * @param activity the fragment's activity * @param tracks the list of {@link com.zion.htf.data.SoundcloudTrack}s to pass to the service *//* w w w.j av a 2 s. c o m*/ private void startService(Activity activity, ArrayList<SoundcloudTrack> tracks) { // Start the service, passing it the playlist Intent intent = new Intent(activity, MediaPlayerService.class); intent.putExtra(MediaPlayerService.EXTRA_TRACKS, tracks); intent.setAction(MediaPlayerService.ACTION_QUEUE_TRACKS); intent.putExtra(MediaPlayerService.EXTRA_ARTIST_ID, this.artist.getId()); intent.putExtra(MediaPlayerService.EXTRA_ARTIST_PHOTO, this.artist.getPictureResourceId()); activity.startService(intent); }
From source file:com.money.manager.ex.sync.SyncManager.java
public void stopSyncServiceAlarm() { Intent intent = new Intent(mContext, SyncSchedulerBroadcastReceiver.class); intent.setAction(SyncSchedulerBroadcastReceiver.ACTION_STOP); getContext().sendBroadcast(intent);//from ww w . ja va 2s . com // SyncSchedulerBroadcastReceiver does not receive a brodcast when using LocalManager! // LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); }
From source file:com.money.manager.ex.sync.SyncManager.java
public void startSyncServiceHeartbeat() { Intent intent = new Intent(getContext(), SyncSchedulerBroadcastReceiver.class); intent.setAction(SyncSchedulerBroadcastReceiver.ACTION_START); getContext().sendBroadcast(intent);/* ww w .j av a2s. c om*/ // SyncSchedulerBroadcastReceiver does not receive a brodcast when using LocalManager! // LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); }
From source file:ac.robinson.bettertogether.ConnectionSetupActivity.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { switch (requestCode) { case CAMERA_PERMISSION_RESULT: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { restartCaptureManager();/* w w w .jav a 2 s . c o m*/ } else { AlertDialog.Builder builder = new AlertDialog.Builder(ConnectionSetupActivity.this); builder.setTitle(R.string.title_camera_access); builder.setMessage(R.string.hint_enable_camera_access); builder.setPositiveButton(R.string.hint_edit_permissions, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData( Uri.fromParts("package", ConnectionSetupActivity.this.getPackageName(), null)); try { startActivity(intent); } catch (ActivityNotFoundException e) { // we've tried everything by this point! Log.d(TAG, "Camera permission denied and request failed - will not be able to scan codes"); Toast.makeText(ConnectionSetupActivity.this, R.string.error_accessing_camera, Toast.LENGTH_LONG).show(); } restartCaptureManager(); } }); builder.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(ConnectionSetupActivity.this, R.string.error_accessing_location, Toast.LENGTH_LONG).show(); restartCaptureManager(); // reset capture UI and try again } }); builder.show(); } break; case COARSE_LOCATION_PERMISSION_RESULT: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { createClient(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(ConnectionSetupActivity.this); builder.setTitle(R.string.title_coarse_location_access); builder.setMessage(R.string.hint_enable_coarse_location_access); builder.setPositiveButton(R.string.hint_edit_permissions, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData( Uri.fromParts("package", ConnectionSetupActivity.this.getPackageName(), null)); try { startActivity(intent); } catch (ActivityNotFoundException e) { // we've tried everything by this point! Log.d(TAG, "Coarse location permission denied and request failed - will not be able to connect"); Toast.makeText(ConnectionSetupActivity.this, R.string.error_accessing_location, Toast.LENGTH_LONG).show(); } restartCaptureManager(); } }); builder.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(ConnectionSetupActivity.this, R.string.error_accessing_location, Toast.LENGTH_LONG).show(); restartCaptureManager(); // reset capture UI and try again } }); builder.show(); } break; default: if (mCaptureManager != null && requestCode == CaptureManager.getCameraPermissionReqCode()) { // ignored - CaptureManager's default is to exit on permission denial, so we handle permissions ourselves // mCaptureManager.onRequestPermissionsResult(requestCode, permissions, grantResults); } break; } }
From source file:aarddict.android.ArticleViewActivity.java
@Override public boolean onSearchRequested() { Intent intent = getIntent();//from w w w .j a v a2s . c om String action = intent == null ? null : intent.getAction(); if (action != null) { String word = null; if (action.equals(Intent.ACTION_SEARCH)) { word = intent.getStringExtra("query"); } else if (action.equals(Intent.ACTION_SEND)) { word = intent.getStringExtra(Intent.EXTRA_TEXT); } if (word != null) { Intent next = new Intent(); next.setClass(this, LookupActivity.class); next.setAction(Intent.ACTION_SEARCH); next.putExtra(SearchManager.QUERY, word); startActivity(next); } } finish(); return true; }
From source file:ac.robinson.mediaphone.MediaPhoneActivity.java
private void sendFiles(final ArrayList<Uri> filesToSend) { // send files in a separate task without a dialog so we don't leave the previous progress dialog behind on // screen rotation - this is a bit of a hack, but it works runImmediateBackgroundTask(new BackgroundRunnable() { @Override//from w ww.j a v a2 s.c om public int getTaskId() { return 0; } @Override public boolean getShowDialog() { return false; } @Override public void run() { if (filesToSend == null || filesToSend.size() <= 0) { return; } // ensure files are accessible to send - bit of a last-ditch effort for when temp is on internal storage for (Uri fileUri : filesToSend) { IOUtilities.setFullyPublic(new File(fileUri.getPath())); } // also see: http://stackoverflow.com/questions/2344768/ // could use application/smil+xml (or html), or video/quicktime, but then there's no bluetooth option final Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); sendIntent.setType(getString(R.string.export_mime_type)); sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, filesToSend); final Intent chooserIntent = Intent.createChooser(sendIntent, getString(R.string.export_narrative_title)); // an extra activity at the start of the list that moves exported files to SD, but only if SD available if (IOUtilities.externalStorageIsWritable()) { final Intent targetedShareIntent = new Intent(MediaPhoneActivity.this, SaveNarrativeActivity.class); targetedShareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); targetedShareIntent.setType(getString(R.string.export_mime_type)); targetedShareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, filesToSend); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[] { targetedShareIntent }); } startActivity(chooserIntent); // single task mode; no return value given } }); }