openUri: do not crash if something went wrong
This commit is contained in:
parent
0683ba9ab3
commit
895e87c2a3
|
@ -309,7 +309,12 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||||
|
|
||||||
CustomTabsIntent intent = builder.build();
|
CustomTabsIntent intent = builder.build();
|
||||||
|
|
||||||
intent.launchUrl(this, uri);
|
try {
|
||||||
|
intent.launchUrl(this, uri);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
toast(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +363,12 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
|
||||||
startActivity(intent);
|
try {
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
toast(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -386,7 +396,11 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
|
||||||
startActivity(intent);
|
try {
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
toast(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user