Hi
I have written a little program that will open the default browser and direct to an URL. My problem is that when I click Android’s back button, it will return to a blank page, how can I change it to exit the program instead of return to a blank page
The code for reference:
package com.example.helloandroid;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent httpIntent = new Intent(Intent.ACTION_VIEW);
httpIntent.setData(Uri.parse("http://www.bbc.co.uk/"));
startActivity(httpIntent);
}
}
add this line:
after your line startActivity(httpIntent);
The black page is your activity, which is not set any content.