Android :: When Do Synchronize Methods Or Use Synchronized Blocks In Methods In Android Game

Mar 14, 2010

I'm looking into writing simple graphics code in Android and I've noticed some synchronized() blocks. What is the reasoning behind this and how do I know when I should be "synchronizing" my code?

Android :: When do synchronize methods or use synchronized blocks in methods in Android game


Android :: HTTP Get Methods?

May 14, 2010

I have written a number of applications for blackberry and am just starting in Android. It seems to me that android has a lot more built in functions. I am starting by recreating some of my BB apps on Android and on one I take a few xml sites and parse them out. On blackberry I implemented this by creating a class that extended a thread. I would construct a new instance of this class with the parameters of my http request and it would call a function back in my main class, sending it the results. I am tempted to reuse my code, but am curious if android has something better built in. I have been looking at the handler class as well as possible using a service.

Bascially, I would like to start a new thread that will return a document of a specific url.

View 1 Replies View Related

Android :: Methods Of Intents Activity?

Jan 8, 2010

I have two applications A and B (in different packages,but it doesn't matter).Application B is an sms application that i have made and contains one activity.This activity has a method called sendSMS(String number,String text).I want to call this method from application A and send an SMS without opening the activity(the GUI) of application B but just send an SMS in the background by calling just the method of the activity.Any ideas?

View 10 Replies View Related

Android :: Difference Between Position And ID In Methods?

Dec 30, 2009

On methods like these kind, onItemClick(AdapterView parent, View view, int position, long id), what's the difference between position and id.

View 2 Replies View Related

Android :: How To Call Java Methods From C++ In JNI?

Oct 10, 2010

So I'm writing an Android app which uses a large c++ library. I have everything working so that the java app can call the c++ delegation methods, but I'm finding myself wishing I could log messages from c++ to the Android log. This is easy from java, but I'm at a loss as to how to call a java method from c++. My searches found methods for opening a jvm from c++, which is not at all what I want to do. Ideally, I'd like to pass a log method pointer to c++, which could then be used whenever I wanted. Of course, java doesn't support method pointers.

View 2 Replies View Related

Android :: ItemizedOverlay Using Both OnTap Methods

Jun 15, 2010

I have a MapView where I would like to be able to tap the map to create a new item at that location if there is no item there, or display the info about the item if there is.

I tried overriding both the onTap(int) and onTap(GeoPoint, MapView) methods but apparently if the second method is overridden the first never gets called (commenting one or the other lets each one work as I expected).

I thought about just checking if an item was at the location, but there doesn't seem to be any handy methods available to do that (other than iterating through the list of items and checking each manually).

View 17 Replies View Related

Android :: Optimization Accessing Fields Vs Methods

Nov 1, 2010

I know rule #1 of optimization is: don't do it! But I figured this was an easy question, and if I start using the faster method now I can save a lot of cpu time when I'm finished.Now, the answer to my question may be "there's no difference" and that's fine with me. I just want to know.

View 4 Replies View Related

Android :: KeyEvent Methods - What Does Its Return Value - Mean Logically?

Sep 1, 2010

1. what is the getKeyDownTime() method? What does its return value mean logically? 2. what is the getKeyEventTime() method? What does its return value mean logiccaly? 3. I want to measure the time a key was depressed for. Eg: Key A was pressed for 60 ms. which of the above methods would be useful?

View 7 Replies View Related

Android :: Different Text Input Methods (Poll)

Aug 11, 2010

Just out of curiosity how many people use Swype vs. Voice to Text vs. other means for text input. If I forgot a method just say it out loud.

View 4 Replies View Related

Android :: Methods To Keep Mobile Phone Off Using Code

May 28, 2010

is there a methods to keep mobile phone off using code, i have no idea about this,and hope someone give me some advice,or example , code,api

View 1 Replies View Related

Android :: Accessing Common Methods Among Activities

Jun 20, 2010

I have Activity A and Activity B. I want to access a method in Activity A from Activity B. This is my method:
Activity A extends activity{
public void save(){
} }

View 5 Replies View Related

Android :: Closing Old Methods / Activities In Application

Nov 24, 2010

Need help closing/accessing my views in a simple app (included an img of my program layout) but I might have been too confusing. Basically, I have an app that has a main menu where the user can click a button to open a camera. The user then snaps a photo and it is displayed on a page. The user will then click another button that detects faces. If faces are detected, the user is sent to a final page that shows the cropped face, etc. I give the user the ability to return to the main menu or snap a new photo.

Let's say a new photo is snapped and the user does it a few more times. Now I have multiple saved instances of old snapped photos (presented on the layout). How do I kill the previous instance (the layout from before he decided to snap a new photo)? So when I try to close the app it doesn't go back to the previous instance (displayed layout of said snapped photo). I am so confused on this one thing.

View 1 Replies View Related

Android :: How Java Generate Signatures For Methods

Oct 1, 2010

I have an Java class with a static final method getAll:

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

Now I want to hand in null as a value for the where statemant so that it will just be ignored later on in the code. Anyway in the testcase for this method I have: Vector<Category> categories = Category.getAll(context, null);

Which then in turn gives me a NoSuchMethodError. I don't know exactly why it does that. The only thing I could imagine is that the null I hand in would not match the signature of the above method. But how can I overcome this? I already thought of overloading. But this would just end in rewriting most of the code. At least when I do it, how I think.

This is the stack trace I get:

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

View 2 Replies View Related

Android :: Want Call Methods Of A Activity From Service

Apr 27, 2009

Is it possible to call methods of a Activity from service. I am running a thread from a service and i listening to some external event from that thread. I am not able to call methods from that thread. Is there any way to call methods from a thread.

View 3 Replies View Related

Android :: Remotely Call Methods Through AIDL

Jul 21, 2010

I am curious whether the AIDL only serves for inter-process communication between several Android apps on the same device, or AIDL provides much wider functionality. Let's say I have a Java application running on some server, is it possible to remotely call methods on that server through AIDL from an Android phone?If yes, do I need some extra libraries on the server-side Java application?

View 1 Replies View Related

Android :: Want Activity State Without Override Each Methods

Nov 22, 2010

I want see the state of my activity (Pause Stop Resume etc etc) without override each methods like this: Code...

View 3 Replies View Related

Android :: Way To Create Methods / Threads In Java?

Sep 7, 2010

I want to create one method and call the created Thread inside that method in my Android Application, I am new to Java as I had told before. Can anybody giive me an example of how should I create a method and call a Thread inside that method!

View 2 Replies View Related

Android :: Methods Not Working - Force Closing?

Nov 20, 2009

I've a couple functions that basically parse XML but it's not XML it is parsing something similar. I use them in PHP to break apart large strings so I converted them to Java for this, but when I use them they force close. I use this code to call them....
CODE:..........

That's the gist of it. I know the string "str" is good, checked it, but if I run these lines I get a force close, if I comment them out I do not. The methods are below. See anything wrong?

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

View 5 Replies View Related

Android :: Graphics.Point - All Methods Are Stubs?

Jul 4, 2010

I'm trying to use the Point class from android.graphics, but it appears that all the methods are stubs.

For example, the line Point p = new Point(1, 1); causes java.lang.RuntimeException: Stub!.

If I look at the bytecode for Point, I see a bunch of stubbed methods, e.g:

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

What's the deal here? Surely they didn't ship a class that's 100% stubs.

View 1 Replies View Related

Android :: Sdk - Methods For Converting Shape To Path?

Aug 20, 2010

The Canvas class does not take Shape as a parameter for any of its methods. There is no drawShape or clipShape, etc... So, I need to use Path instead. Does android sdk expose any way to convert Shape to Path or Path to shape? I haven't been able to find relationship any between the 2 classes...?

View 1 Replies View Related

Android : How Can I Call Service Methods From BroadcastReceiver?

Dec 7, 2009

I made two applications. One for an activity receiving user input, the other for a background service. In the service package, I create two files (startSensorBroadReceiver.java, remoteService.java). StartSensorBroadReceiver will receiver an intent from activity application and call method inside of the service. There is no erron in the codes but I can not excute what is want. I meet a message like this "The application ServiceExample has stopped unexpectedly. Please try again." could you let me know. what is wrong? and how I can call service methods from broadcastReceiver?

View 5 Replies View Related

Android :: Accessing Shared Preferences Through Static Methods

Sep 27, 2010

I have some information stored as SharedPreferences. I need to access that information from outsite an Activity (in from a domain model class). So I created a static method in an Activity which I only use to get the shared preferences. This is giving me some problems, since apparently it is not possible to call the method "getSharedPreferences" from a static method. Here's the message eclipse is giving me:
Cannot make a static reference to the non-static method
getSharedPreferences(String, int) from the type ContextWrapper

I tried to work around this by using an Activity instance, like this:
public static SharedPreferences getSharedPreferences () {
Activity act = new Activity();
return act.getSharedPreferences("FILE", 0);
}

This code gives a null point exception. Is there a work-around? Am I going into an android-code-smell by trying to do this?

View 2 Replies View Related

Android :: Using New Sdk Methods On Devices Running Older Sdks

Dec 21, 2009

I'm using the level 5 sdk to compile my app, but set my target to sdk level 3 in my manifest. All is fine.

I may need to use some level 5 classes (ExifInterface) though. What's the right way to go about using them while not fouling things up for devices running older sdk versions? Do we simply restrict use of the newer API methods to completely separate class files? Something like this:

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

so as long as the api methods are completely separated into files that the older devices won't invoke, we should be ok?

View 6 Replies View Related

Android :: Static Methods Or Singletons Performance Wise?

Feb 27, 2009

In an app with a small number of POJOs and lots of helper methods that operate on them, what's better performance-wise: to make the helper classes singletons or to make the methods static?

View 4 Replies View Related

Android :: Get List Of All Input Methods That Are Installed On Phone?

Nov 17, 2010

I'm trying to display a list of all the Input Methods that are currently installed on the phone.Does anybody know how to accomplish this? I don't care how I have to do it, I just need to be able to produce a list of Input Methods as they appear in the phone's Language and Keyboards menu and then store the user's selection. I thought maybe I could just use the InputMethodManager to launch the standard Input Method selection menu and then see which one the user picked by looking at which IME is currently selected after the menu closes, but as far as I can tell there's no way to see which IME is currently selected in the system.

View 1 Replies View Related

Android :: Using Activity Lifecycle Methods / What's Best Strategy For Binding?

Sep 15, 2010

I'm binding to a local Service (that is, not using IPC and AIDL) from several activities. I want to ensure that I'm not holding references to this service from activities that the user isn't using. My options are: 1.) to bind to the service in onCreate() and unbind in onDestroy(). 2.) bind in onStart() and unbind in onStop(). 3.) bind in onResume() and unbind in `onPause(). Or some combination of these. Which is the best-practice way of binding and unbinding to a local service? Do I not need to be concerned with holding local connections from stopped activities? Additionally, once bound to this particular service I am retrieving a Cursor which is attached to my ListActivity via a CursorAdapter. The data retrieved by the Cursor may have changed while the Activity was out of view so I want to requery it when the Activity is shown again. If I bind in onCreate() I can requery in onRestart(). If I bind in onResume() each time the data will be fresh because I'll query it in the Service's connected callback.

View 1 Replies View Related

Android : Ant Vs Eclipse / Build Methods Are Behaving Differently?

Mar 15, 2010

The Eclipse build for my 1.6 application project is succeeding and the Ant build is failing. I'm looking for help on why they aren't behaving the same way.

We are developing on Mac OSX 10.5.8 with Eclipse 3.5 against SDK 1.6 + Google APIs. There are no setting changes in Eclipse, either at workspace or project level. Similarly, our ant is also a vanilla- flavored unmodified installation of 1.7.1. JDK is 1.5.0_22. The CLASSPATH environment variable is not set. JAVA_HOME is /Library/Java/ Home

The application was initially created by a team member using the Eclipse plugins. The application references two jar files, one of which has a dependency on javax.xml.bind.annotation.XmlSeeAlso, which is not defined anywhere in our code or in android.jar. The other jar file has an explicit dependency on android.jar. I generated the Ant build file using android update.

The Eclipse project builds an apk and runs the application in the emulator. I think this is incorrect behavior.

The Android project fails to build. I think this is correct behavior. MyClass.java:98: cannot access javax.xml.bind.annotation.XmlSeeAlso[javac] file javax/xml/bind/annotation/XmlSeeAlso.class not found

Any ideas as to why the two build methods are behaving differently? I would expect them both to fail.

View 5 Replies View Related

Android :: Java.lang.VerifyError When Calling Static Methods

Nov 5, 2010

I am working on an Android project that uses classes and methods from a seperate JAR file I am also creating, and the issue is with a specific util class called XpathUtil that is throwing a VerifyError every time I try calling one of its static methods. Here is how my XpathUtil class looks like:........................

View 1 Replies View Related

Android :: Accessing Activity Methods Inside Click Listener

Aug 25, 2009

I have a click listener:
private OnClickListener onMyListener = new OnClickListener() {
public void onClick(View v) {
myMethod();
} };

And my Method:
private String myMethod() {
TextView tv = (TextView) findViewById(R.id.TextView1);
return (String) tv.getText();
}

When it calls this method, at tv.getText() it breaks in the debugger.
With this in the stack --
ViewRoot.handleMessage(Message) line: 1571
ViewRoot(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3948
Method.invokeNative(Object, Object[],
Class, Class[], Class, int, boolean)
line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 782 ZygoteInit.main(String[]) line: 540 NativeStart.main(String[]) line: not available [native method]

View 2 Replies View Related

Android :: Send Key Event Using Native Methods / Low Level Classes

Feb 24, 2010

I was looking 2 weeks ago for sending back and home key events when on Click is performed on a Image Button, I could do that perfectly. I have a device with no buttons. So, I want to simulate Menu button click. To know what is really happening, I implemented a code in on Create Options Menu that rises a Null Pointer Exception. I got the following stack trace. code...

View 21 Replies View Related







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