Created
June 20, 2019 13:54
-
-
Save nirav-tukadiya/0670a4f7e6bae5140d98b12358969dda to your computer and use it in GitHub Desktop.
FlutterViewActivity loads the view from AFE_Flutter module.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package `in`.androidgeek.afe | |
import android.content.Context | |
import android.content.Intent | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import android.widget.FrameLayout | |
import io.flutter.facade.Flutter | |
/** | |
* Created by Nirav Tukadiya on 20 Jun, 2019. | |
*/ | |
class FlutterViewActivity : AppCompatActivity() { | |
companion object { | |
fun startActivity(context: Context) { | |
val intent = Intent(context, FlutterViewActivity::class.java) | |
context.startActivity(intent) | |
} | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val flutterView = Flutter.createView( | |
this@FlutterViewActivity, | |
lifecycle, null | |
) | |
addContentView( | |
flutterView, | |
FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment