why does .apk is not getting installed in android emulator ?

Posted by Saravana on Stack Overflow See other posts from Stack Overflow or by Saravana
Published on 2011-03-04T07:23:29Z Indexed on 2011/03/04 7:24 UTC
Read the original article Hit count: 202

Filed under:
|

I tried the following code with android 2.3.3 (AVD). When i run this code it waits saying Waiting for HOME ('android.process.acore') to be launched... but keeps on waiting. So i tried running second time .. this time it says

[2011-03-04 12:28:39 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:28:39 - DialANumber] Installing DialANumber.apk... [2011-03-04 12:29:14 - DialANumber] HOME is up on device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Installing DialANumber.apk...

and after some time fails with

[2011-03-04 12:31:37 - DialANumber] Failed to install DialANumber.apk on device 'emulator-5554! [2011-03-04 12:31:37 - DialANumber] (null) [2011-03-04 12:31:39 - DialANumber] Launch canceled!

the code follows:

package com.DialANumber;

import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

import android.view.KeyEvent;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.LinearLayout;

public class DialANumber extends Activity {

EditText mEditText_number = null;

LinearLayout mLinearLayout_no_button = null;

Button mButton_dial = null;

@Override public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

mLinearLayout_no_button = new LinearLayout(this);

mEditText_number = new EditText(this);
mEditText_number.setText("5551222");
mLinearLayout_no_button.addView(mEditText_number);

mButton_dial = new Button(this);
mButton_dial.setText("Dial!");
mLinearLayout_no_button.addView(mButton_dial);
mButton_dial.setOnClickListener(new View.OnClickListener() {
  public void onClick(View v) {
    performDial();
  }
});

setContentView(mLinearLayout_no_button);

}

public boolean onKeyDown(int keyCode, KeyEvent event) {

if (keyCode == KeyEvent.KEYCODE_CALL) {

  performDial();

  return true;

}
return false;

}

public void performDial(){

if(mEditText_number!=null){

  try {

    startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + mEditText_number.getText())));

  } catch (Exception e) {

    e.printStackTrace();

  }
}//if

} }

I am just starting to learn developing android apps. please help me out.. Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about android