Cannot resolve method 'setupWithViewPager(androidx.viewPager.widget.ViewPager)

cannot resolve method java intellij
cannot resolve method findviewbyid
cannot resolve method void
cannot resolve method android studio
cannot resolve method submit
cannot resolve method in object
cannot resolve method findviewbyid in fragment
cannot resolve method getkey

I an learning android studio and was trying to make a simple app using fragments but I am getting the below error.

error- Cannot resolve method 'setupWithViewPager(androidx.viewPager.widget.ViewPager)'

My Code:

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import android.os.Bundle;
import android.widget.TableLayout;
public class MainActivity extends AppCompatActivity {
    private TableLayout tableLayout;
    private ViewPager viewPager;
    private ViewPagerAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tableLayout= (TableLayout) findViewById(R.id.tab_layout);
        viewPager=(ViewPager) findViewById(R.id.pager_id);
        adapter=new ViewPagerAdapter(getSupportFragmentManager());
        adapter.AddFragement(new Fragment_call(),"Call");
        adapter.AddFragement(new FragmentContact(),"Contact");
        adapter.AddFragement(new FragmentFav(),"Favourite");
        viewPager.setAdapter(adapter);
        tableLayout.setupWithViewPager(viewPager);
    }
}

My gradle file:

apply plugin: 'com.android.application'

android {
   compileSdkVersion 29
   buildToolsVersion "29.0.2"
   defaultConfig {
   applicationId "com.example.ass"
   minSdkVersion 15
   targetSdkVersion 29
   versionCode 1
   versionName "1.0"
   testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
   release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
   }
}
}

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'androidx.appcompat:appcompat:1.1.0'
   implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
   testImplementation 'junit:junit:4.12'
   androidTestImplementation 'androidx.test:runner:1.2.0'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
   //compile 'com.android.support:design:25.3.1'

}

Any help would be appreciated.

Didn't you mean TabLayout instead TableLayout?

If so, change tableLayout = (TableLayout) findViewById(R.id.tab_layout); to TabLayout tableLayout = findViewById(R.id.tab_layout);

Getting "cannot resolve method" error when trying to implement , getSharedPreferences() needs a context to be accessed. For instance: mContext. getSharedPreferences(PREF_NAME, Context. Cannot resolve method .isEmpty() Follow. Answered. S Bucki96 Created November 11, 2018 14:21. Hello, im struggling with this issue. Was coding my web application

tableLayout= (TableLayout) findViewById(R.id.tab_layout); tableLayout.setupWithViewPager(viewPager);

The android.widget.TableLayout doesn't have the method setupWithViewPager.

Maybe you are looking for the com.google.android.material.tabs.TabLayout.

It requires the Material Components library as dependency:

implementation 'com.google.android.material:material:1.1.0'

[Solved] How do I resolve the the cannot resolve method , You need to first call the getView() function to get the view of the fragment and then you can call the findViewById() . Like this,. Hide Copy Code. and Android Studio is telling "Cannot resolve method 'makeText(com.gabas.funfacts.FunFactsActivity, java.lang.String, int)' the code is with a red line below. Daniel Bowen

It's TabLayout and not TableLayout. These are two different things.

Cannot resolve method 'get(java.lang.String)' � Issue #238 , Cannot resolve method 'get(java.lang.String)' here.. " @override public int getItemViewType(int position) { Contribution contribution = contributions.get( position);� Intellij cannot resolve method but compiles and runs Follow. Intellij cannot resolve method but compiles and runs. Answered. Spacif01. Created July 23, 2019 03:29. This was a new installation in my spare computer in order to migrate my project from Java 10 to 12. The migration succeded and the project runs fine.

cannot resolve method .getService(); � Issue #2548 � googleapis , cannot resolve method .getService(); #2548. Closed. RakeshSiddu opened this issue on Oct 23, 2017 � 7 comments. Closed� resolve(String other) method of java.nio.file.Path used to converts a given path string to a Path and resolves it against this Path in the exact same manner as specified by the resolve method. For example, If the name separator is “/” and a path represents “c/drive/files”, then invoking this method with the path string “file1” will

Cannot resolve method "getName()', Hey guys, I am making GUI plugin for our server. I have a problem with my code. Could somebody check my code and tell me what is wrong� deleteEmployee method is not wrapped into a new transaction because you are referencing method on this. What you can do is to inject reference to the facade itself and then call deleteEmployee method on it (it should be public). More or less something like this: @Stateless public class MyFacade {

Help me with 'cannot resolve method' – IDEs Support (IntelliJ , Help me with 'cannot resolve method' Follow. Answered. Avatar. Lkis9156. Created October 08, 2019 05:18. I've done it, but it doesn't work. How do I fix this � Loading pages (1/6) QSslSocket: cannot resolve SSLv3_client_method ] 10% QSslSocket: cannot resolve SSLv3_server_method I have libssl-dev and openssl installed. wkhtmltopdf --version wkhtmltopdf 0.12.3 (with patched qt) 👍

Comments
  • I have also added maven{ url="...."} in the other gradle file.
  • Should be a TabLayout and not TableLayout