Android :: Application Crashes While Doing AlertDialog.Builder Create() Method - Android
Aug 18, 2010
I am testing my application on an LG Eve phone. I have an application that tries to download something from the web, and when it throws an exception, it is supposed to launch an alertdialog saying that there was an error. When the phone has no wifi signal, the program crashes at builder.create() (see code below). However, when there is wifi signal, and the exception is thrown by something else (for instance, a typo in the url), the dialog launches the way it's supposed to. Any clue as to why this could be?
Code for onCreateDialog:
@Override
protected Dialog onCreateDialog(int id){
Dialog d = null;
switch (id){...............
View 1 Replies
Mar 12, 2010
I am trying to figure out what is the best way to go about creating dialogs. I can either create my own Dialog class (which, to me, is more clean and organized), or I can use AlertDialog.Builder (which would be done inline, and funky looking)... What are the positivies and negatives of either implementation?
View 1 Replies
View Related
Jun 17, 2010
Can someone explain to me why this AlertDialog crashes? code...
View 1 Replies
View Related
Jun 5, 2009
How do I have to change my AlertDialogBuilder to center the Items? code...
View 2 Replies
View Related
Sep 3, 2010
I am thinking to create a static method to return a reference to the application instance. I am not sure if it is safe to assume there is only one instance of the Application in one application. Apparently, the Application class in Android SDK doesn't provide such method to return the instance reference. So I suspect there must be a reason?
View 1 Replies
View Related
Jun 7, 2010
In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class.
In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on.
The below code is the onTap method I've written. It functions as written but doesn't yet do what I'd hope. I'd like to capture and persist each selection made by the user to be used later. How do I do that? Is using an AlertDialog in this manner a good idea? Are there better options?
CODE:.......................
View 2 Replies
View Related
Nov 8, 2010
When tried to build a AIR application for android using flex builder I did the following steps to do that .plz tell me where the error happened
1.Created Air application using flex builder that produced two type of files .swf and .xml files and cetification file
2.Created apk file from the above files using "Package assisstant pro"
3.then i installed AIR 2.5 run time in my emulator
4.after that i tried to install the apk file that Created from the 'package assisstant pro' then i tried to install the apk file by using command prompt then it show this error
"INSTATTION FAILED INVALLID APK" .And also i cann't install other apk file (Sample air for android application apk file that downloaded from the site) that shows the same error
I succeed to install other application's(Say for printing hello world) apk file
Enter code here.
CODE:................
xml file
CODE:.................
View 1 Replies
View Related
Aug 20, 2010
My Android app runs fine, but: If I insert a call to WebView.setScrollbarFadingEnabled, it crashes saying:
Could not find method android.webkit.WebView.setScrollbarFadingEnabled, referenced from [my class]
VFY: unable to resolve virtual method 289: Landroid/webkit/WebView;.setScrollbarFadingEnabled (Z)V
I am using Android 1.5, not a custom ROM. My app defines minSdkVersion="3" I always clean before compiling.
Is setScrollbarFadingEnabled unavailable in Android 1.5? If so, why don't I receive a compiler error?
View 1 Replies
View Related
Sep 10, 2010
I'm trying to create a basic AlertDialog using an activity with a theme of Theme.Dialog.What I want is for there to be a horizontal bar between the title and the message. However, the bar is not being resized correctly. Rather than being the width of the activity, the bar is the width of the message text. This means that if the activity is being expanded by the message, then the bar will fill the whole activity, so it looks correct. However, if the message width is less than the activity width, the bar only displays above the part of the activity with the text. I've tried every single combination of "fill_parent" and "wrap_content" that I can think of, and none of those work.I've also tried using RelativeLayout and placing the bar above the message text, but that also doesn't work. If I use the RelativeLayout approach and set the bar to fill_parent, it causes the activity to expand to fill the whole screen width, which is also undesirable. Ideally, I want the text placed, the activity width computed, and the bar resized to that width (without affecting it). Is there some way to flag a view to fill the parent view but not to affect its size?
View 1 Replies
View Related
Aug 31, 2010
I want to call a method every X minutes, if my method got a result it ´should inform the user by vibrating or showing a alertbox. if the method doesn't get a result it should wait for X minutes and restart. What is important, this should also work when the phone turns to sleep. Which means I want to wake the phone from sleep to run my method. Actualy I can activate my method via a Button, and it is working like I want it to be except the background loop thing.
I already searching for a solution here in the group or also on google but I think I don't got the right search terms to find a solution for my problme. I already read about the AlarmManager and broadcast receiver but I'm not sure if this is right for my problem.
View 6 Replies
View Related
Sep 1, 2010
is it possible to start a context menu on the onCreate method? I know its probably bad design ethics but I have my resons! I've tried the: register For Context Menu (this.getCurrentFocus()); But its not working.. So does anyone have any better ideas?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
//Button button = new Button(this);
//button.setLayoutParams(new
//LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
//button.setText("my button");
TextView text = new TextView(this);
text.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
layout.addView(text);
setContentView(layout);
registerForContextMenu(text);
openContextMenu(layout);
View 1 Replies
View Related
Sep 6, 2010
I want to create a method to open a popup when i click on it and the title and the text would be automatic, something like this :
CODE:...........
But test is a String and set Message doesn't accept Strings, and it would come from a resource XML, like Strings.xml. So i don't know ho to do this. And the 'getTitle()' i don't think it could work. My method to take the title is this one.
CODE:...........................
View 2 Replies
View Related
Apr 30, 2010
I noticed a lot of Android functions have a parameter that you can pass in that's a bitmask, for different options, like on PendingIntent, you can pass in things like you can call getActivity() with PendingIntent.FLAG_CANCEL_CURRENT|PendingIntent.FLAG_NO_CREATE.
I'm wondering how I can create a function that has a parameter like this?
View 2 Replies
View Related
Oct 16, 2009
my app is working perfectly and playing its music in the 1.5 and 1.6 emulators, my ADP1, and for everyone in the Android Market (at least there were no complaints). The problem is that when the app is run on the ARCHOS 5 tabled, the MediaPlayer.create(Context context, int resid) method returns null. I guess there might be a problem with the ARCHOS' Android implementation, but did anyone experience the same problem? What might be a possible reason for the create method to return false? The docs don't say anything. I'm also using SoundPool in parallel with MediaPlayer if that's relevant.
View 2 Replies
View Related
Jun 13, 2010
I am completely new to java & android ,so I try to found useful sample about android & databases . So I found this blog with project I run project and he works fine, but I was trying to create new project and to copy & past code in it and this is not working :( I had problem on this line: " this.setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1,results)); Error: "The method setListAdapter(ArrayAdapter) is undefined for the type create" It's look like method in C# but I can found it in original project.
View 1 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
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
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
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
Sep 3, 2010
I have placed an icon on the status bar. I would like to run a method of another class whenever the user selects that icon. I've seen similar functionality used in volume icons that sit on the status bar that allow a user to raise or lower the volume when the icon is clicked. However, these icons are on the right side of the status bar, and from what I've seen, I'm not allowed to put an icon there. I don't know if that kind of functionality is available to left side icons. So basically, I'm looking for how to run a function when a status bar icon is clicked. I don't want to open an activity, I just want to run a function.
View 1 Replies
View Related
Nov 24, 2010
So I started with this little write-up. I wanted to try to make an application that will take pictures while running in the background. To start though I wanted an application that once opened would simply take a picture every X seconds. After recreating the classes and methods show in the walk through below I ran into a few problems.
http://itp.nyu.edu/~sve204/mobilemedia_spring10/androidCamera101.pdf
For starters its seems that the onCreate function sets up all the objects for the application, but if you try to take a picture through any other method than onClick (IE directly calling it) the application actually hasn't setup the canvas or the preview yet.
My first question:
Is there any conditional method that you can setup that will wait till all the "onCreate" objects are created and their associated methods are called and finished? How do I wait for the application to finish putting together my surface and starting the cameras preview before automatically starting to take pictures?
My second question:
I am required to have a preview available to take pictures. Is there anyway to push this application to the back (IE running in the background) while still taking pictures? Is drawing to a canvas a requirement? (From what I can tell AFAIK, you are required to have a surfaceholder to start preview, when you put up another screen or application that pauses the current application and closes the surface/canvas you were presenting that preview on). If my understanding is correct on all of this the best I will be able to do is make a 1x1 pixel canvas that will still take up the screen due to the application being in the foreground.
My Third question:
Is there any way around this? Can you still utilize the camera in some fashion without requiring the preview be drawn?
View 1 Replies
View Related
May 21, 2010
My app is using the camera on the phone. For phones w/ 2.0+ I have been able to activate the Flash. When I test on a phone with 1.5 OS on it the app crashes. I get: java.lang.reflect.InvocationTargetException and the Cause is java.lang.VerifyError: fishers.Nav.TakePicture$1
I assume because you have to access the flash differently in apps below 2.0? Can anyone give me some advice or links to examples showing how I could make it work over the whole range of Operating System version or is that just not at all do-able?
View 5 Replies
View Related
Nov 11, 2010
I have a small mp3 (326KB) in my res/raw folder. In my code, I have mPlayer = MediaPlayer.create(FakeCallScreen.this, R.raw.sample); Player.prepare(); mPlayer.start(); The application just crashes when it tries to start the activity, I cannot figure out why.
View 2 Replies
View Related
Sep 20, 2010
I have registered a Receiver component for ON_BOOT_COMPLETED broadcast, in my application. The receiver does just prints a line in its onReceive() callback. However, when I boot the emulator(by executing Run as->Android application command from Eclipse) and unlock the screen on start up, I get an ANR dialog displayed in my Application. Following are the exceptions logged:
CODE:.............................
View 4 Replies
View Related
Jan 18, 2010
I am very new to android programming. i was following a guide in here, to create an application that shows the current location, i did as was told in the guide, but whenever i try to run it, it crashes, and asks for "force Close",
does somebody know what i am doing wrong? here is the code....
View 2 Replies
View Related
Jun 14, 2010
Shown are a few lines of code. If I play a single sound, it runs fine. Adding a second sound causes it to crash.
private SoundManager mSoundManager;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.sos);
mSoundManager = new SoundManager(); mSoundManager.initSounds(getBaseContext());
mSoundManager.addSound(1,R.raw.dit); mSoundManager.addSound(1,R.raw.dah);
Button SoundButton = (Button)findViewById(R.id.SoundButton);
SoundButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) { mSoundManager.playSound(1);
mSoundManager.playSound(2); } } ); }
View 1 Replies
View Related
Jan 25, 2010
I have a G1 Android that's been rooted. My problem is that Market and Gmail crashes on launch. I also cannot get to the Data Synchronization page. It displays the page for a split second and then instantly closes out. Is there a way to reset the apps? I've tried factory reset and upgrading to a newer version of Cyanogen mod without success.
View 1 Replies
View Related
Oct 19, 2010
I am writing an android application that check the username and the password of the user once a login button is clicked
i run the app in the emulator and when i click on login button the application is crashed code...
View 1 Replies
View Related
Jan 15, 2010
I am having search application, which loads data retreived from the webservice.While application on create it shows progress dialog once its done with loading data it dismiss the progress dialog.problem is while loading if i change the orientation of the phone it works fine it try to load activity again, but if i start shaking the cellphone while it is loading data application get crashed, any solution?
View 1 Replies
View Related