Skip to content
Advertisement

cannot resolve method ‘get key’ in Pair in android?

I have a problem using functions in Android Studio, where i use the function in Pair library,here’s a snippet of my code

import android.util.Pair;
Penyakit penyakit = (Penyakit) p.getKey();    

i need a solution, thanks

Advertisement

Answer

Because there is not a #geyKey in android.util.Pair . You need use property of pair which are first and second. Here p.first will be key and p.second will be value

        Penyakit penyakit = (Penyakit) p.first;
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement