Could not find com.android.tools.build:gradle:2.2.0 -here is the solution

Categories: ANDROID like

In case You had problem with: Error:Could not find com.android.tools.build:gradle:2.2.0. Searched in the following locations: https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.pom https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0/gradle-2.2.0.jar Required by: :YOUR_PROJECT:unspecified Don’t forget modify root build.gradle and add jcenter() It would look like this: buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:2.2.0’ classpath ‘com.google.gms:google-services:3.0.0’ } } allprojects { repositories { mavenCentral() } }

Simple pulling database sqlite to desktop and preview it

Categories: ANDROID like

All what we need is to make few steps: Add in our project this line to output in log current path to database Log.d(TAG, “onCreate db: ” + context.getDatabasePath(“mydatabase.db”)); Create simple batch command to pull database (afik root is no needed) adb pull “/data/data/com.example.app/databases/mydatabase.db” mydatabase_%date%.db.sqlite Download SQLiteManager to firefox, run it, open our sqlite database […]

Notepad++ with regex, re-using match variables

Categories: NON ANDROID like

Here is an simple example how to use regex in notepad++ with reusing selected match variables. For example we have special code for simulating gcm notifications. We would like to see it in pretty style. To achieve this we must to move all elements with minus to the new lines. How to do it? Here […]

Ignoring some logs in Logcat filter – Android Studio – solution

Categories: ANDROID like

Here is a little help to remove from our logcat some logs we don’t want like: dalvikvm or OpenGL All what you need is to click in top right corner of logcat, select our package name and click Edit Filter Configuration Then in the field called Log Tag regex You need insert this ^((?!(?:dalvikvm|OpenGLRenderer)).)*$ which […]

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. […]

Clearing items in MultiSelectListPreference – solution

Categories: ANDROID like

Hi, today I was working on MultiSelectListPreference in PreferenceFragment screen. I was going to have multi select list where user would be able select items. Each selected item would be describing specific shortcut from my app to OP desktop. After about half an hour I found out how to restore MultiSelectListPreference with all default items.

Android NavigationDrawer not handling setOnItemClickListener- nothing happens – solution

Categories: ANDROID like

During my graduation work I had to use navigation drawer for menu list. What is more, I also needed pull to refresh layout. Both items are very sensitive and its order matters where to put them. You might be in situation where you think which one should be in which one. So during rebuilding layout […]

Pull to refresh in project, disabling refresh when we want to scroll down

Categories: ANDROID like

I have been working for my graduation work on layout `pull to refresh`, called now.. SwipeRefreshLayout. It was connected with NavigationDrawerFragment. During tests over that two things I discovered I was not able to scroll down my list without calling refresh. I found very interesting solution on stackoverflow. Answer was posted by @Cabezas. Thank You!