Rooting Nexus 6 7.1.1

Categories: NON ANDROID like

There are 6 simple steps for rooting Android 7.1.1 for nexus 6: 1 adb reboot bootloader 2 fastboot oem unlock [YES] 3 fastboot flash recovery twrp-3.2.1-0-shamu.img https://dl.twrp.me/shamu/twrp-3.2.1-0-shamu.img.html 4 go to recovery 5 adb push .\SuperSU-v2.82-201705271822.zip /sdcard/ https://forum.xda-developers.com/apps/supersu/stable-2016-09-01supersu-v2-78-release-t3452703 https://s3-us-west-2.amazonaws.com/supersu/download/zip/SuperSU-v2.82-201705271822.zip 6 in recovery install SuperSUfrom sdcard 7 done.

Example how to hide and show floating action button while scrolling the list (code not optimized well)

Categories: ANDROID like

//this example is for recyclerView but it can be used somewhere else recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); if (dy > 0) { hideFab(); } else if (dy < 0) { showFab(); } } […]

Working example POST in android

Categories: ANDROID like

Here is another short (IMHO) example how to post in android app. private void postSms(String text) { URL url; HttpURLConnection urlConnection = null; try { url = new URL("http://yourserver.com/sendsms"); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("POST"); urlConnection.setDoOutput(true); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("sms", text));//POST param as "sms" OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter(new […]

Working example – changing drawable background in runtime, dynamically

Categories: NON ANDROID like

Here is a short example code how to do it: I’ve created xml file shape.xml and one method for flexible changing color of shape. shape.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="@android:color/holo_blue_bright" /> <corners android:radius="30dp" /> <size android:height="15dp" android:width="15dp" /> </shape> And here is a method for flexible changing color:

Working example of setting alarm with repeating stuff, checking if alarm was set with pendingIntent

Categories: ANDROID like

Here is short and quite (imho) understanding part of code: //starting #1 AlarmManager alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(getActivity(), MyReceiver.class); intent.setAction(MyReceiver.ACTION_ALARM_RECEIVER);//my custom string action name PendingIntent pendingIntent = PendingIntent.getBroadcast(getActivity(), 1001, intent, PendingIntent.FLAG_CANCEL_CURRENT);//used unique ID as 1001 alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), aroundInterval, pendingIntent);//first start will start asap #1 – first we are getting alarm service. […]

Custom checkable list item with checkbox (layout+code)

Categories: ANDROID like

Here is simple example how to create simple checkable list item with checbox. This a code for widget: public class CheckableTextView extends LinearLayout { private TextView checkLabel; private CheckBox checkBox; public CheckableTextView(Context context) { super(context); } public CheckableTextView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public CheckableTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, […]