我有一个大问题,我不知道发生了什么,我已经上传了一个应用程序到Play商店,因为当我在模拟器上运行它甚至在我的真实设备上它没有崩溃,但现在当我下载来自Google Play的它说:
java.lang.NullPointerException:
at com..onBindViewHolder (ChooseCard.java)
or .onCreateViewHolder (ChooseCard.java)
at com..onBindViewHolder (ChooseCard.java)
or .onCreateViewHolder (ChooseCard.java)
at com.firebase.ui.database.FirebaseRecyclerAdapter.getItemCount (FirebaseRecyclerAdapter.java)
or .onBindViewHolder (FirebaseRecyclerAdapter.java)
or .onChildChanged (FirebaseRecyclerAdapter.java)
or .onError (FirebaseRecyclerAdapter.java)
at com.yarolegovich.discretescrollview.InfiniteScrollAdapter.access$100 (InfiniteScrollAdapter.java)
or .getItemCount (InfiniteScrollAdapter.java)
or .getItemViewType (InfiniteScrollAdapter.java)
or .onAttachedToRecyclerView (InfiniteScrollAdapter.java)
or .onBindViewHolder (InfiniteScrollAdapter.java)
or .onCreateViewHolder (InfiniteScrollAdapter.java)
or .wrap (InfiniteScrollAdapter.java)
Run Code Online (Sandbox Code Playgroud)
这个问题已经好几天了,我找不到它,你能帮我一把吗?
有我的build.gradle实现
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation …Run Code Online (Sandbox Code Playgroud) 我想添加一个API_KEY进行GoogleMaps测试,并且在文档中我已经读过:
提示:在开发和测试期间,您可以在Google Cloud Platform Console中注册项目以进行测试,并使用通用的不受限制的API密钥。当您准备将应用程序投入生产时,请注册一个单独的项目进行生产,创建一个受Android限制的API密钥,然后将该密钥添加到您的应用程序中。
我的问题是,即使它是测试API_KEY,我也必须放我的信用卡吗?我的目的不是让我的Creadit卡使用Google地图,这不是免费的吗?
我想创建一个HorizontalScrollView,但在其中有一些"效果",如本例或其他示例.问题是我不知道我必须使用多少物品; 我ImageView从API 获得它应该是动态的.我怎样才能产生这样的效果:如果它被选中,它会变得更大TextView以下?我在SO上找到的最接近的例子就在这里.这正是我所需要的,但我已经测试了给出的答案,但这对我不起作用......但问题中的图像正是我想要的.任何人都可以指导我这样做吗?
假设我ImageView 只用5个测试来测试它,所以ImageView动态添加它们的例子也对我有好处.
另一个例子是Snapchat APP,但不同之处在于我想在选择上添加一些效果,比如把它变大或者什么.
我想得到一个示例,如何做一个自定义HorizontalScrollView与布局(适配器)和最重要,如果它可能添加一个效果点击一个,我想要适配器,因为我需要得到该项目点击当然.我认为我应该使用RecycleView作为@UncaughtException对我说,因为我不知道我会得到多少图像,我将不得不穿上我的APP所以我认为这是解决方案.
android android-animation android-imageview android-viewpager
我是 Kotlin 新手,对变量_view中的下划线感到困惑。
请帮我。
class MainActivityPresenter(_view: View): Presenter {
private var view: View = _view
Run Code Online (Sandbox Code Playgroud) 我有一个Service当一个函数给我true时它将启动一个新的Activity但它需要5秒...
我已经读过这个issue,我在StackOverflow这个例子中找到了"避免"这个bug.
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但遗憾的是它没有Activity更快启动,我不需要处于初级状态(如果可能的话更好),但是我不想等待+5秒来启动新功能Activity,你是否知道要避免这种情况?
我正在使用,PendingIntent因为我发现那个人说它应该解决这个问题:
在没有5秒延迟的情况下按下HOME按钮后从服务启动一个活动
如果我按下back button它会自动启动它,0延迟,但我正在按下它home button.
我在这里看到很多问题,但没有人适应我的问题.我正在尝试创建一个可扩展的ER模型,如果我想添加更多数据,几乎不会破坏任何东西,所以我试图创建的是:
有两种类型的用户,比如Admin和Worker,他们有不同的角色.
管理员可以做一个问题的CRUD,也可以创建一个用户可以加入一起玩的房间(这只是一个名字,像Kahoot!那样)但也许在其中创建更多属性是个好主意,比如世界卫生组织正在这个房间里玩,每个人都要点,但是当我向你展示设计时,让我们再谈谈它.
好吧,就我的设计而言,我有:
表用户包含:
_id
username
password
date_creation
Run Code Online (Sandbox Code Playgroud)
这是一个默认的,但是我想知道如何定义角色,如果它是管理员或工人,比如isAdmin:true然后我检查这个Bool?或者我可以创建另一个角色表并将其连接到用户表?
但也许我必须为两者创建一个表,我的意思是有一个管理员,它有一个密码和一些功能,然后使用户工具有另一个密码和其他功能.
然后我想让问题表包含:
_id
question_name
answers[1,2,3,4]
correctAnswer or answers because it can be multi option chooser
topic
isExamQuestion
dificulty
Run Code Online (Sandbox Code Playgroud)
那么Room表应该包含:
_id
name
capacity
type (game can be as a group or solo) that's why this attribute
exam (This should be a flag to know if this question is for an exam or not (It can be for EXAM or PRACTISE)
ranking (This is the top X from 1 to X)
don't …Run Code Online (Sandbox Code Playgroud) mysql database postgresql database-design entity-relationship
我正在使用 Hilt 创建一个宠物项目,也许我遇到这个问题是因为我正在安装所有内容SingletonComponent::class,也许我应该为每个项目创建组件。
pet 项目有一个NetworkModule, UserPrefsModule,当我尝试创建一个Authenticatorfor时,问题出现了OkHttp3。
这是我的网络模块
@Module
@InstallIn(SingletonComponent::class)
object NetworkModule {
@Singleton
@Provides
fun providesHttpLoggingInterceptor() = HttpLoggingInterceptor()
.apply {
if (BuildConfig.DEBUG) level = HttpLoggingInterceptor.Level.BODY
}
@Singleton
@Provides
fun providesErrorInterceptor(): Interceptor {
return ErrorInterceptor()
}
@Singleton
@Provides
fun providesAccessTokenAuthenticator(
accessTokenRefreshDataSource: AccessTokenRefreshDataSource,
userPrefsDataSource: UserPrefsDataSource,
): Authenticator = AccessTokenAuthenticator(
accessTokenRefreshDataSource,
userPrefsDataSource,
)
@Singleton
@Provides
fun providesOkHttpClient(
httpLoggingInterceptor: HttpLoggingInterceptor,
errorInterceptor: ErrorInterceptor,
authenticator: Authenticator,
): OkHttpClient =
OkHttpClient
.Builder()
.authenticator(authenticator)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(errorInterceptor)
.build() …Run Code Online (Sandbox Code Playgroud) 我尝试在我的设备的设置应用程序中选择子集,我看到了这个例外.这是否意味着设置是一个特权进程,无法访问webview?
我尝试从设置中选择HDMI选项,这是异常堆栈:
03-23 08:45:03.301 E/AndroidRuntime( 3299): Caused by: java.lang.UnsupportedOperationException: For security reasons, WebView is not allowed in privileged processes
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:96)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebView.getFactory(WebView.java:2194)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebView.ensureProviderCreated(WebView.java:2189)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebView.setOverScrollMode(WebView.java:2248)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.view.View.<init>(View.java:3588)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.view.View.<init>(View.java:3682)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.view.ViewGroup.<init>(ViewGroup.java:497)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebView.<init>(WebView.java:544)
03-23 08:45:03.301 E/AndroidRuntime( 3299): at android.webkit.WebView.<init>(WebView.java:489)
03-23 …Run Code Online (Sandbox Code Playgroud) 我开始创建一个可以从中购买商品的APP。可能是这样的:
在这里你可以看到Image,Name of product和Price。嗯,我有媒体链接一个Sign-in with Google用做Authentication Firebase和我存储它Firebase database,我想创建下面这个结构@Alex马莫向我建议:
Firebase-root
|
--- users
| |
| --- uid1
| |
| --- //user details (name, age, address, email and so on)
| |
| --- products
| |
| --- productId1 : true
| |
| --- productId2 : true
|
--- products
| |
| --- productId1
| | |
| | --- productName: "Apples"
| | | …Run Code Online (Sandbox Code Playgroud) android in-app-purchase in-app-billing firebase firebase-realtime-database
我正在创建一个详细的活动,我有一个弯曲的工具栏,在工具栏的中心我有一个圆形的 ImageView,问题是在不同的屏幕上,图像没有居中。
我想要实现的是:
1.- 创建一个带有后退箭头按钮和右侧一个图标的工具栏
我把它定义为:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/curve_toolbar_2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:theme="@style/ThemeOverlay.AppCompat.Dark" />
<View
android:id="@+id/view"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/circle_shape"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/toolbar"
app:layout_constraintVertical_bias="0.09" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_pew"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp"
android:src="@drawable/ic_favorite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/appCompatImageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/ic_favorite"
app:layout_constraintBottom_toBottomOf="@+id/view"
app:layout_constraintEnd_toEndOf="@+id/view"
app:layout_constraintStart_toStartOf="@+id/view"
app:layout_constraintTop_toTopOf="@+id/view" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_example"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Example"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/view"
app:layout_constraintStart_toStartOf="@+id/view"
app:layout_constraintTop_toBottomOf="@+id/view" />
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_conokstraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_example"
app:layout_constraintVertical_bias="0.13">
<androidx.cardview.widget.CardView
android:id="@+id/item_card_view" …Run Code Online (Sandbox Code Playgroud) android ×9
kotlin ×3
firebase ×2
dagger-2 ×1
dagger-hilt ×1
database ×1
firebaseui ×1
gmsmapview ×1
google-maps ×1
java ×1
layout ×1
mysql ×1
postgresql ×1
service ×1