Я просто хочу спросить, почему StartActivity (намерение) не удалось? Затем logcat покажите:
D/AddPhotosFragment: categoryDesignID: ClothingDesign
D/EGL_emulation: eglMakeCurrent: 0x7ea0c3349a00: ver 2 0 (tinfo 0x7ea19df7cea0)
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@15c2c02
D/CategoryDetailRecyclerViewActivity: Intent:Intent { }
D/CategoryDetailRecyclerViewActivity: categoryDesignID: null
AddPhotosFragment.kt
//Upload images button
upload_imgs_button.setOnClickListener {
Log.d(TAG, "uploadImgsPath: $uploadImgsPath");
//Upload images to firebase storage
if (uploadImgsPath != null) {
var count = imagesList.size
for (uriForUpload in imagesList) {
val uri = Uri.parse(uriForUpload)
val imgNameUUID = UUID.randomUUID().toString()
val withAppendedPath =
Uri.withAppendedPath(uri, imgNameUUID).toString()
var imgFileRef = uploadImgsPath!!.child(withAppendedPath)
imgFileRef.putFile(uri)
.continueWithTask {
if (!it.isSuccessful) {
it.exception?.let {
throw it
}
}
imgFileRef.downloadUrl
}.addOnCompleteListener {
if (it.isSuccessful) {
var uriForDownload = it.result.toString()
Log.d(TAG, "uriForDownload:$uriForDownload ");
downloadImagesUriList.add(uriForDownload)
count--
if (count == 0) {
Log.d(
TAG,
"downloadImagesUriList:$downloadImagesUriList "
);
var uuidOfGroupId = UUID.randomUUID().toString()
var uploadedImages = UploadedImages(
categoryDesignID,
user!!.uid,
downloadImagesUriList,
Timestamp.now(),
uuidOfGroupId,
user!!.photoUrl.toString(),
user!!.displayName
)
Log.d(TAG, "uploadedImages:$uploadedImages ");
//Save uploaded images path info to firestore
firestore.collection("uploadedImages")
.document(uuidOfGroupId)
.set(uploadedImages)
.addOnSuccessListener {
Toast.makeText(
context,
"Upload successful",
Toast.LENGTH_LONG
).show()
//TODO Show RecyclerView
var intent = Intent(
context,
CategoryDetailRecyclerViewActivity::class.java
)
Log.d(
TAG,
"categoryDesignID: ${uploadedImages.categoryDesignID}"
);
intent.putExtra(
"categoryDesignID",
uploadedImages.categoryDesignID
)
startActivity(intent)
}
}
}
}
}
CategoryDetailRecyclerViewActivity.kt
class CategoryDetailRecyclerViewActivity : AppCompatActivity() {
val TAG = CategoryDetailRecyclerViewActivity::class.java.simpleName
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_category_detail_recycler_view)
var intent = Intent()
Log.d(TAG, "Intent:$intent ");
var categoryDesignID = intent.getStringExtra("categoryDesignID")
Log.d(TAG, "categoryDesignID: $categoryDesignID");
Мой манифест:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.categoryDetailRecyclerView.CategoryDetailRecyclerViewActivity"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>