Android :: Correct Use Of Classloader (especially In Android)

May 9, 2010

I read some documentations about classloaders, but im still not sure where and why they are needed. The Android API says: Loads classes and resources from a repository. One or more class loaders are installed at runtime. These are consulted whenever the runtime system needs a specific class that is not yet available in-memory.So if i understand this correct, there can be many classlaoders which are responsible for loading new classes. But how the system decides which to use? And in which situation should a developer instantiate a new classloader? In the Android API for Intent there is a method

If activity A which is located in Project A (in Eclipse) defines an object which i want to send to Activity B in Project B using putExtra of the Intent object. If this object which is send over the Intent is not defined (source code in project B), then there is a NoClassDefFoundException. So can i use the method setExtraClassloader to avoid this exception? If yes, how can i decide which classloader object i have to pass? And how do I instantiate it correctly?

Android :: Correct use of Classloader (especially in Android)


Android :: Classloader To Launch Activities

Jan 10, 2010

I'm still in the concept stage so I don't need implementation details. My question is whether it is possible is transfer a JAR file over a socket and use a classloader to launch an activity.

View 5 Replies View Related

Android :: ClassLoader Leaking Memory?

Dec 17, 2009

I have a ClassLoader in Activity's onCreate which loads a specific class from a library, and is working fine, except that when activity is destroyed, the memory resources about the loaded class are not released.If the same activity gets created multiple times very quickly (by launching it, and destroying it by pressing the Back button), and the process doesn't happen to be killed by Android yet, the memory usage of the corresponding process grows continuously until the app crashes,and process dies.The problem is that this happens even if no objects are instantiated using the loaded class. There seems a problem with garbage collector, which doesn't seem to release resources about the loaded class on Destroy even if there are no references to it.If android would have killed the process right away when the last activity of the process gets finished, there wouldn't be a problem, but this is managed by Android system, and it doesn't always kill the process right away. A workaround may be to kill the process explicitly on destroy, but this is not encouraged way to do, as Android is supposed to manage the process.

An alternative is to have a functionality that allows a class to be unloaded onDestroy, but this doesn't exist. By design, the garbage collector is supposed to take care of this.Is there a solution regarding this?

View 8 Replies View Related

Android :: How To Change ClassLoader Of Activity?

Jun 25, 2010

I newed a DexClassLoader to load one jar file dynamicly.I think I have to set my cl to be default ClassLoader of Activity.to achieve similar thing. However, it does not work. So event I changed Thread's context classloader, Activity's classloader is not my cl.My question is how to change Activity's ClassLoader?

View 5 Replies View Related

Android :: Get Phone Correct Timezone

Nov 14, 2010

I am trying to get phone's correct timezone. I tried String newTzID = Calendar.getInstance().getTimeZone().getID(); This is returning "America/Atikokan". But my phone's timezone is EST. Both of these have an offset of GMT -5 hours. But I actually need to differentiate between EST and "America/Atikokan", since "America/ Atikokan" doesn't have day light savings time. Is there a way to get the correct id?

View 2 Replies View Related

Android :: Correct Use Of Titanium Backup

Oct 18, 2010

How to use titanium. Backup. Correctly.?

View 2 Replies View Related

Android :: Correct Way To Add Objects To An ArrayList

Aug 19, 2010

I am trying to add an object to an arraylist but when I view the results of the array list, it keeps adding the same object over and over to the arraylist. I was wondering what the correct way to implement this would be.

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

I have double checked my JSONArray data and made sure they are not duplicates. It seems to keep adding the first object over and over.

View 2 Replies View Related

Android :: Correct Use Of TaskAffinity & LaunchModes ?

Sep 28, 2009

My android app contains a suite of mini apps. In short, the main screen contains several icons, one each for the mini apps. When an icon is clicked, the mini app is launched.

In total I have 4 mini apps. So you could imagine that my main screen is like the Home Screen Launcher. Although these mini apps could run standalone by their own, I want the user to be authenticated. Thus there is a LoginActivity right before the MainActivity.

CODE:.........

I'm still not pretty sure of the benefit of Tasks (arranged set of Activities), so I would like comments from Android experts on my design decisions:-

(1) I plan to set the attribute finishOnTaskLaunch to true for LoginActivity. As I understand it, once the login is authenticated, I will navigate the user to MainActivity, and I want LoginActivity to disappear. Is this better than calling #finish on the Activity ? Will MainActivity automatically become the root of the Task without any extra configuration/code ?

(2) One of the mini app is an IM client. The PresenceListActivity will hosts many instances of ChatActivity (one-to-one chat session with an active contact in the buddylist). I plan to use the default launchmode for ChatActivity since each Chat should be handled by a new instance. Sounds correct ?

(3) A sticky navigation bar will exists in the top corner of AppOneActivity, AppTwoActivity etc.. I plan to set the clearTaskOnLaunch attribute to true for all of them. As I understand it, I should clear the stack whenever I plan to launch into any of the mini apps. Also their launchModes will be singleTask. Am I on the right path ?

(4) Finally I don't really understand how to read the output of adb shell dumpsys activity. For example

CODE:.......

Sometimes underneath the Tasks, you will see History and in others Running, what do these mean ? Even stranger, sometimes I have two History under a task.

View 1 Replies View Related

Android :: Correct Way To Start An Activity?

Feb 16, 2010

Code...

This would start a new activity, and then close the current Activity forever, right?

View 1 Replies View Related

Android :: Distance Between Two Locations Isn't Right / Get It Correct?

Jul 15, 2010

I have used the algorithm on http://www.movable-type.co.uk/scripts/latlong.html to find the distance between two points.

My two points are

long1 = 51.507467;
lat1 = -0.08776;

long2 = 51.508736;
lat2 = -0.08612;

According to Movable Type Script the answer is 0.1812km

My application gives the result (d) as 0.230km code...

View 2 Replies View Related

Android :: Maps API Key Is Correct Yet Map Not Displayed To App

Nov 24, 2010

I tried Hello goolge map tutorial and not able to viewthe map. I signed up for API key. I am using Eclipe which is installed in "d drive" used following command to obtain MD5 fingerprint fom bin folder of jdk

c:program filesjavajdk 1.6in> keytool -list -alias androiddebugkey -keystore "C:Documents and SettingsOwner.androiddebug.keystore" -storepass android -keypass android

Got this fingerprint: 21:17:B1:D8:01:BD:F2:5A:9F:C9:A3:01:96:FA:9A:5B

Used this to find API key and got this: "0Gm7C3R3R2K1pmQGuGkS0rx582TWJEBdJwryFrA"

Used following code in layout

CODE:.......

Still map is not displayed.

Log Cat error log

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

My manifest file:

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

View 2 Replies View Related

Android : Map Not Displaying Even Settings Are Correct

Nov 11, 2009

i am running the mapdemo application in the samples of SDK. i have set the MAP api key and set the permissions(INTERNET, FINE, COARSE) Then also the map is not displaying on the emulator (only just Tiles).

View 11 Replies View Related

Android : Png Image Not Rendering Correct / How To Fix?

Jun 15, 2010

When trying to process this png image, webkit displays it blurry.

View 2 Replies View Related

Android : Is Way Of Doing Threads In Phone Correct

May 17, 2010

I'm writing a live wallpaper, and I'm forking off two separate threads in my main wallpaper service. One updates, and the other draws. I was under the impression that once you call thread.start(), it took care of everything for you, but after some trial and error, it seems that if I want my update and draw threads to keep running, I have to manually keep calling their run() methods? In other words, instead of calling start() on both threads and forgetting, I have to manually set up a delayed handler event that calls thread.run() on both the update and draw threads every 16 milliseconds. Is this the correct way of having a long running thread?

Also, to kill threads, I'm just setting them to be daemons, then nulling them out. Is this method ok? Most examples I see use some sort of join() / interrupt() in a while loop. I don't understand that one...

View 1 Replies View Related

Android :: Bluetooth Application Use Hid Profile - Correct?

Jun 16, 2009

I want to develop an application for input device(bluetooth). I would like to use HID profile or SPP. But Android SDK support only A2DP and AVCRP profile. I'll have to wait until the next version is released. I have one question. I think A2DP, AVCRP profile use SPP. is correct? If so, we can use SPP instead of A~~ profiles? I don't know bluetooth api.

View 2 Replies View Related

Android :: OnActivityResult Intent Data Not Correct

Jul 29, 2010

I'm venturing into startActivityForResult for the first time and I'm running into a problem.When a user clicks on a list item of Activity B, it returns "ql_id" to Activity A:Unfortunately, extras.getInt("ql_id") evaluates to "0". Why is this? It should be "1". I am clearly doing something incorrectly.

View 1 Replies View Related

Android :: Correct Way To Specify Dimensions In DIP From Java Code?

Nov 24, 2010

I found that it is possible to set dimensions of my interface elements in XML layouts using DIPs as in following fragment : "android:layout_width="10dip" But all Java interface takes integer as arguments and there is no way to specify dimensions in DIPs. What is the correct way to calculate this? I figured that I have to use property density of DisplayMetrics class but is this a correct way ? May I rely on that formula:
pixels * DisplayMetrics.density = dip

View 2 Replies View Related

Android :: What Exactly Is Correct Way Of DDMS Sending Coordinates

Oct 13, 2009

I am trying to design my first Android application with the use of GPS. As of right now, I have a drawable button that when clicked, alerts a Toast message of the longitude and latitude. I have tried to use the telnet localhost 5554 and then geo fix #number #number to feed in values but no results display just 0 0. I have also tried DDMS way of sending GPS coordinates and I get the same thing. My question is what exactly is the correct way of using the geo fix and the DDMS way of sending coordinates. I have used Location, LocationManger and LocationListener but I am not sure which is the right choice. Code...

View 2 Replies View Related

Android :: Beautiful Widgets - Temperature Not Correct

Oct 2, 2010

I was wondering if anyone knows how to fix this problem. My temperature is not correct, it says its 13 degrees out and its in the 60s. Is there a way to fix this or should I just uninstall and reinstall.

View 4 Replies View Related

Android :: Intent Not Opening Correct Activity

Aug 22, 2010

I'm having a struggle understanding why my intent is not working. I basically just copied paste from other examples in my code that work perfectly like this. Here it is:

Intent addIntent = new Intent(v.getContext(), thenNnowMode.class);
Bundle w = new Bundle(); String activityName = "addPic";
w.putString("activity", activityName);
w.putParcelable("bitmap", selectedDeviceImage);
//a.putString("id", picId); addIntent.putExtras(w);
startActivity(addIntent); finish();

The intent is opening a different class called thenNnow.class instead of thenNnowMode.class and I have no idea why this is happening. I've tried sending the intent to open other activities other than thenNnowMode but it always opens thenNnow. Am I missing some silly syntax mistake? It's so strange, its the same code. I am not sure if it's relevant but the thenNnowMode class uses the device camera

View 23 Replies View Related

Android :: Launching Correct Activity On Resume

Jan 22, 2010

I'm currently working with a two-activity application. The first activity allows the user to choose options for their upload, and the second activity displays a ListView of their results once processed.I have code in place that performs the uploads/downloads in the background, regardless of whether the application is currently in focus or not (thanks to Matthias Kaeppler's Droid-Fu).I would like to have my application Resume into my second (results) activity when a user clicks on the icon from the top-level launcher, regardless of how long they have been away from the app. I thought that the 'alwaysRetainTaskState' flag in the Manifest would do it, but I've not had success with that. Can anyone tell me how I need to set up my Manifest to get this functionality?

View 19 Replies View Related

Android :: Need To Allow State Of A Correct Phone Call

Oct 14, 2009

I can see that we can get a phonestate via the PhoneStateListener, but there is no way of telling the state of the call. OFFHOOK is a number of states combined into one. Is there a particular reason for this? Are we not allowed to see the correct state of a call?

View 2 Replies View Related

Android :: Unable To Get Correct Selected Items

Apr 17, 2010

I am to display the list and store the selected items in an array. But I am not able to get the correct items that were selected. Here whenever the user clicks an item, the array is getting updated, irrespective if the user is clicking the item to select it or deselect it. Could some one please help me solve this. I could actually perform an iteration to remove the odd numbered items in the array but I feel that would become an overload on the phone. Is there something for efficient. Please advise.

public class MainActivity extends ListActivity { TextView selection; String[] items={"sodium", "O2", "C02", "HCL", "NaCl", "H2So4", "O3", "Ag"}; String names[] = new String[10]; static int i=0; int posarray[] = new int[10]; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, items)); .........

View 2 Replies View Related

Android :: Birthdays Are Not Correct From Facebook Contacts

Sep 20, 2010

Anybody have any idea why my contacts which are also my FB friends have birthdays listed in the People Profile a day before their actual birthday? When I look on their FB profile, the date is correct. When I look in their contact info in my phone, its a day off. And how would I go about fixing it b/c I can't edit FB information for other people?

View 2 Replies View Related

Android :: Correct Way To Save State Of An Activity?

Jul 1, 2010

I have an Activity, which contains a bunch of check boxes and a submit button.

When the submit button is clicked, the activity will exit (finish() will be called). Before the activity exits, I want to save the states of the check boxes in the activity, so when the activity starts again, the check boxes can stay in their previous states. What's the correct way to save these states? Should I use SharedPreference.

View 1 Replies View Related

General :: How To Know Correct Amount Of RAM On Android Device

Feb 27, 2014

I have some doubt about the amount of RAM in my Android device . Not sure if it has 256 MB or 512 MB โ€‹โ€‹. I was able to run through a terminal in android : cat / proc / meminfo

Apparently I have approximately 466MB of RAM. If so will I have 512 MB. The question comes because if I run the command "free" or if I see from the above command in LowTotal line, only tells me 233 MB ...

What is the correct information in RAM for my device? I did the same procedure to another cell which mine where I'm more sure of having 512 MB โ€‹โ€‹of memory and this is what I get: URL>...The funny thing is that it shows me 584 MB of MemTotal and the same amount for LowTotal. It seems my device, the first , is not using the total amount of RAM available.

View 3 Replies View Related

Android :: Getting A RadioGroup To Redraw With Correct Button Checked

Oct 7, 2010

I have a RadioGroup view inside a LinearLayout. The radio buttons are added from dataList. If I call the code below from inside onCreate, the correct button is checked. However the dataList can get updated from time to time and after that happens I call this code again, without destroying the Activity. After that, the view is redrawn but no button is checked. I suspect the RadioGroup checked-button bookkeeping is getting confused by the removeAllViews call. Any ideas what might be going wrong?

View 6 Replies View Related

Android :: My Desire Calculator Calculates Incorrect / Correct It?

Oct 31, 2010

I search a better calculator for my Desire.

The stock calculator calculates incorrect,
e.g. 100-99.9=0.0999999999

The new calculator should very easy to use (and calculate correctly).
Mathematical functions to show graphically would be nice

With these many, many calculators in the market it is hard to find the right.

View 7 Replies View Related

Android :: Images Don't Display But TextView Contents Is Correct

Oct 29, 2010

I am working on an Android application that displays a list of items when a tab is selected, then displays detail information about an item that was selected from the list :

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

The details are to be displayed using ImageViews, ImageButtons, and TextViews. The data comes from a database query, so the TextView text and ImageView drawables have to be assigned dynamically.

The correct text from the database query gets assigned to each of the Views. I can see everything being added when I step through the code in the onCreate method of Activity3 in the debugger.

BUT, the drawables are only displayed when I select the first item in the ListActivity. If I select another item, all TextViews display the correct information but the drawables are not displayed for the ImageViews or ImageButtons. It looks like only the backgrounds are being displayed.

The ImageButton drawables are not being dynamically assigned, only the ImageView drawables are. The ImageButton drawables are set in the TableLayout XML that is associated with the activity. Here is one entry :

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

Originally, I had android_drawable="@drawable/ic_phone", then tried adding android:background="@drawable/ic_phone", and finally created the following selector (phoneselector.xml) :

If I select the first item again, its proper ImageView drawables are displayed along with the proper text in the TextViews. The ImageView drawables that belong to the other items have no problems being displayed in Activity2's ListView.

The code successfully sets an onClickListener for the button (also in Activity3.onCreate). If I click on what is displayed on the spot where the drawable should be, the phone number is dialed.

The code successfully sets an onClickListener for the button (also in DetailActivity.onCreate).

Has anyone seen anything like this before? I would appreciate any help figuring out what is wrong.

Here are more details because I wonder if the problem has to do with the use of the Views :

The Activity1 extends TabActivity and sets a TabHost view that contains a FrameLayout along with the TabWidget. Activity1 creates the tabs dynamically.

Activity2 extends ListActivity and sets the content to its ListView (via setContentView(getListView()).

When ListActivity.onListItemClick is invoked (item in list is selected), a new Intent is created that contains an identifier in a Bundle and Activity3 is started.

The started activity (in Activity3.onCreate...) sets the content to a TableLayout view defined in a .xml file (via setContentView(R.layout.details.xml).

Here is the code from Activity3.onCreate :

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

View 1 Replies View Related

Android :: Correct Location For Hierarchical File List

Jul 21, 2010

I have a simple app which needs to display 1 of many text files (DB is no an option currently)

Where is the best place to put this collection of text files? I am guessing "Assets", but am unsure.

View 1 Replies View Related







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