private void resolveIntent(Intent intent) { String action = intent.getAction(); if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage[] msgs; if (rawMsgs != null) { msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } else { // Unknown tag type byte[] empty = new byte[0]; byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); Parcelable tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); byte[] payload = dumpTagData(tag).getBytes(); NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload); NdefMessage msg = new NdefMessage(new NdefRecord[] {record}); msgs = new NdefMessage[] {msg}; } // Setup the views populateCardID(msgs); } }
@Test public void testParcelableArrayExtra() throws Exception { Intent intent = new Intent(); Parcelable parcelable = new TestParcelable(11); intent.putExtra("foo", parcelable); assertSame(null, intent.getParcelableArrayExtra("foo")); Parcelable[] parcelables = {new TestParcelable(12), new TestParcelable(13)}; assertSame(intent, intent.putExtra("bar", parcelables)); assertSame(parcelables, intent.getParcelableArrayExtra("bar")); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (resultCode == Activity.RESULT_OK) { if (requestCode == INTENT_REQUEST_GET_IMAGES) { Parcelable[] parcelableUris = intent.getParcelableArrayExtra(ImagePickerActivity.EXTRA_IMAGE_URIS); if (parcelableUris == null) { return; } // Java doesn't allow array casting, this is a little hack Uri[] uris = new Uri[parcelableUris.length]; System.arraycopy(parcelableUris, 0, uris, 0, parcelableUris.length); if (uris != null && uris.length > 0) { for (Uri uri : uris) { sendMedia(KEY_MESSAGE_IMAGE, uri.toString()); } } } else if (requestCode == INTENT_SELECT_VIDEO) { Uri videoUri = intent.getData(); String videoPath = FileHelper.getPath(this, videoUri); sendMedia(KEY_MESSAGE_VIDEO, videoPath); } } }
/* * **** READING MODE METHODS **** */ NdefMessage[] getNdefMessagesFromIntent(Intent intent) { // Parse the intent NdefMessage[] msgs = null; String action = intent.getAction(); if (action.equals(NfcAdapter.ACTION_TAG_DISCOVERED) || action.equals(NfcAdapter.ACTION_NDEF_DISCOVERED)) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMsgs != null) { msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } else { // Unknown tag type byte[] empty = new byte[] {}; NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, empty, empty); NdefMessage msg = new NdefMessage(new NdefRecord[] {record}); msgs = new NdefMessage[] {msg}; } } else { Log.e(TAG, "Unknown intent."); finish(); } return msgs; }
// on recognition of nfc event @Override protected void onResume() { super.onResume(); Intent intent = getIntent(); // appendTotal(); // initialize gesture detector, for swipe // gestureDetector = new GestureDetector(this, new SwipeGestureDetector()); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] rawMessages = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage message = (NdefMessage) rawMessages[0]; // only one message transferred String amount = new String(message.getRecords()[0].getPayload()); // showBalance.setText("125"); // showBalance.setVisibility(View.INVISIBLE); //REMOVE FOR FRIENDSHIP appendTotal(); // showBalance.setText("1225"); /*Intent intentt = new Intent(this, OpenCamera.class); startActivity(intentt);*/ } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_daily_forecast); ButterKnife.bind(this); Intent intent = getIntent(); mLocation = intent.getStringExtra(getString(R.string.location_name)); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST); mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class); mLocationLabel.setText(String.valueOf(mLocation)); DayAdapter adapter = new DayAdapter(this, mDays); mListView.setAdapter(adapter); mListView.setEmptyView(mEmptyTextView); mListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String dayOfTheWeek = mDays[position].getDayOfTheWeek(); String conditions = mDays[position].getSummary(); String highTemp = mDays[position].getTemperatureMax() + ""; String lowTemp = mDays[position].getTemperatureMin() + ""; String message = String.format( "%s - High: %s, Low: %s, and %s", dayOfTheWeek, highTemp, lowTemp, conditions); Toast.makeText(DailyForecastActivity.this, message, Toast.LENGTH_LONG).show(); } }); }
/** Parses the NDEF Message from the intent and prints to the TextView */ void processIntent(Intent intent) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); // only one message sent during the beam NdefMessage msg = (NdefMessage) rawMsgs[0]; // record 0 contains the MIME type, record 1 is the AAR, if present DebugUtil.d(TAG, new String(msg.getRecords()[0].getPayload())); }
private void processIntent(Intent intent) { Log.d("ANDROID_LAB", "processIntent..."); Bitmap bitmap = null; Parcelable[] ndefMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (ndefMsgs != null) { Log.d("ANDROID_LAB", "ndefMsgs.size=" + ndefMsgs.length); String str = ""; for (int i = 0; i < ndefMsgs.length; i++) { NdefMessage msg = (NdefMessage) ndefMsgs[i]; NdefRecord[] records = msg.getRecords(); if (records != null) { Log.d("ANDROID_LAB", "records.size=" + records.length); for (int k = 0; k < records.length; k++) { NdefRecord record = records[k]; byte[] data = record.getPayload(); if (data != null) { if (k == 0) { str += new String(data); } else if (k == 1) { bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); } } } } } txtPushContent.setText(str); if (bitmap != null) { txtPushContent.setCompoundDrawablesWithIntrinsicBounds( null, null, null, new BitmapDrawable(bitmap)); } } }
@Override public void onNewIntent(Intent intent) { s = ""; Parcelable[] data = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (data != null) { try { for (int i = 0; i < data.length; i++) { NdefRecord[] recs = ((NdefMessage) data[i]).getRecords(); for (int j = 0; j < recs.length; j++) { byte[] payload = recs[j].getPayload(); String textEncoding = ((payload[0] & 0200) == 0) ? "UTF-8" : "UTF-16"; int langCodeLen = payload[0] & 0077; s += new String( payload, langCodeLen + 1, payload.length - langCodeLen - 1, textEncoding); } } } catch (Exception e) { Log.e("TagDispatch", e.toString()); } } Log.d("MainAct", "String From NFC: " + s); Intent newNfcIntent = new Intent(MainActivity.this, ConnectedActivity.class); newNfcIntent.putExtra("BtDevice", s); // this will be received at ledControl (class) Activity newNfcIntent.putExtra("BtName", "ToiletNfcTag"); startActivity(newNfcIntent); }
public void getNfcTagInfo(Intent thisIntent) { Parcelable[] rawMsgs = thisIntent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMsgs != null) { NdefMessage[] msgs; NdefRecord[] recs = null; msgs = new NdefMessage[rawMsgs.length]; // recs = new NdefRecord[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; recs = msgs[i].getRecords(); } List<TextRecord> records = new ArrayList<TextRecord>(); records.add(TextRecord.parse(recs[0])); final int size = records.size(); for (int i = 0; i < size; i++) { TextRecord record = records.get(i); String nfctag = record.getText(); System.out.println(nfctag); // content.addView(record.getView(this, inflater, content, i)); // inflater.inflate(R.layout.tag_divider, content, true); double[] tempCoords = NfcUtility.tagToCoords(nfctag); newPlace = new Place( new GeoPoint((int) tempCoords[0] * 1000000, (int) tempCoords[1] * 1000000), "", ""); } } }
void processIntent(Intent intent) throws UnsupportedEncodingException { Parcelable[] msgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage[] nmsgs = new NdefMessage[msgs.length]; for (int i = 0; i < msgs.length; i++) { nmsgs[i] = (NdefMessage) msgs[i]; } NdefRecord record = nmsgs[0].getRecords()[0]; byte[] payload = record.getPayload(); if (payload != null) { if (nmsgs[0].getRecords()[0].getTnf() != 2) { // Toast.makeText(this, "New Text received!", Toast.LENGTH_SHORT) // .show(); // String message = String.valueOf(record.getPayload()); String message = getTextData(record.getPayload()); // textview = (TextView) findViewById(R.id.textView2); // Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); // text = String.valueOf(payload); // textview.setText(message); Intent intent_nfccode = new Intent(this, Details_page.class); intent_nfccode.putExtra("NFC Code", message); startActivity(intent_nfccode); } } }
/** * Method to send the messages over another device * * @param NfcIntent - NFC intent to pass data */ private void handleNfcIntent(Intent NfcIntent) { if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(NfcIntent.getAction())) { Parcelable[] receivedArray = NfcIntent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (receivedArray != null) { messagesToReceiveQueue.clear(); NdefMessage receivedMessage = (NdefMessage) receivedArray[0]; NdefRecord[] linkRecords = receivedMessage.getRecords(); for (NdefRecord record : linkRecords) { String message = new String(record.getPayload()); if (!message.equals(getPackageName())) { messagesToReceiveQueue.add(message); } } Toast.makeText( this, "Total " + messagesToReceiveQueue.size() + "Messages received", Toast.LENGTH_LONG) .show(); updateTextViews(); } else { Toast.makeText(this, "Received Blank", Toast.LENGTH_LONG).show(); } } }
private void handleIntent(Intent intent) { if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMsgs != null) { ndefMessages = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { ndefMessages[i] = (NdefMessage) rawMsgs[i]; } } if (ndefMessages != null && ndefMessages.length > 0) { String productId = new String(ndefMessages[0].getRecords()[0].getPayload()); productId = productId != null ? productId.replace("en", "") : "Invalid Product tag"; // Toast.makeText(getBaseContext(), body != null ? body.replace("en", "") : "Invalid Product // tag", Toast.LENGTH_LONG).show(); productId = productId.replace(String.valueOf(productId.charAt(0)), ""); if (!CartentiaApplication.MY_CART_PRODUCTS.contains(productId)) { addProductToCart(productId); loadAddProductFragment(productId); } else { Toast.makeText( getBaseContext(), "Product is already added into your cart", Toast.LENGTH_LONG) .show(); } } else { Toast.makeText(getBaseContext(), " Empty Product tag", Toast.LENGTH_LONG).show(); } } }
private void handleSelectSystemLabel(int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK && data != null) { Parcelable[] parcelables = data.getParcelableArrayExtra("selected_labels"); if (parcelables != null && parcelables.length > 0) { SystemLabel label = (SystemLabel) parcelables[0]; recommendLabel(new BaseLabel[] {label.toBaseLabel()}); } } }
private void handleIntent(Intent i) { if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(i.getAction())) { Parcelable[] rawMsgs = i.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage msg = (NdefMessage) rawMsgs[0]; String url = new String(msg.getRecords()[0].getPayload()); beamFragment.loadUrl(url); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_daily_forecast); Intent intent = getIntent(); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORECAST); mDays = Arrays.copyOf(parcelables, parcelables.length, Day[].class); DayAdapter adapter = new DayAdapter(this, mDays); setListAdapter(adapter); }
@Override public void onReceive(Context arg0, Intent intent) { String action = intent.getAction(); int iLoop = 0; if (BluetoothDevice.ACTION_UUID.equals(action)) { Parcelable[] uuidExtra = intent.getParcelableArrayExtra("android.bluetooth.device.extra.UUID"); if (null != uuidExtra) iLoop = uuidExtra.length; /*uuidExtra should contain my service's UUID among his files, but it doesn't!!*/ for (int i = 0; i < iLoop; i++) mslUuidList.add(uuidExtra[i].toString()); } }
@Override public ScanableTag scan() { Intent intent = parentActivity.getIntent(); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); return rawToScanable(rawMsgs); } if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) { return new EmptyTag(); } return null; }
private void handleUpdateStatusIntent(final Intent intent) { final ParcelableStatusUpdate status = intent.getParcelableExtra(EXTRA_STATUS); final Parcelable[] status_parcelables = intent.getParcelableArrayExtra(EXTRA_STATUSES); final ParcelableStatusUpdate[] statuses; if (status_parcelables != null) { statuses = new ParcelableStatusUpdate[status_parcelables.length]; for (int i = 0, j = status_parcelables.length; i < j; i++) { statuses[i] = (ParcelableStatusUpdate) status_parcelables[i]; } } else if (status != null) { statuses = new ParcelableStatusUpdate[1]; statuses[0] = status; } else return; updateStatuses(statuses); }
protected NdefMessage[] getNdefData(Intent intent) { NdefMessage[] messages = null; String action = intent.getAction(); if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); messages = getMessages(rawMsgs); } else { Toast.makeText(this, "Not sure which nfc type this is", Toast.LENGTH_LONG).show(); } return messages; }
/** Parses the NDEF Message from the intent and prints to the TextView */ void processIntent(Intent intent) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); // only one message sent during the beam NdefMessage msg = (NdefMessage) rawMsgs[0]; // record 0 contains the MIME type, record 1 is the AAR, if present String id = new String(msg.getRecords()[0].getPayload()); String url = "https://www.facebook.com/dialog/friends/?id=" + id + "&app_id=581136295234749&redirect_uri=http://www.facebook.com"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); }
public static NdefMessage[] getNdefMessages(Intent intent) { NdefMessage[] message = null; Parcelable[] rawMessages = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMessages != null) { message = new NdefMessage[rawMessages.length]; for (int i = 0; i < rawMessages.length; i++) { message[i] = (NdefMessage) rawMessages[i]; } } else { byte[] empty = new byte[] {}; NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, empty, empty); NdefMessage msg = new NdefMessage(new NdefRecord[] {record}); message = new NdefMessage[] {msg}; } return message; }
public void onResume() { super.onResume(); // if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { Intent intent = getIntent(); Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMsgs != null) { NdefMessage[] msgs; msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } } // process the msgs array }
@Override protected void onHandleIntent(Intent intent) { intent = (Intent) intent.getExtras().get(NFC_INTENT); TimeloggerDatabaseOpenHelper databaseOpenHelper = new TimeloggerDatabaseOpenHelper(getApplicationContext()); Log.d(NFC_TIMELOGGER, "handling following intent in service: " + intent.getAction()); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] ndefMessages = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (ndefMessages != null) { NdefMessage[] msgs = new NdefMessage[ndefMessages.length]; for (int i = 0; i < ndefMessages.length; i++) { msgs[i] = (NdefMessage) ndefMessages[i]; NdefRecord[] records = msgs[i].getRecords(); for (NdefRecord ndefRecord : records) { String payload = new String(ndefRecord.getPayload()); Log.d(NFC_TIMELOGGER, payload); NotificationManager notifManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); String resultAction = databaseOpenHelper.handleCategory(payload); Notification notification = new Notification.Builder(this) .setContentTitle("Timelogger") .setTicker(resultAction + payload) .setContentText(payload) .setSmallIcon(R.drawable.ic_launcher) .build(); notifManager.notify(1234, notification); Log.d(NFC_TIMELOGGER, "notification sent"); Intent updateIntent = new Intent("FRAGMENT_UPDATE"); this.sendBroadcast(updateIntent); } } } } databaseOpenHelper.close(); }
@Override protected void onNewIntent(Intent intent) { // ถ้ามี nfc มาแตะ super.onNewIntent(intent); if (intent.hasExtra(NfcAdapter.EXTRA_TAG)) { Toast.makeText(this, "NfcIntent!", Toast.LENGTH_SHORT).show(); Parcelable[] parcelables = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (parcelables != null && parcelables.length > 0) { readTextFromMessage((NdefMessage) parcelables[0]); } else { Toast.makeText(this, "No NDEF messages found2!", Toast.LENGTH_SHORT).show(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hourly_forecast); ButterKnife.bind(this); Intent intent = getIntent(); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.HOURLY_FORECAST); mHours = Arrays.copyOf(parcelables, parcelables.length, Hour[].class); HourAdapter adapter = new HourAdapter(mHours); mRecyclerView.setAdapter(adapter); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setHasFixedSize(true); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TaskStackBuilder builder = TaskStackBuilder.create(this); Intent proxyIntent = getIntent(); if (!proxyIntent.hasExtra(EXTRA_INTENTS)) { finish(); return; } for (Parcelable parcelable : proxyIntent.getParcelableArrayExtra(EXTRA_INTENTS)) { builder.addNextIntent((Intent) parcelable); } builder.startActivities(); finish(); }
private void processIntent(Intent intent) { Parcelable[] ndefMessages = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage msg = (NdefMessage) ndefMessages[0]; NdefRecord[] records = msg.getRecords(); for (NdefRecord record : records) { String dataString = new String(record.getPayload()); Scanner scanner = new Scanner(dataString); DataContainer dataContainer = new DataContainer(); for (int i = 0; i < Constants.DATA_NAMES.length; i++) { if (Constants.DATA_FIELDS[i].equals("int")) { dataContainer.setData(Constants.DATA_NAMES[i], scanner.nextInt()); } else { dataContainer.setData(Constants.DATA_NAMES[i], scanner.nextInt() == 1); } } mDBHelper.insertDataContainer(dataContainer); } }
/** * Checks to see if the activity's intent ({@link android.app.Activity#getIntent()}) is an NFC * intent that the app recognizes. If it is, then parse the NFC message and set the activity's * intent (using {@link android.app.Activity#setIntent(android.content.Intent)}) to something the * app can recognize (i.e. a normal {@link android.content.Intent#ACTION_VIEW} intent). */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void tryUpdateIntentFromBeam(Activity activity) { if (UIUtils.hasICS()) { Intent originalIntent = activity.getIntent(); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) { Parcelable[] rawMsgs = originalIntent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage msg = (NdefMessage) rawMsgs[0]; // Record 0 contains the MIME type, record 1 is the AAR, if present. // In iosched, AARs are not present. NdefRecord mimeRecord = msg.getRecords()[0]; if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals(new String(mimeRecord.getType()))) { // Re-set the activity's intent to one that represents session details. Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(new String(mimeRecord.getPayload()))); activity.setIntent(sessionDetailIntent); } } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hourly_forecast); // must add this line after we called the @Bind at beginning. ButterKnife.bind(this); Intent intent = getIntent(); Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.Hourly_Forecast); mHours = Arrays.copyOf(parcelables, parcelables.length, Hour[].class); HourAdapter adapter = new HourAdapter(this, mHours); mRecyclerView.setAdapter(adapter); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(layoutManager); // helps to be performs mRecyclerView.setHasFixedSize(true); }