I am a beginner developer working on a Mac. Any help with this problem will be GREATLY appreciated. My app source code was created in Buzztouch. I have imported it to Eclipse. I have set up the SDK. I have run the Hello, World app successfully. I have tried altering the Target Name/API levels multiple times. I have tried uninstalling and reinstalling Eclipse and the Android SDK Manager, and have deleted and reinstalled the app files.
My objective is simply to test my application and package it to submit to the app store.
When I tried to launch the app on the emulator, i get the following results (application title has been replaced with APPNAME for privacy, title itself is properly formatted):
ON LOGCAT
04-19 18:44:25.187: E/AndroidRuntime(563): FATAL EXCEPTION: main
04-19 18:44:25.187: E/AndroidRuntime(563): java.lang.RuntimeException: Unable to resume activity {com.APPNAME/com.APPNAME.BT_screen_splash}: java.lang.NumberFormatException: Invalid int: "2.5"
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.os.Looper.loop(Looper.java:137)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 18:44:25.187: E/AndroidRuntime(563): at dalvik.system.NativeStart.main(Native Method)
04-19 18:44:25.187: E/AndroidRuntime(563): Caused by: java.lang.NumberFormatException: Invalid int: "2.5"
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.invalidInt(Integer.java:138)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parse(Integer.java:375)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parseInt(Integer.java:366)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parseInt(Integer.java:332)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.APPNAME.BT_screen_splash.onResume(BT_screen_splash.java:104)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.Activity.performResume(Activity.java:4539)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2434)
04-19 18:44:25.187: E/AndroidRuntime(563): ... 12 more
ON CONSOLE
[2012-04-19 18:51:57 - APP NAME] Android Launch!
[2012-04-19 18:51:57 - APP NAME] adb is running normally.
[2012-04-19 18:51:57 - APP NAME] Performing com.APPNAME.BT_activity_root activity launch
[2012-04-19 18:51:57 - APP NAME] Automatic Target Mode: launching new emulator with compatible AVD 'APPNAME'
[2012-04-19 18:51:57 - APP NAME] Launching a new emulator with Virtual Device 'APPNAME'
[2012-04-19 18:52:09 - Emulator] 2012-04-19 18:52:09.489 emulator-arm[3242:80b] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2012-04-19 18:52:09 - Emulator] emulator: emulator window was out of view and was recentered
[2012-04-19 18:52:09 - Emulator]
[2012-04-19 18:52:09 - APP NAME] New emulator found: emulator-5554
[2012-04-19 18:52:09 - APP NAME] Waiting for HOME ('android.process.acore') to be launched...
[2012-04-19 18:53:07 - APP NAME] HOME is up on device 'emulator-5554'
[2012-04-19 18:53:07 - APP NAME] Uploading APP NAME.apk onto device 'emulator-5554'
[2012-04-19 18:53:09 - APP NAME] Installing APP NAME.apk...
[2012-04-19 18:54:10 - APP NAME] Success!
[2012-04-19 18:54:10 - APP NAME] Starting activity com.APPNAME.BT_activity_root on device emulator-5554
[2012-04-19 18:54:12 - APP NAME] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.APPNAME/.BT_activity_root }
ON EMULATOR
A popup window appears that says "Unfortunately, [Name of App] Has Stopped."
CODE: BT_screen_splash.java
package com.APPNAME;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
public class BT_screen_splash extends BT_activity_base{
//properties...
String transitionType = "";
int startTransitionAfterSeconds = 0;
int transitionDurationSeconds = 0;
//onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.activityName = "BT_screen_splash";
BT_debugger.showIt(activityName + ":onCreate");
//set the content view...
LinearLayout baseView = (LinearLayout)findViewById(R.id.baseView);
//setup background colors...
BT_viewUtilities.updateBackgroundColorsForScreen(this, this.screenData);
//setup background images..
if(backgroundImageWorkerThread == null){
backgroundImageWorkerThread = new BackgroundImageWorkerThread();
backgroundImageWorkerThread.start();
}
//inflate this views layout file...
//inflate this screens layout file..
LayoutInflater vi = (LayoutInflater)thisActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View thisScreensView = vi.inflate(R.layout.screen_splash, null);
//add the view to the base view...
baseView.addView(thisScreensView);
/*
* *******************************************************************
* Notes:
* screen_splash.xml is an empty layout file. You can add whatever you
* want to it. The image for the splash screen is setup with the
* BT_viewUtilities.updateBackgroundColorsForScreen() method.
* That method sets the background image (the splash image) in this
* screens parent class. BT_activity_base. See above, almost all
* BT screens extend BT_activity_base
********************************************************************
*/
}
//onResume...
public void onResume(){
super.onResume();
//get values..
this.transitionType = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "transitionType", "");
this.startTransitionAfterSeconds = Integer.parseInt(BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "startTransitionAfterSeconds", "0"));
//setup transition if we don't have -1
if(startTransitionAfterSeconds > -1){
delayHandler.removeCallbacks(mDelayTask);
delayHandler.postDelayed(mDelayTask, ((startTransitionAfterSeconds + 1) * 1000));
}
}
//handle touch event..
@Override
public boolean onTouchEvent(MotionEvent event){
//BT_debugger.showIt("BT_screen_splash: touch event..");
//ignore touch events if we have a startTransitionAfterSeconds value..
if(startTransitionAfterSeconds < 1){
if(event.getAction() == MotionEvent.ACTION_DOWN){
animateSplashScreen();
}
}
return false;
}
/////////////////////////////////////////////////////////////////////
//handles question delay updates after each answer
Handler delayHandler = new Handler(){
@Override public void handleMessage(Message msg){
delayHandler.removeCallbacks(mDelayTask);
}
};
private Runnable mDelayTask = new Runnable() {
public void run() {
animateSplashScreen();
}
};
//end timer stuff
/////////////////////////////////////////////////////////////////////
//handles animation...
public void animateSplashScreen(){
BT_debugger.showIt("BT_screen_splash:animateSplashScreen");
//finish this screen so it cannot be returned to...
BT_screen_splash.this.finish();
//the next screen...
BT_item tmpLoadScreenObject = null;
BT_item tmpMenuItemObject = null;
tmpMenuItemObject = new BT_item();
tmpMenuItemObject.setItemId("tempMenuItem");
tmpMenuItemObject.setItemNickname("tempMenuItem");
try{
tmpMenuItemObject.setItemType("BT_menuItem");
tmpMenuItemObject.setJsonObject(new JSONObject("{\"transitionType\":\"fade\"}"));
}catch(Exception e){
}
//next screen to load...either tabbed home or the first screen in the list...
if(APPNAME_appDelegate.rootApp.getTabs().size() > 0){
BT_debugger.showIt("Building tabbed interface...");
//load BT_activity_root_tabs...
tmpLoadScreenObject = new BT_item();
tmpLoadScreenObject.setItemId("tmpRootTabs");
tmpLoadScreenObject.setItemNickname("tmpRootTabs");
try{
tmpLoadScreenObject.setItemType("BT_activity_root_tabs");
tmpLoadScreenObject.setJsonObject(new JSONObject("{}"));
}catch(Exception e){
}
}else{
//find the app's home screen...
tmpLoadScreenObject = APPNAME_appDelegate.rootApp.getHomeScreen();
//flag it as the home screen...
tmpLoadScreenObject.setIsHomeScreen(true);
}
//load...
if(tmpLoadScreenObject != null){
//remember current screen...
APPNAME_appDelegate.rootApp.setCurrentScreenData(tmpLoadScreenObject);
//load screen object...
BT_act_controller.loadScreenObject(this, this.screenData, tmpMenuItemObject, tmpLoadScreenObject);
}
}
}
You are getting a number format exception because you are trying to convert 2.5 to an integer.
Look at line 104 in BT_Splash_screen.java and figure out what kind of conversion you are trying to make and make it integer friendly.
EDIT:
this line:
is your problem. It is reading 2.5 from your json data and trying to parse it into an int.