I was trying to use the code below
But the code wasn't being compiled as Uri class was not found.
I tried to use the code in B4A way but intent class doesn't have any method called setPackage. setComponent didn't give me the desired result.
Can you guys please suggest me what should I do here?
B4X:
#If JAVA
public void open_on_instagram(String link){
Uri uri = Uri.parse("http://instagram.com/p/" + link);
Intent likeIng = new Intent(Intent.ACTION_VIEW, uri);
likeIng.setPackage("com.instagram.android");
try {
startActivity(likeIng);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://instagram.com/p/" + link)));
}
}
#End If
But the code wasn't being compiled as Uri class was not found.
I tried to use the code in B4A way but intent class doesn't have any method called setPackage. setComponent didn't give me the desired result.
Can you guys please suggest me what should I do here?