• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Create app which redirects to Mobile site

kyaghi

Lurker
I would like to create a simple app which redirects to my mobile site in the browser. No further customization what so ever. I tried eclipse and failed, is there a simpler way? thx!
 
You are looking for your site to open in the web browser itself (prompt the user to pick app to open the site with), or want to open the site within the native app inside a webview?

what is your site?
 
Use this..

Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);


replace your site name with the google.com.
 
Use this..

Uri uri = Uri.parse("http://www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);


replace your site name with the google.com.

If he wants a native app to view his site, this won't help. What this will do is open the site in the user's preferred browser app, which defeats the purpose of having an app at all.
 
Here is a code snippet to allow you to setup a webview for loading a site and allowing the user to interact with it from the webview.

[HIGH]webview = (WebView) findViewById(R.id.webView1);
//enable hyperlinks to open within the webview and not prompt
//for a browser to open
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
//show the user when the page is loading so they know what is going on
webview.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int progress) {
thisActivity.setTitle("Loading...");
thisActivity.setProgress(progress * 100);
if (progress == 100) {
thisActivity.setTitle(R.string.app_name);
}
super.onProgressChanged(view, progress);
});
webview.loadUrl("http://www.google.com");[/HIGH]
 
If he wants a native app to view his site, this won't help. What this will do is open the site in the user's preferred browser app, which defeats the purpose of having an app at all.

If you read kyaghi's requirement carefully "I would like to create a simple app which redirects to my mobile site in the browser. No further customization what so ever." You will find he wants redirection to browser that's why suggested this.
 
Back
Top Bottom