Sam
10/04/2018, 7:15 PMval launchUri = try {
if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
} catch ( e : android.content.ActivityNotFoundException ) {
if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
}
tipsy
10/04/2018, 7:20 PMVladyslav Sitalo
10/04/2018, 7:20 PM"..."
different in each case? also what is throwing the exception?tipsy
10/04/2018, 7:21 PMval uri = if(available) ... else ...
Uri.parse(uri)
Sam
10/04/2018, 7:21 PMtry {
val launchUri = if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
startActivity( Intent( Intent.ACTION_VIEW, launchUri ) )
} catch ( e : android.content.ActivityNotFoundException ) {
val launchUri = if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
startActivity( Intent( Intent.ACTION_VIEW, launchUri ) )
}
Ernest Zamelczyk
10/05/2018, 8:34 AMval launchUri = if(isAvailable())
Uri.parse("...")
else
Uri.parse("...")
val intent = Intent(Intent.ACTION_VIEW, launchUri)
if(intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent)
else {
//resolve new url and start activity
}
ianbrandt
10/05/2018, 2:31 PMSam
10/05/2018, 2:33 PM