Android :: Number Preferences In Activity - Game Of Life Program

Jul 8, 2010

What I want to do is I am working on a game of life program. I want to take the time delay and make it a preference, but I want to make it available for people to type in a specific time. The number can be in miliseconds or seconds. However I'm a little stuck on how to proceed, I haven't been able to find a simple preference that already handles this, but there might be one. Is there an easy way to make this preference and confirm that the entered data is an integer or afloat?

Android :: Number Preferences in Activity - Game of Life Program


Android :: Dynamic Preferences For A Variable Number Of Profiles In App

Aug 22, 2010

I am looking for a way to create dynamic preferences where I don't need to hard code the preference key and I could have a variable number of preferences. Basically, my application will let the user create a multiple number of profiles and each of these profiles will save custom values for a fixed number of preferences. So this way, the user does not have to change the preferences every time he wants this app to run differently, he can just switch the profile. One way I think will work is by subclassing all the standard Preference classes and calling their setKey method with my custom preference key, containing the profile name, but this is ugly. So is there a cleaner and more standards compliant way to do this?

View 2 Replies View Related

Android :: Way To Create Dynamic Preferences For A Variable Number Of Profiles In App

Aug 22, 2010

I am looking for a way to create dynamic preferences where I don't need to hard code the preference key and I could have a variable number of preferences. Basically, my application will let the user create a multiple number of profiles and each of these profiles will save custom values for a fixed number of preferences. So this way, the user does not have to change the preferences every time he wants this app to run differently, he can just switch the profile. One way I think will work is by subclassing all the standard Preference classes and calling their setKey method with my custom preference key, containing the profile name, but this is ugly. So is there a cleaner and more standards compliant way to do this?

View 1 Replies View Related

Android :: How Preferences Activity Works

Jan 19, 2009

I'm having a hard time trying to understand how the preferences activity works. Right now I have an activity for my preferences using a XML layout that has this:

CODE:............

The thing is that everything I do in the preferences are saved. I can reboot the emulator and I can access the preferences. I want to know how can I access this key from another activity on my application.

This is my activity:

CODE:.................

View 4 Replies View Related

Android :: Preference Activity / Multiple Preferences

Nov 4, 2010

Is it possible to use the PreferenceActivity and PreferenceScreen to manage multiple instances of preferences fro a single app? It seems that they store preferences as "default" preferences only. I would like to use a PreferenceScreen as my configure activity for an AppWidget, but I need to be able to store distinct preferences for each widget.

View 2 Replies View Related

Android :: Initialize Preferences From XML In Main Activity

May 20, 2010

My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. Code...

View 3 Replies View Related

Android :: Accessing Shared Preferences From Different Activity

Oct 19, 2010

When you establish a shared preference such as below.

public static final String PREFS_HI = "MyPrefsFile";

Can you access it from other activities just like you would normally do?

SharedPreferences settings = getSharedPreferences(PREFS_HI, 0);

Or is there something unique that you must do to access the preferences?

View 3 Replies View Related

General :: Program Windows Game To Android?

Jun 28, 2013

I have created an simple game on Windows (7). The game is great but I think it will be better on a smartphone / tablet.

Now my question. Is it possible to port my game from Windows to Android or do I have to program it from scratch new? It would be also ok if I can use parts of my code on Android. I have a basic knowledge on android-programing.

View 1 Replies View Related

Android :: Need Antivirus Program After Downloading Chess Game?

Oct 9, 2010

I had a message pop up saying I needed a spyware, malwRe, antivirus program. Any ideas about this? This only happened after I downloaded a chess game off the market

View 3 Replies View Related

Android :: Possible To Start Surface View With Game Thread Anytime / Other Than At Startup Of Program?

Aug 7, 2010

I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way.I've used a couple Activities and xml documents to create a menu that loads when my game starts. When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties.I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu, I get a nullPointerException and it force closes.I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView. I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here.If you need the code snippets I can paste some here, but it's not really the specific code that's wrong, I think it's the way I'm using(abusing) the language.

View 1 Replies View Related

Android :: Preferences - How To Load The Default Values When User Hasnt Used Preferences-screen

Apr 22, 2010

I am using a PreferenceActivity to let the user set some values. I am feeding it the xml file with the defined preferences.

I have set all the android:defaultValue="" for them.

When I start my application, I need the preferences, or if they are not set yet manually, I want the default values:

CODE:.................

However, when android:defaultValue="true" I still get false. So, it looks like the defaultValues set in the XML are not used anywhere but when initializing the preferences-screen.

I don't want to hardcode the default values in the getBoolean() method. So, is there a way get the default-values with only defining these in 1 place?

View 2 Replies View Related

Games :: Make Textures With Program Like 3ds Max / Plain Jpg's For Game?

Jun 25, 2009

I want to make a game with opengl es, but i don't know how is the best way to make the textures, with a program like 3ds max? or with a plain jpg's?

View 13 Replies View Related

Android :: Use Program To Detect Tones / Phone Automatically Calls Number That It Dialed

May 5, 2009

In the source of Android I found programs written in language C ("dsp_core.c" and "dsp_dtmf.c") which are capable of decode DTMF. I've recorded (amr file) with my phone a conversation in which the one I'm calling dials DTMF tones from his cell and I would like to use the program to detect those tones and that my phone automatically calls the number that he dialed. My problem is I don't know how to use those two programs with the amr file I've recorded. If you need the programs because you haven't downloaded Android code source tell me and I'll send you them

View 4 Replies View Related

Android : Save Preferences Other Than Shared Preferences?

Mar 19, 2010

My application is used on multiple platforms so it saves it preferences to a file (rather than to the standard Android SharedPreferences).

Is there any easy of reusing the PreferenceActivity to save preferences to a file or is it a case of creating a whole new activity to do the job? If the latter is the case is there a layout I can use that will make the activity look like the normal preferences screen? PreferenceActivity uses com.android.internal.R.layout.preference_list_content but this doesn't appear to be available to apps for reuse.

View 2 Replies View Related

Android :: Get Shared Preferences From A Preference Activity In Android?

Apr 10, 2010

I am using a PreferenceActivity to show some settings for my application.I am inflating the settings via a xml file so that my onCreate (and complete class methods).These preferences will automatically save to SharedPreferences as the user interacts with them. To retrieve an instance of SharedPreferences that the preference hierarchy in this activity will use, call getDefaultSharedPreferences(android.content.Context) with a context in the same package as this activity.

View 4 Replies View Related

Android :: Program Will Not Switch To Activity On My Phone

Oct 27, 2010

public class TestCamera extends Activity implements SurfaceHolder.Callback, View.OnClickListener {
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
// TODO Auto-generated method stub
picture = data } };
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER)) {
mCamera.takePicture(null, null, mPictureCallback);
return true; }
return super.onKeyDown(keyCode, event); }
@Override
public void onClick(View view) {
switch(view.getId()) {
case R.id.camera:
picture_intent = new Intent(this, PictureViewer.class);
picture_intent.putExtra("picture", picture);
mCamera.startPreview();
startActivity(picture_intent); } }

In the emulator, the program behaves like it should. However, when I put this application on my phone (Nexus one), it doesn't switch to the new Activity when I touch the screen after I take a picture. If I touch the screen without taking a picture, it switches to the new activity. I can't figure out why my phone won't switch to the new Activity after taking a picture.

View 2 Replies View Related

Android : Program On Application - Not Activity - Exit

Jul 22, 2009

I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list and finally when user is not using the app (means if user exits app by pressing "home" button or "call" button), just before exiting that app, i want to save that data of the list to a file.

coding before exiting activity screen is simple - by calling onDestory () method, but here I want not one activity but the application exit.

So my question is How do I write a code that will be executed just before application exits ? I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device)

View 2 Replies View Related

Android :: Activity Life Cycle

Nov 12, 2009

The main activity is running, then there is a interrupt. What was happended, onPause(), onStop() or other change of life cycle? 1. pressed the volume_down key and ringer volume toast occured, the life of main activity will not change? why? 2. short press the power key and the OS sleep,how about the activity ? 3. long press the power key and the phone options appear, how? 4. long press the home key and the tast list appear, how? 5. notifications curtain appear, how? 6. press the back key,how?

View 5 Replies View Related

Android :: Any Way To Call Start Main Activity From Java Program?

Dec 12, 2009

I have a normal Java application, normally, we start an Android application from a Main Activity, now I must start it from my application.

View 8 Replies View Related

Android :: Simple Program - Class Extends Activity At Startup

Oct 1, 2010

I have a simple activity program in android. Basically the class just extends Activity.
But when I start it I get a ClassCastException in the constructor of my class. I don't even have a constructor defined, so it must be in the constructor of the superclass which is Activity. Unfortunately the debugger doesn't give any detailed information on what class it is trying to cast. Here is the stacktrace:

Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread$PackageInfo.makeApplication(boolean, Instrumentation) line: 649
ActivityThread.handleBindApplication(ActivityThread$AppBindData) line: 4232
ActivityThread.access$3000(ActivityThread, ActivityThread$AppBindData) line: 125
ActivityThread$H.handleMessage(Message) line: 2071
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]

And when I look into this runtimeexception I get:

detailMessage "Unable to instantiate application com.test.MyApp: java.lang.ClassCastException: com.test.MyApp" (id=830067694464)
The only code is:
package com.test;
import android.app.Activity;
public class MyApp extends Activity {
}

View 3 Replies View Related

Android :: Can't Grok Activity Life Cycle

Jun 6, 2010

I am having a really hard time grokking the Activity life cycle concept. The main issue is with onStop() and onDestory() not being guaranteed to be called before the process is killed. I though I had it figured out when I saw that the system calls onSaveInstanceState() when it's shutting down the activity to claim some memory. Thing is that the docs says onSaveInstanceState() will be called before onPause() but how does the system know at this point whether the activity will be killed by the system or the user?

Here is a use case:

1) My activity starts up and is running. 2) At some point I want to show a web page so I use an Intent to start an activity. 3) The web browser covers my app/activity so I would expect onPause() to be called followed by onStop(). At this point it's my understanding that all bets are off and I can be killed at any point without be called. 4) Since the system has enough memory onSaveInstance() doesn't get called. 5) The user presses home and decides to open some app which requires a lot of memory. 6) System wants more memory and decides to kill my app but I am already stopped (onPause() has been called).

View 1 Replies View Related

Android :: Show Dialog When Activity Running And Game Over?

Nov 1, 2009

I want to show a dialog to ask player "play again ?" when the game is over.I find the code can only add in a activity for dialog is a part of activity,But I should show the dialog when the game is over,in other words ,I should know the time game is over.how can I do this?

View 2 Replies View Related

Android :: Using Intent To Call Activity From Another Program Results In Permission Denied

Oct 16, 2010

In my very simple app (based on the default Hello World app but with a button added) I try to open one of my phone's (a SE X10 Mini) preinstalled activities, like this:

Intent calendarIntent = new Intent();
calendarIntent.setClassName("com.sonyericsson.calendar","com.sonyericsson.calendar.dayview.DayActivity");
startActivity(calendarIntent);

However, it does not work, I get the following error in the log:

E/AndroidRuntime( 2215): java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.sonyericsson.calendar/.dayview.DayActivity } from ProcessRecord{302cf238 2215:com.klibb.quickappointment/10079} (pid=2215, uid=10079) requires null
E/AndroidRuntime( 2215): at android.os.Parcel.readException(Parcel.java:1246)
E/AndroidRuntime( 2215): at android.os.Parcel.readException(Parcel.java:1234)
E/AndroidRuntime( 2215): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1157)
E/AndroidRuntime( 2215): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1449)
E/AndroidRuntime( 2215): at android.app.Activity.startActivityForResult(Activity.java:2661)
E/AndroidRuntime( 2215): at android.app.Activity.startActivity(Activity.java:2705)
E/AndroidRuntime( 2215): at com.klibb.quickappointment.QuickAppointmentActivity$1.onClick(QuickAppointmentActivity.java:25)

Is there anything I can do about this or is this type of code a no-no? When searching the web I see people changing the intent filters in what I assume is their own app, but I obviously cannot change anything in a preinstalled app.

View 1 Replies View Related

Android :: Pausing Main Game Thread Until Activity Started

Aug 13, 2010

In my game when the user completes a stage, I want the main game thread to pause/sleep/wait and a new activity to be launched called StageClear that displays information about points scored etc. After this has been displayed and the user has pressed continue I want the original game thread to resume where it left off. I have tried to implement this but have so far been unsuccessful, probably because I'm new to dealing with multiple threads and also the idea of synchronizing them. I most recently tried to implement a shared package-visible object that could notify after wait was called on itself, but I am getting errors in eclipse so it won't even compile, I think because though the object is declared public in an inner class, it cannot be seen or recognised by my activity elsewhere in a file in the package. I have already built both activities but my issue is getting the main game one to launch the other, and pause whilst it waits for this activity to finish, before the main game thread continues execution.

View 1 Replies View Related

Android :: Activity Life Cycle - Serialization Taking Too Long

Jul 27, 2009

Finally after many days of getting StackOverflowError, I've tracked down the issue and fixed it, only to find that my game's serialization takes about 5 -10 seconds on the emulator and most likely around that in the target. So far my the lifecycle of my game is as follows

onCreate - check if serialization file exists, if it does, de- serializes it. (~ 5-10 seconds) onPause - if the game is not complete, then serialize it (~ 5-10 seconds) I remember reading somewhere that another activity's onResume will NOT get called UNTIL the previous activity's onPause has ended. So I am worried that my game is delaying another activity that wants to start from doing so i.e like a phone call etc. I think speeding up the serialization is not going to be feasible, so any ideas on what I can do? Can I serialize in the onDestroy instead of the onPause? I read that the onPause is the only safest place to store the state.

View 8 Replies View Related

Android :: Handle Activity Life Cycle Involving Sockets?

May 30, 2010

I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature.

Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job

View 1 Replies View Related

Android :: Getting Phone Number From Default SMS Activity

Jul 14, 2010

I have started the default SMS application and specified the SMS text to be sent through following code- intent = new Intent(Intent.ACTION_VIEW, Uri.parse("sms:")); intent.putExtra("sms_body", "SMS Text"); startActivity(intent);It worked fine and sends the message to selected number from contact list.My requirement is that i want to know the number to which my SMS was sent?

View 6 Replies View Related

Android :: Out Of Memory Error On Large Bitmaps And Activity Life Cycle

Jul 24, 2010

I have a scrollable map app which for now has a huge bitmap. It loads fine on startup, but when it looses foreground status and the user brings it backs again im getting an out of memory error. In onPause it trashes the bitmap using recycle, and marks it as null. The onResume checks to see if map==null and will load the bitmap back again, which is crashing the program despite me recycling the bitmap...Here are some bits of code. All of the other references to Bitmap map first check if it is null before loading/drawing..............

View 1 Replies View Related

Android :: How To Limit Number Of Same Activity On Stack For Droid App?

May 10, 2010

Is this possible in an Android app? I want to make it so that no matter how many times a user starts activityA, when they hit the back button they will never get more than one occurence of activityA. What I am finding in my current code is that I have only two options 1. I can call finish() in activityA which will prevent it from being accessible via the back button completely, or 2. I do not call finish(), and then if the user starts activityA (n) times during their usage, there will be (n) instances when hitting the back button. Again, I want to have activityA accessible by hitting the back button, but there is no reason to keep multiple instances of the same activity on the stack. Is there a way to limit the number of instances of an activity in the queue to only 1?

View 2 Replies View Related

Android :: User Preferences File Vs App Preferences File

Jun 23, 2010

My android application has two kinds of preferences:

1) I have user preferences defined in res/xml/preferences.xml so that users can manage their preferences with a PreferenceActivity.

2) I'd like to define another file for global configuration preferences of my app.

What is the best way to manage my app config preferences? Should I create another XML file with config values or should I specify those config values in strings.xml? What is the best practice for managing config preferences?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved