Я развернул свое приложение в PlayStore, и оно без проблем работает на телефоне Galaxy, но в Oxygen OS вылетало.Ниже мой код и ошибка.Любые предложения приветствуются.
Используемый язык Kotlin
Параметры опробованы
myIntent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
Код:
override fun onBindViewHolder(p0: MyViewHolder, p1: Int) {
Picasso.get().load(testList[p1].Image).into(p0.imageView)
p0.textView.text=testList[p1].Name
p0.setClick(object:IRecyclerClick
{
override fun onClick(view: View, position: Int) {
context.startActivity(Intent(context,MainActivity::class.java))
Intent(context, MainActivity::class.java)
Common.selected_test=testList[position]
}
}
)
}
Ошибка:
2019-03-19 23:57:00.545 26980-26980/com.candy.testreader E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.candy.testreader, PID: 26980
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:912)
at android.app.ContextImpl.startActivity(ContextImpl.java:888)
at com.candy.testreader.Adapter.MyTestAdapter$onBindViewHolder$1.onClick(MyTestAdapter.kt:39)
at com.candy.testreader.Adapter.MyTestAdapter$MyViewHolder.onClick(MyTestAdapter.kt:50)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)