I used a lot of times Intents and they worked all the time, but with this code:
ImageButton button = (ImageButton) findViewById(R.id.imageButton1);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
int min = 1;
int max = idmax;
Random r = new Random();
final int i1 = r.nextInt(max - min + 1) + min;
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Thread thread = new Thread(new Runnable(){
@Override
public void run() {
try {
text= inviaDati(String.valueOf(i1));
splited = text.toString().split("\\s+");//null array
type=splited[1]; //image, video, ecc
link=splited[2];
} catch (Exception e) {
e.printStackTrace();
}
}
});
thread.start();
if (type!=null)
{
if (type.equals("image"))
{
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.stackoverflow.com"));
startActivity(browserIntent);
}
}
}
});
It give me a: No activity found to handle intent What can I do? Thanks in advance
NB: Other functions are working well
您可能希望在将stackoverflow设置为目标的行上将Uri.parse(...)
更改为browserIntent.setData(Uri.parse...)
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.