강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của shafeel22040
shafeel22040

câu hỏi đã được viết

[Trung cấp] Tổng quan Kind JETPACK <Tập 1> (Android Kotlin)

Navigation Data Transfer

Navigation Data Transfer Safe Args 강의중에서

Viết

·

255

·

Đã chỉnh sửa

0

override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?,
): View? {
    val view = inflater.inflate(R.layout.fragment_blank1, container, false)
    val action = BlankFragment1Directions.actionBlankFragment1ToBlankFragment2("ABCDE")

위의 코드중에서 "ABCD" 부분에서 빨간줄이 생기고 오류가 나네요 ... 왜 그럴까요 ???

소스코드는 아래 GITHUB 에 올려두었습니다

https://github.com/dongguntechnology/NaviDataTransfer

 

androidkotlinjetpack

Câu trả lời 2

0

shafeel2님의 프로필 이미지
shafeel2
Người đặt câu hỏi

Too many arguments for public final fun actionBlankFragment1ToBlankFragment2(): NavDirections defined in com.dongguninnovatiion.navidatatransfer.BlankFragment1Directions.Companion

 

이런메세지가 뜨는군요 ..

bokchi님의 프로필 이미지
bokchi
Người chia sẻ kiến thức

nav_test 부분을 이렇게 변경해보시겠어요?

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nav_test"
    app:startDestination="@id/blankFragment1">

    <fragment
        android:id="@+id/blankFragment1"
        android:name="com.dongguninnovatiion.navidatatransfer.BlankFragment1"
        android:label="fragment_blank1"
        tools:layout="@layout/fragment_blank1" >
        <action
            android:id="@+id/action_blankFragment1_to_blankFragment2"
            app:destination="@id/blankFragment2" />
    </fragment>

    <fragment
        android:id="@+id/blankFragment2"
        android:name="com.dongguninnovatiion.navidatatransfer.BlankFragment2"
        android:label="fragment_blank2"
        tools:layout="@layout/fragment_blank2" >
        <argument
            android:name="key"
            app:argType="string"
            android:defaultValue="Corea(Core)" />
        <action
            android:id="@+id/action_blankFragment2_to_blankFragment1"
            app:destination="@id/blankFragment1" />
    </fragment>
</navigation>

0

bokchi님의 프로필 이미지
bokchi
Người chia sẻ kiến thức

안녕하세요

어떤 오류메세지가 나오고, 빌드하면 어떤 메세지가 나오나요?

 

Hình ảnh hồ sơ của shafeel22040
shafeel22040

câu hỏi đã được viết

Đặt câu hỏi