Calling Class - Getting Error And Program Stop Working?
Oct 12, 2011
am trying to call a class from the main and am getting an error and the program is stop working. am trying to call from the main.class the test.class
on the main i have write the following code
Intent connectIntent2 = new Intent(Conn.this, Test.class);
startActivity(connectIntent2);
and on the test.java i have write[code]....
the R.id.button_scan is been define in the main.xml and i just want to make it invisible.
View 1 Replies
Jul 2, 2010
I am trying to call my service class's stopService() method from my activity. But I don't know how to access stopservice method from my activity class. I have the below code but its not working. This is HomeScreen class:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
enablecheck = (CheckBox)findViewById(R.id.enablecheck);
enablecheck.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(enablecheck.isChecked()){
startService(new Intent(HomeScreen.this, AutoService.class));
} else {
stopService(new Intent(HomeScreen.this, AutoService.class));
} } });
}
This is Service Class:
public class AutoService extends Service {
private static final String TAG = "AutoService";
private Timer timer;
private TimerTask task;
@Override
public IBinder onBind(Intent intent) {
return null;
} @Override
public void onCreate() {
Toast.makeText(this, "Auto Service Created", Toast.LENGTH_LONG).show();
Log.d(TAG, "onCreate");
int delay = 5000; // delay for 5 sec.
int period = 5000; // repeat every sec.
timer = new Timer();
timer.scheduleAtFixedRate(task = new TimerTask(){
public void run() {
System.out.println("done");
} }, delay, period);
}
@Override
public boolean stopService(Intent name) {
// TODO Auto-generated method stub
timer.cancel();
task.cancel();
return super.stopService(name);
} }
View 3 Replies
View Related
Apr 20, 2010
I have a SMSReceiver class that needs to pass the phone number and message to another class. Which works but when I call that class I need the function to read preference to compare if it needs to execute another function.
View 2 Replies
View Related
Nov 19, 2009
I keep getting the following message.
Sorry The process com. Android phone has stopped unexpectedly please try again. Force close.
This seems to stop the HTC Internet widget from working. I keep replacing it but it still happens.
View 8 Replies
View Related
Aug 21, 2010
Okay -- so I finally mustered up the courage to root and try a lag fix. I rooted using the unleash the beast files. And then tried the lag fix over at XDA found here: xda-developers - View Single Post - [UTIL] One Click Lag Fix 2.0
I ran the lagfix_ext2, like the forum says -- it took about 10 minutes to do some things ...There was an error message in the middle saying that it had to stop the process. I said okay, but the process kept working, finished, and then rebooted. It booted up, and I downloaded quadrant again (it was gone for some reason), ran it, and only ran an 895 -- this is 16 points less than what i ran just using the unleash the beast. Should I try the lag fix again?
View 1 Replies
View Related
Nov 17, 2010
How can I detect whether or not an Image View has a picture in it upon a button click. I had a class that displays a picture and some results, but I don't want the user to be able to access those results (pushing the button) until the results have been written to that class.
So, I figured I needed to check to see if there was a picture displayed in the ImageView yet.
So something like:
CODE:...............
But obviouslt R.id.photoResultView == null isn't the right way to do it...anyone know how?
EDIT: Line 184
CODE:........
EDIT:
CODE:.......................
View 2 Replies
View Related
Feb 27, 2010
I have two classes, one MainClass and one DataBaseHelper class, which extends SQLiteOpenHelper.
From my MainClass I call a method in the DataBaseHelper class to open a data base. Before opening the data base I want to check the users data base version (this is important as soon as I want to update the data base and push it to the Android market). So from the DataBaseHelper class I call the following method, which is in the MainClass.
CODE:..........
I call the checkCurrentDbVersion() method from the DataBaseHelper class like so:
CODE:.....................
As soon as the debugger runs the following line, it stops.
CODE:...........
I have no constructor defined. Could that be the failure?
View 2 Replies
View Related
Jun 29, 2010
I am calling intents alot in my program and I thought that I could write a public class that would have all of my intents so I can just call something like intents.testIntent(params) and then have it fire off the intent.
I tried it out but am getting a force close with a null pointer exception. This is my whole class. I know it is probably sloppy but I have just been learning java for 2 months so I still am an amateur. Any way, my code...
View 1 Replies
View Related
Mar 12, 2010
So I want to create an Android app so it would be registered somewhere in android OS (or just would start on system start) and when phone user clicks on special button on a web page inside a web browser my app would pop up and run using the params sent in that URL.So how do I do such thing?
View 2 Replies
View Related
Feb 1, 2010
Everytime i go to send a message it says sms error cause code 34 error class 2. i did a hard reset and it is still happening?
View 3 Replies
View Related
Oct 27, 2010
A local college has decided it wants to start a program in mobile development. They explored Windows 7 mobile and iPhone and it just isn't what they are looking for. Android won the golden ticket, thanks to myself.
They just threw a catch in there for me =). They want me to find the blount of the information!
Would anyone happen to know who I can contact concerning some sort of contract on leasing of development phones for this class? The phones do not necessarily need a service, just a way to test development. The instructors and department leaders have said they would need around 20 devices for a small class. They don't imagine it would be larger than that for a new class.
So can someone point me in the right direction? I know everyone wants to breed more Android developers =P...something to feed our addictions.
View 3 Replies
View Related
Aug 22, 2010
I see calling the stop function of MediaPlayer simply does nothing. The playback goes on.
I looked in the documentation and I found: "Stops playback after playback has been stopped or paused."
So, I tried to pause() it before stopping, but the MediaPlayer then pauses and resumes the playback. The only thing I can see is that the buffering stops. But the playback continues. Is this the expected behavior? Could the problem be related to the fact that I call the methods of the MediaPlayer object from different threads than the creator by synchronizing with Semaphores?
View 6 Replies
View Related
Aug 8, 2010
So ya, there's a phone in my HTC Hero. No surprise.
My problem is this:
I find that the easiest way to call a person is to go to the phone app and scroll through the call history displayed to find the person I wish to call. Once I see their name, I just press on it, and the call begins. Unfortunately, a friend I call often may use their house phone or cell phone when I only ever want to call their cell (Evo ). Often, the situation is that I previously talked to him on his house phone, and I'm calling him in the middle of the night (we're young; we don't sleep rational hours during the summer... or ever). Unfortunately for me, my call usually bugs his parents, and I get reprimanded...
Is there a setting that allows me to only call his cell, or do I just need to break this habit?
View 9 Replies
View Related
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
Oct 26, 2010
I am new at android development and java programming, but I have decided to program a drinking game app in android. This app basically simulates a deck a cards, a player clicks a button to draw a card then based on the card thats drawn the player plays a drinking game (ie takes 1 drink, takes 2 drinks ect).
I have the main program in one java file, and the code that shuffles the card deck and puts the card sequence in an array in other java file. My problem is that whenever a class from the other java file (classicMode.java) is called from the main program (fubar.java), my android program crashes and gives the error : "The application Drinking Game - FUBAR (process com.games.dg) has stopped unexpectedly. Please try again". Code...
View 1 Replies
View Related
Aug 7, 2010
Please stop calling Captivate as Cappy! I get anger sharks swimming in my head...
View 11 Replies
View Related
Nov 28, 2010
The screen of xperia mini pro is quickly turn off when calling and i have to spend 5 second before touching the screen again to hang up.
View 2 Replies
View Related
Jul 17, 2012
I developed a widget that is a shortcut to the preferences of the android, on my phone it works ok, but I am monitoring it using Crittercism (a capture crash tool) and he is accusing the following error:
Unable to start receiver br.com.fabiosistemas.shortcut2g3g.AppWidget:
java.lang.SecurityException: Permission Denial: starting Intent {
act=android.settings.DATA_ROAMING_SETTINGS flg=0x10000000
[code]....
View 3 Replies
View Related
Apr 4, 2010
me and my partners are working on developing a pwa client for android Am getting an error while calling an activity from another activity.the error is as follows...
View 3 Replies
View Related
Jul 28, 2012
I'm writing a piece of code that has a error every time I run it stating:
-No internet calling account availible
I'm wondering if there is some kind of permissions involved in this or something else I am missing.
View 2 Replies
View Related
Sep 11, 2010
I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code:
CODE:................
I'm calling this code from an activity, so I don't know how I could be getting the following error...
CODE:....................
Is this really what you want?
View 1 Replies
View Related
Aug 18, 2010
Code...
When the method is called setRequestedOrientation() - error. Create layout-land and placed there a copy of the main.xml file.
View 2 Replies
View Related
Mar 5, 2010
I want to use GPS service for better accuracy in my program, but want the location only once in every couple of hours. To get GPS location the GPS had to be started already manually through Settings->Location Security->Use GPS Satellites. But the problem is GPS continuously running whether I need the location or not and drains the battery quickly. My question is what is the equivalent API for the checkbox selection of,
View 2 Replies
View Related
Feb 14, 2010
When I get a text message, I get a notification from Handcent and the stock message program. Is there a way to stop the stock program from notifying me?
View 3 Replies
View Related
Mar 25, 2009
I have created a threaded service the following way. code...
After I close the application the phone works really slow and I guess it is due to thread termination failure.
Does anyone know what is the best way to terminate all threads before terminating the application?
View 3 Replies
View Related
Mar 5, 2010
Absolutely love Handcet. But now I got both apps receiving texts. Can I shut down the stock one that came on my phone?
View 6 Replies
View Related
Jul 6, 2010
When I try to make a call, I select a number and it displays "Dialing", then I wait few seconds and it displays "Call ended" and ends the call.No dialing tone or anything.It does it a lot.And people cannot get hold of me as well. Therefore I miss a lot of calls.I tried switching my SIM card to another phone and its better.Anything I can do? SO annoying, damn expensive phone and cannot use it properly.I am on Three network, UK.
View 13 Replies
View Related
Nov 12, 2010
I'm unable to find information about this and unable to find a fix. Every sms my wife or I send gets this error.
View 2 Replies
View Related
Sep 17, 2010
I'm new to Android development and I've been having an issue that I haven't been able to fix. I'm mostly using code from examples provided in the SDK so I'm not sure what's happening here. I'm simply trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here's my class definition file GhostSurfaceCameraView.java:
CODE:............
And this is in my ghostviewscreen.xml:
CODE:............
Now in the activity I made:
CODE:........
When setContentView gets called, an exception is thrown:
CODE:.................
Why I get this error?
View 1 Replies
View Related
Feb 25, 2010
When I try to edit project/res/main.xml using android layout editor in eclipse I get the error "Could not initialize class java.awt.font".
View 3 Replies
View Related