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

error message when launch the app

kurah

Lurker
Hi,

What I need:
I want people to be able to download an app which would be a simple shortcut on their home screen, to my mobile website. Basically I just want it to open the browser and launch the mobile site. I would have preferred to make an equivalent of the script for iPhone for the "Add to home screen", but it does not exists for android, and I do not want to display a message with instructions because people are lazy. So I need something like they install the app from the market or via a QR code in one click and that's it.

What my problem is:
It seems to work, that means my app opens the site, but there is an error which says:
The application SydneyRestaurants (process com.example.sydney.restaurants) has stopped unexpectedly. Please try again.
Then I click on "Force close", but the browser is opened and the site in displayed properly. So I guess the app launch the browser, and close after. How can I avoid this error message ?

I also have this problem on the Virtual Device of Eclipse.

What I did:
I do not know anything about coding for mobile. I just followed a tutorial from the android developers site. I do not understand anything about the code I just copy and paste this into Eclipse, and followed the instructions of the site:

Code:
package com.example.sydney.restaurants;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;


public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        String url = "http://www.sydneyrestaurants.com/mobile";
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(url));
        startActivity(i);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

Then I exported to a APK file, and I downloaded it into my android phone. Then I have this problem. Can you please help me ? I already search in the forum and I found this thread: http://androidforums.com/developer-...as-stopped-unexpectedly-please-try-again.html But I do not understand. I have no idea what is the path environment, I have no idea what is drawable, manifest or activities and things like that. This is like Chinese for me. Please can someone explain me ?

I want to also say that I do not know Java, c++, and languages like that. I just know web language like PHP, action script 3 and Javascript. So I am used to "coding things" but the software and app development really is like Chinese for me.

Thank you very much in advance for your help.
 
Back
Top Bottom