English 中文(简体)
如何将html与 k子连接起来
原标题:how to link html with if else button in kotlin

在我的申请中,我想把顿与一个网站连接起来,就像用户在浏览器上点击这一纽顿网站时一样,但是,在点击 but子时,我会看到GisPostIme点0和GisPostIme点1。 我的守则:

val viewButton = findViewById<Button>(R.id.view_button)
        viewButton.setOnClickListener {
            val macAddress = scanResultBinding.deviceAddress.toString(){
            val url = if (macAddress.isNotEmpty() && macAddress == "//macAddress") {
                "MyWebsiteStore"
            } else {
                "MyWebsiteHome/"
            }
            val intent = Intent(Intent.ACTION_VIEW)
            intent.data = Uri.parse(url)
            startActivity(intent)
        }
   
问题回答

这似乎与你一样,在你的法典中存在一刀切的错误。 页: 1 删除这一点,看它是否解决这个问题。 你的法典应当这样考虑:

val viewButton = findViewById<Button>(R.id.view_button)
viewButton.setOnClickListener {
    val macAddress = scanResultBinding.deviceAddress.toString()
    val url = if (macAddress.isNotEmpty() && macAddress == "//macAddress") {
        "MyWebsiteStore"
    } else {
        "MyWebsiteHome/"
    }
    val intent = Intent(Intent.ACTION_VIEW)
    intent.data = Uri.parse(url)
    startActivity(intent)
}

这应当把问题与“PostIme pointer”电文联系起来。





相关问题
C# Building An Array with Button Entries

I have a set of buttons that I want to add into an array so that they are ordered. The buttons I have are: Monday0700Button Monday0730Button Monday0800Button Monday0830Button and so on. How do I ...

Text in disabled and css styled button shows movement in IE

I have disabled and css styled buttons. In Firefox, disabled buttons do not move at all when pressed (which is what is expected), in IE, the text in the buttons still moves a few pixels. Why does ...

Where is Button.DialogResult in WPF?

In System.Windows.Forms.Button there is a property DialogResult, where is this property in the System.Windows.Controls.Button (WPF)?

How to create a submit button template in Oracle APEX?

I m trying to create a template for a button in Oracle APEX but I don t seem to have access to the appropriate substitution strings to make it work. For non-templated buttons APEX seems to insert a ...

Removing text from HTML buttons on all browsers?

We have buttons of many sizes and colors that use background images. There is a label on the background image itself, but we need to keep the button s text in the HTML for usability/accessibility. How ...

Back button loop with IFRAMES

In my (school) website we use Iframes to display class blogs (on blogger). This works well EXCEPT if the user then clicks on (say) a photo inside the iframe. Blogger (in this case) then displays the ...

ruby on rails on click events

I am so sorry if this question seems too easy but I can t seem to find it anywhere. I am creating a ruby in steel project. I have created a html.erb and rb file in a vs project (ruby on rails). My ...

热门标签