Java 使用DialogFragment的Web链接
我有这个对话框片段,但我正在尝试获取它,这样当用户单击“我的其他应用”按钮时,他们会被重定向到一个网址。有没有办法做到这一点。 谢谢你的帮助 谢谢Java 使用DialogFragment的Web链接,java,android,eclipse,onclick,fragmentmanager,Java,Android,Eclipse,Onclick,Fragmentmanager,我有这个对话框片段,但我正在尝试获取它,这样当用户单击“我的其他应用”按钮时,他们会被重定向到一个网址。有没有办法做到这一点。 谢谢你的帮助 谢谢 在按钮上执行此操作,然后单击: @Override public void onClick(DialogInterface dialog, int which) { String url = "http://www.example.com"; Intent i = new Intent(Intent.ACTION_VIEW);
在按钮上执行此操作,然后单击:
@Override
public void onClick(DialogInterface dialog, int which) {
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
发帖前做一点调查please@njzk2对不起,谢谢!
@Override
public void onClick(DialogInterface dialog, int which) {
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// TODO Auto-generated method stub
AlertDialog.Builder theDialog = new AlertDialog.Builder(getActivity());
theDialog.setTitle("About");
String d1 = "Thanks For Downloading! ";
String d2 = "Made by ME";
theDialog.setMessage(d1 +"\n"+ d2 );
theDialog.setPositiveButton("My Other Apps", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
theDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getActivity(), "Clicked Cancel",
Toast.LENGTH_SHORT).show();
}
});
return theDialog.create();
}
}