Android :: Default_all Crashes App
Feb 9, 2009
I've been using:
Notification.DEFAULT_SOUND
for quite some time with great success. When I replace that with:
Notification.DEFAULT_ALL
the program crashes when the notification is called.
View 4 Replies
Jul 16, 2010
I'm trying to understand remote services at the moment and everything works fine, i can start the service and know how to communicate with it through the AIDL-interface. My problem is that the service seems to still run in the same process like the activity it was started from, because the activity crashes too, if there is an error thrown in the Service.
I set the service process to remote ( android:process=":remote" ) so what am i doing wrong? Or what do i have to do to unbind the service-process completely from the activity-process?
View 1 Replies
View Related
Apr 22, 2010
So i have a app that runs fine on the emulator but crashes (force close message as soon as i open the app) on every device i have tested it on. How can i see whats going on? what could be going on?
View 4 Replies
View Related
Oct 26, 2009
I'm trying to create an application that has 3 tabs. Under the middle tab should be a ListView. It starts up fine (on the left tab) but when I click the middle tab it crashes.
The other two tabs are static data specified in the main.xml file. But the middle tab, I try to create dynamically. Here's the code from the main onCreate function:
CODE:...............
Instead I appear to get an exception:
CODE:...............
ContactListActivity is defined this way:
public class ContactListActivity extends ListActivity { ...
I get the feeling that I'm supposed to create the Intent with something like Intent.ACTION_VIEW but this is where I get lost. If this is the problem, I could try stuff until it works, but I'd prefer to understand why.
Or is ContactListActivity supposed to override something ?
View 2 Replies
View Related
Sep 20, 2009
I'm getting fairly regular crashes using WebView's in the underlying C code (sigsegv's). There isn't a _whole_ lot of rhyme or reason to it, but one thing that is somewhat suspicious is that I have more than one webview active (only one is one the screen at any one time, but if this has anything to do with my problem it may not matter since it appears that webkit widgets run asynchronously from the main UI thread).
Here's the stack dump. I've looked through the archives and it appears that there are other dumps, but it's really hard to tell from my vantagepoint whether they have anything to do with one another.
This is pretty easily reproducible (especially with one particular url of mine) so it should be relatively easy to track down.
CODE:.................
View 3 Replies
View Related
Apr 30, 2009
I am finally testing my application on a G1 and even though it works fine on the emulator, it crashes on the G1
It crashes when it does:
CODE:.........
And the view is defined like this:
CODE:..............
View 3 Replies
View Related
Jan 15, 2010
I use to love Home ++ but lately its been crashing like crazy. I was gonna try GDE but I read some of the comments and that seems to have crashing issues also. Im tired of all the force closes. I have one widget and Im only using five home screens. Why is it closing so much
View 9 Replies
View Related
Nov 16, 2010
intentTest.java:
package intentTest.xyz.com;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button
public class intentTest extends Activity {
Button b;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b = (Button) findViewById(R.id.b);
b.setOnClickListener( new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(intentTest.this,seond.class );
startActivity(intent);
}});
}}
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="First screen"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="click"
android:name="@+id/b"
/>
</LinearLayout>
seond.java:
package intentTest.xyz.com;
import android.app.Activity;
import android.os.Bundle;
public class seond extends Activity{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second);
} }
second.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="second screen"
/>
manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="intentTest.xyz.com"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".intentTest"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".seond"></activity>
</application>
</manifest>
I get the following error code:
11-16 01:26:07.156: ERROR/AndroidRuntime(779): Uncaught handler: thread main exiting due to uncaught exception
11-16 01:26:07.166: ERROR/AndroidRuntime(779): java.lang.RuntimeException: Unable to start activity ComponentInfo{intentTest.xyz.com/intentTest.xyz.com.intentTest}: java.lang.NullPointerException
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread.access$2100(ActivityThread.java:116)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.os.Looper.loop(Looper.java:123)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread.main(ActivityThread.java:4203)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at java.lang.reflect.Method.invokeNative(Native Method)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at java.lang.reflect.Method.invoke(Method.java:521)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at dalvik.system.NativeStart.main(Native Method)
11-16 01:26:07.166: ERROR/AndroidRuntime(779): Caused by: java.lang.NullPointerException
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at intentTest.xyz.com.intentTest.onCreate(intentTest.java:18)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
11-16 01:26:07.166: ERROR/AndroidRuntime(779):
... 11 more
View 5 Replies
View Related
Jun 3, 2010
Anyone else having problems with their Incredible crashing and rebooting? Happened to me first a week ago, I thought it was a fluke while sending a txt message it randomly rebooted. Today it happened again while listening to the mp3 player with the screen locked and in my pocket.
View 1 Replies
View Related
Mar 23, 2010
I have an activity in my app, when i call the line
EditText username = (EditText)findViewById(R.id.usernameText); the app crashes, why is this?
View 3 Replies
View Related
Sep 27, 2010
I have separated java code from Android code and have two projects. Android dependent on Java project. Now i want to get the memory trace of the Java project on Android. For that I have created Androd Junit Project implementing Android Instrumentation, and a dummy android project dependent on my actual java project.(as I only want to get memory trace of java project on android).Problem is when I execute Android Junit project, and give a reference of dummy project removing java project dependency, all tests(dummy) run fine.But when I run junit project, with dummy android proj keeping dependency on java project, my application crashes.I get an error message like : "Process crash" not getting any error message in logcat. No clue whats wrong with code.Any help is highly needed.
View 1 Replies
View Related
Aug 12, 2009
My app has been pretty stable so forth, and suddenly I keep getting these crashes that kill the entire process. What do they mean and how should I deal with them? Since I dont get any usefull stacktrace I really dont know how to debug this. Below is the dump from my error log.
CODE:...................
View 7 Replies
View Related
Dec 7, 2009
I want to use a map in my application but I can't get it to run.
It always crashes with the following error:
CODE:.....
My XML file:
CODE:...................
My layout:
CODE:...............
In my code I add the map like this:
CODE:.............
View 5 Replies
View Related
Jun 17, 2010
Can someone explain to me why this AlertDialog crashes? code...
View 1 Replies
View Related
Nov 19, 2010
In my application I've implemented such that pressing the hardware volume keys displays a Toast with the current volume. Things go well most of the times. However long presses of the volume keys do succeed in crashing my application. The Log generated on crash is the following...
The approach I follow:
I have a toast Object and for every key press event detected I inflate a view ,set the view elements within, set it to the toast and then show the toast.
Any idea what is going wrong ? code...
View 1 Replies
View Related
May 26, 2010
My app crashes when the device orientation changes..Tried debugging on real device, but I have no clue where the crash exactly happens.. I would appreciate if someone could throw some light on this:
Below is the error log...
View 2 Replies
View Related
Nov 25, 2009
I'm experiencing crashes that don't produce a "force close" message. Instead, the app exits immediately without an error message. In the log, it seems the problem is inside the framework's libraries but I don't really know how to interpret it.
Here it is:
CODE:.............................
View 3 Replies
View Related
Oct 3, 2010
I've been writing a simple drawing App as homework for university. Drawing works fine, but the canvas should also be cleared when the App is coming back from the background. When switching back i get the following code...
View 2 Replies
View Related
Mar 11, 2009
I should post this as a follow-up to my previous thread.
But I think this problem (may be) somewhat big so I create a new thread:
1. If a user install an alternative to 'Home'. (I'll call it 2nd Home)
2. He set this 2nd Home to launch by default for 'Home' action.
3. Whenever this 2nd Home crashes, their only choice is to reboot the system... ?
Because, after setting 2nd Home as default, the 'chooser' will not come out any more even if you press the 'Home' button.
In some case if this 2nd Home crashes in its initialization state, user can go no where, can't even go to Settings -> Manage App -> Clear Defaults
Am I missing something?
View 3 Replies
View Related
Mar 14, 2009
When i add Internet permissions to my manifest file my application refuses to even start and i get this in my console code...
fix this? code....
View 2 Replies
View Related
Oct 16, 2010
I'm having a bit of trouble with an Android app that I'm working on (mostly for practice and learning purposes) that uses the AudioManager object.
When defining the AudioManager as follows, however, the app crashes when I run it:
CODE:................
When I simply comment out the AudioManager declaration, the app does not crash. Any ideas as far as what I'm doing wrong? I'm a bit of a beginner to Android development, so I have a feeling that I'm missing something obvious.
I've also tried adding the android.permission.MODIFY_AUDIO_SETTINGS and android.permission.MODIFY_PHONE_STATE permissions to the AndroidManifest.xml file, but that has made no difference.
View 1 Replies
View Related
Jan 18, 2010
I am trying to run an application on an android emulator, but it crashes. i am following a howto
i don't know what to do, it just crashes. other applications are running fine, can anyone tell me what i am doing wrong.here is the code...
View 4 Replies
View Related
Apr 16, 2010
Is there any way to catch crashes in my own android app? Something like a global uncaught exception handler? Just wondering if I could install something like that, then if an uncaught exception is thrown, I could pop up a dialog for the user and ask if they want to mail a dump of the exception to me.
View 2 Replies
View Related
Nov 17, 2010
I have an app that is setting the contentView when images are clicked.This one from my main.xml loads the options.xml fine.code...
But when I add a listener to an image that is inside the options.xml the app crashes upon launch.I am referencing the image via the code below and showing the clickListener I am adding.code...
Trying to see if there was an error thrown but LogCat does not seem to show anything.
View 1 Replies
View Related
Nov 9, 2009
Hi. im having a trouble getting Android's camera to work. i started CameraActivity Intent from MapActivity (when i start camera activity, i unresgister all listeners used in map activity), and when i call takepicture method, it just exits camera activity and return to map activity dumping strange msg showing below.
the camera sounds off the shutter-sound and it crashes camera activity. sometimes it succeeds, and sometimes doesn't.
it happens when im using docomo's HT-03A, 1.6sdk is installed.
Anyone having same trouble as i do?
CODE:....................
View 4 Replies
View Related
Jun 28, 2010
We are exploring the default applications in Froyo and we found out that the Camera app always crashes seconds after it loads.
Is this related to the no camera/video input limitation of the application? If not, what seems to be the problem? We already added all the additional properties to the AVD. We also disabled the auto-rotate screen option.
View 2 Replies
View Related
Aug 30, 2010
I'm getting an error in my Android app that says "source not found" and crashes the program. I've already read a number of posts saying that the solution is to download the android source code and load that up in Eclipse, but I tried to no avail. Here is a bunch of information that may help with my problem, let me know if you need more!
Stack:
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThrea d$ActivityRecord, Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread $ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
Is it weird that the first entry is 'ActivityThrea d' with the 'd' cut off? If this is the problem, what went wrong and how do I fix it? The line of code the debug stops on:
public void AddAnimationID(String index, Integer view)
{ animations.put(index, view);
}
'animations' is a Dictionary and is a member of class Alien. I am calling it like:
Alien alien;
alien.AddAnimationID("idle", R.drawable.idle);
I am correct in thinking that R.drawable.idle is an int right? findViewByID takes an int for the argument. Here is the logcat, I tried to pinpoint where in the log it started the application, sorry if its too much.
I/ActivityManager(59): Displayed activity com.android.launcher/com.android.la
uncher2.Launcher: 21357 ms (total 21357 ms)
I/Launcher.Model(118): not binding apps: no Launcher activity
D/dalvikvm(118): GC_EXPLICIT freed 5222 objects / 297520 bytes in 114ms
D/dalvikvm( 118): GC_EXPLICIT freed 11360 objects / 562112 bytes in 94ms
D/PackageParser(59): Scanning package: /data/app/vmdl45576.tmp
I/PackageParser(59): Game.Main: compat added android.permission.WRITE_EXTERNA
L_STORAGE android.permission.READ_PHONE_STATE
I/PackageManager(59): Removing non-system package:Game.Main
I/ActivityManager(59): Force stopping package Game.Main uid=10032
D/dalvikvm(118): GC_EXTERNAL_ALLOC freed 319 objects / 18064 bytes in 73ms
D/dalvikvm(59): GC_FOR_MALLOC freed 6857 objects / 349752 bytes in 400ms
D/PackageManager(59): Scanning package Game.Main
I/PackageManager(59): Package Game.Main codePath changed from /data/app/Game.
Main-2.apk to /data/app/Game.Main-1.apk; Retaining data and using new
I/PackageManager(59): /data/app/Game.Main-1.apk changed; unpacking
D/installd(34): DexInv: --- BEGIN '/data/app/Game.Main-1.apk' ---
I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=Game.Main/.Main }
D/dalvikvm(258): DexOpt: load 116ms, verify 200ms, opt 2ms
D/installd(34): DexInv: --- END '/data/app/Game.Main-1.apk' (success) ---
W/PackageManager(59): Code path for pkg : Game.Main changing from /data/app/G
ame.Main-2.apk to /data/app/Game.Main-1.apk
W/PackageManager(59): Resource path for pkg : Game.Main changing from /data/a
pp/Game.Main-2.apk to /data/app/Game.Main-1.apk
D/PackageManager(59): Activities: Game.Main.Main
I/ActivityManager(59): Force stopping package Game.Main uid=10032
E/Launcher(118): Unable to launch. tag=ApplicationInfo(title=Alien Game) inten
t=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]flg=0x10200000 cmp=Game.Main/.Main }
E/Launcher(118): android.content.ActivityNotFoundException: Unable to find exp
licit activity class {Game.Main/Game.Main.Main}; have you declared this activity in your AndroidManifest.xml?
E/Launcher(118): at android.app.Instrumentation.checkStartActivityResult(
Instrumentation.java:1404)
E/Launcher(118): at android.app.Instrumentation.execStartActivity(Instrum
entation.java:1378)
E/Launcher(118): at android.app.Activity.startActivityForResult(Activity.
java:2817)
E/Launcher(118): at com.android.launcher2.Launcher.startActivityForResult
(Launcher.java:1053)
E/Launcher(118): at android.app.Activity.startActivity(Activity.java:2923)
E/Launcher(118): at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:1462)
E/Launcher(118): at com.android.launcher2.AllApps2D.onItemClick(AllApps2D
.java:178)
E/Launcher(118): at android.widget.AdapterView.performItemClick(AdapterVi
ew.java:284)
E/Launcher(118): at android.widget.AbsListView$PerformClick.run(AbsListVi
ew.java:1696)
E/Launcher(118): at android.os.Handler.handleCallback(Handler.java:587)
E/Launcher(118): at android.os.Handler.dispatchMessage(Handler.java:92)
E/Launcher(118): at android.os.Looper.loop(Looper.java:123)
E/Launcher(118): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/Launcher(118): at java.lang.reflect.Method.invokeNative(Native Method)
E/Launcher(118): at java.lang.reflect.Method.invoke(Method.java:521)
E/Launcher(118): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/Launcher(118): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/Launcher(118): at dalvik.system.NativeStart.main(Native Method)
I/installd(34): move /data/dalvik-cache/data@app@Game.Main-1.apk@classes.dex
-> /data/dalvik-cache/data@app@Game.Main-1.apk@classes.dex
D/PackageManager(59): New package installed in /data/app/Game.Main-1.apk
I/ActivityManager(59): Force stopping package Game.Main uid=10032
I/ActivityManager(59): Start proc com.svox.pico for broadcast com.svox.pico/.
VoiceDataInstallerReceiver: pid=259 uid=10028 gids={}
D/dalvikvm(157): GC_EXPLICIT freed 4079 objects / 247824 bytes in 605ms
D/dalvikvm(59): GC_EXPLICIT freed 6136 objects / 382312 bytes in 493ms
W/RecognitionManagerService( 59): no available voice recognition services found
I/installd(34): unlink /data/dalvik-cache/data@app@Game.Main-2.apk@classes.dex
D/AndroidRuntime(191): Shutting down VM
D/jdwp(191): adbd disconnected
I/AndroidRuntime(191): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityThread(259): Publishing provider com.svox.pico.providers.SettingsPro
vider: com.svox.pico.providers.SettingsProvider
D/AndroidRuntime(269):
D/AndroidRuntime(269): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime(269): CheckJNI is ON
D/AndroidRuntime(269): --- registering native functions ---
I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=Game.Main/.Main }
I/ActivityManager(59): Start proc Game.Main for activity Game.Main/.Main: pid=273 uid=10032 gids={1015}
I/ARMAssembler(59): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x322b68:0x322c74] in 4370882 ns
W/Game.Main.Main(273): SIS is null
D/AndroidRuntime(273): Shutting down VM
W/dalvikvm(273): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime(273): FATAL EXCEPTION: main
E/AndroidRuntime(273): java.lang.RuntimeException: Unable to start activity ComponentInfo{Game.Main/Game.Main.Main}: java.lang.NullPointerException
E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(Activi
tyThread.java:125)
E/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(273): Caused by: java.lang.NullPointerException
E/AndroidRuntime(273): at Game.Main.Main.onCreate(Main.java:81)
E/AndroidRuntime(273): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime(273): ... 11 more
W/ActivityManager(59): Force finishing activity Game.Main/.Main
I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=Game.Main/.Main }
D/AndroidRuntime(269): Shutting down VM
D/jdwp (269): adbd disconnected
I/AndroidRuntime(269): NOTE: attach of thread 'Binder Thread #3' failed
W/ActivityManager(59): Activity pause timeout for HistoryRecord{43ed84f8 Game.Main/.Main}
I/ARMAssembler(59): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x305640:0x3056fc] in 1148283 ns
W/ActivityManager(59): Launch timeout has expired, giving up wake lock!
Here is the class Alien:
package Game.Main;
import java.util.Dictionary;
import android.graphics.drawable.AnimationDrawable;
import android.widget.ImageView;
public class Alien {
private AlienState state;
private Dictionary<String, Integer> animations;
private ImageView imageView;
public Alien() {
}
public void AddAnimationID(String index, Integer view) {
animations.put(index, view);
}
public Integer GetAnimationID(String index) {
return animations.get(index);
}
public void SetImageView(ImageView view) {
imageView = view;
if(animations.get("idle") != null) {
imageView.setBackgroundResource(R.drawable.idle);
state = AlienState.idle;
} }
public ImageView GetImageView() {
return imageView;
} public void ChangeView(String index) {
if(animations.get(index) != null) {
imageView.setBackgroundResource(animations.get(index));
state = AlienState.valueOf(index);
} } }
Here is the onCreate function that this is called from and related information:
package Game.Main;
import java.util.ArrayList;
import java.util.List;
import Game.Main.MainView.MainThread;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation.AnimationListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class Main extends Activity implements OnClickListener {
private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;
private ArrayList<String> dictionary;
private TextView txtText;
private MainThread thread;
private MainView view;
private AnimationDrawable anim;
private Alien alien;
@Override // called when Main is created.
public void onCreate(Bundle savedInstanceState) {
// reload from previous instance
super.onCreate(savedInstanceState);
// set default content view
setContentView(R.layout.main);
view = (MainView)findViewById(R.id.mainView);
thread = view.GetThread();
if (savedInstanceState == null) {
// we were just launched: set up a new game
thread.SetState(GameState.Active);
Log.w(this.getClass().getName(), "SIS is null");
} else {
// we are being restored: resume a previous game
thread.RestoreState(savedInstanceState);
Log.w(this.getClass().getName(), "SIS is nonnull");
} // setup speak button
Button speakButton = (Button)findViewById(R.id.btn_speak);
// setup text box
txtText = (TextView)findViewById(R.id.txt_text);
// setup our dictionary
dictionary = new ArrayList<String>();
dictionary.add("sit");
dictionary.add("eat");
dictionary.add("jump");
dictionary.add("think");
alien.AddAnimationID("idle", R.drawable.idle);
alien.AddAnimationID("eat", R.drawable.eat);
alien.AddAnimationID("jump", R.drawable.jump);
alien.AddAnimationID("think", R.drawable.think);
alien.AddAnimationID("run", R.drawable.run);
alien.AddAnimationID("sit", R.drawable.sit);
alien.SetImageView((ImageView)findViewById(R.id.alien_image));
// check to see if a recognition activity is present
PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
// if activities were found, cancel speech recognition
if (activities.size() != 0)
speakButton.setOnClickListener(this);
else {
speakButton.setEnabled(false);
speakButton.setText("Recognizer not present");
} }
I am using Eclipse on Windows 7 x64. I have all of the newest updates to the android SDK and I downloaded the android source code and added it to the Eclipse patch because previous posts led me to try that. The code breaks for debug when the first time AddAnimationID is called. Looks like I didn't have enough breakpoints, the culprit is not the AddAnimationID function but actually the SetImageView one. The if statement seems to not work, so I've commented it out for now. I'll post back once I've figured it out. It's probably something silly that works in another language but not Java.
View 1 Replies
View Related
Oct 26, 2010
In my app, I'm creating a notification with the FLAG_ONGOING_EVENT flag set.I'm cancelling the notification in onDestroy, but if my app crashes before calling onDestroy, is there any way to have my notification go away?
View 2 Replies
View Related
Jun 6, 2010
I'm kinda new to android programming so please bear with me. I'm having some problems with retrieving records from the db. Basically, all I want to do is to store latitudes and longitudes which GPS positioning functions outputs and display them in a list using ListActivity on different tab later on. This is how the code for my DBAdapter helper class looks like:
public class DBAdapter
{
public static final String KEY_ROWID = "_id";
public static final String KEY_LATITUDE = "latitude";
public static final String KEY_LONGITUDE = "longitude";
private static final String TAG = "DBAdapter";....................
View 4 Replies
View Related
Oct 13, 2009
I can't seem to grasp why this is happening.
This code:...................
Throws the following exception:
CODE:...........
I'm calling this from the onCreate method.
View 8 Replies
View Related