我在for循环中以编程方式添加TextViews并将它们添加到ArrayList.
我该怎么用TextView.setId(int id)?我提出了什么整数ID,所以它不与其他ID冲突?
我想给ID在布局一些看法(TextView的,ImageView的等),其programmetically创建.那么设置ID的最佳方法是什么.
我已经在应用程序中使用 Google Firebase 一段时间了,我正在做一些维护和一些更新,但我不断收到:
无法获取提供程序 com.google.firebase.provider.FirebaseInitProvider
每当我启动应用程序时都会发生这种情况。自从我开始使用 FCM 以来,我已经尝试过启用MultiDex和我的applicationId设置。我只是不知道它可能是什么。
任何帮助都感激不尽。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.vivatrucking.drivershub"
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 27
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// android
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.volley:volley:1.0.0'
// google …Run Code Online (Sandbox Code Playgroud) java firebase android-studio android-gradle-plugin firebase-cloud-messaging
我正在尝试使用一个非常基本的程序ViewPager.但是当我尝试在手机上执行它时,我收到java错误.这是代码(我正在尝试修改本教程的版本)
public class MainActivity extends ActionBarActivity {
private ViewPager pager;
private PagerAdapter pageAdapter;
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
public ScreenSlidePagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
CardListFragment clf = new CardListFragment();
if (position == 0) clf.setThetext("Hola");
else if (position == 1) clf.setThetext("Mundo");
else if (position == 2) clf.setThetext("Cruel");
return clf;
}
@Override
public int getCount() {
return 3;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
LinearLayout ll = new LinearLayout(this); …Run Code Online (Sandbox Code Playgroud)