Tuesday, April 30, 2013

[android-developers] Re: Getting error "Unfortunately App Stopped"... Fed up...

Thanks so much.. Since I was novice so couldn't catch it. I am speeding up now... Hope to do better now..
Peaceful time ahead..

On Monday, April 29, 2013 8:17:37 PM UTC+5:30, tibig...@gmail.com wrote:
you must call setContentView(R.layout.activity_main) before findViewById(R.id.callButton)

On Wednesday, April 24, 2013 11:01:13 PM UTC+3, Ravi Tewari wrote:
Can anyone tell wats wrong here... I am new to Android but NOT to Java.. I am getting the error "Unfortunately App Stopped" while running it in emulator.
Can anyone help to figure the error out here: (Plz note that I have already set the permission for Intent. Actually below ACTION_CALL Intent is working fine without adding any Button. But when I add the button and registers the OnClickListener, it starts giving the error.) So wats wrong below while registering the listener?
Appreciate the response.. Let me know if any other info u need to debug..
My activity java file is:
package os.androidphonedialer;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.content.Intent;
import android.net.Uri;
import android.widget.Button;
public class MainActivity extends Activity {
    protected void onCreate(Bundle savedInstanceState) {
        final Button callButton = (Button) findViewById(R.id.callButton);
        callButton.setOnClickListener(new Button.OnClickListener() {public void onClick(View v){
         Intent callIntent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:5551212"));
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
And the layout file is:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    tools:context=".MainActivity" >
    android:text="Show Dialer" />

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment