0
버튼을 클릭하여 인스 타 그램을 클릭하면 브라우저에서 직접 가져옵니다. 즉, 인스 트램 응용 프로그램으로 이동하고 싶습니다. 내 모바일, 브라우저에 가야한다. Instagram이 브라우저로 이동합니다
나는 둘 다 브라우저에 직접 첫 번째 코드를 내게됩니다,이 시도 :
inslink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
try {
Uri uri = Uri.parse("http://instagram.com/natgeo");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
catch (Exception e) {
Uri uri = Uri.parse("http://instagram.com/natgeo");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}
});
두 번째 코드 :
inslink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (uri.contains("https://i.instagram.com/")) {
String natgeo = "natgeo";
String uri = "instagram://Page/" + natgeo;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
} else {
String natgeo = "natgeo";
String uri = "https://i.instagram.com/" + natgeo;
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);
}
}
});