Android :: Clone View At Object Level For Performance Reason?
Nov 11, 2010
My question is almost exactly this question:
Clone textview to append it to a ViewGroup
However, I was inflating a view, and then attempting to clone it at the object level for performance reasons (I don't want to parse XML every single time), so that answer doesn't help me. View.clone() is protected and it apparently doesn't have a copy constructor. Is there any way to do this?
View 1 Replies
Feb 28, 2010
I like to know how can i clone a view object which is already there in the view hierarchy, so that it can be added to the same view hierarchy again.
View 1 Replies
View Related
Sep 22, 2010
I have a class which has implemented Parcelable. Can I do something like the following to create a new instance of a class?
found this from the following q: http://stackoverflow.com/questions/1626667/how-to-use-parcel-in-android
This is working ok, I can go with this but it is extra code, not sure if there's a shorter way to do it (other than properly implementing a copy constructor...)
View 1 Replies
View Related
Nov 2, 2010
My android application works well but it's performance(speed) is slow. In my logcat i saw frequent garbage collection operation like
11-02 15:07:20.647: DEBUG/dalvikvm(12571): GC freed 295 objects / 38448 bytes in 93ms
Is this the reason for low performance? How can i improve my applications performance?
View 1 Replies
View Related
Oct 11, 2009
I want a application level object in Android.Here is the scenario... Suppose I want to pass a object from Activity A to Activity B then to Activity C D......... Then I will have to pass that object from Activity A to B then to C then to D....... Passing the Parcel Through the Bundle. Is there a Object in Android which can be accessed by all the Activities and its lifetime is same as the lifetime of the application.
View 2 Replies
View Related
May 14, 2009
Is it possible to clone a view. If no, how to support clone of a view in custom views. If yes.. which api should we use. clone method seems to be protected for view.
View 2 Replies
View Related
Apr 2, 2010
How do I add a View dynamically in an android widget? I realize that the RemoteViews works as a container of updates, but the RemoteViews.addView is only available on API level 7 (and I want my widget to work on HTC Hero phones, which has API level 3).
View 1 Replies
View Related
Aug 2, 2010
Is there a way on Google Navigation you can get the view down to street level - like the kind you get on a Tom Tom? You know, the arrow very close to the screen & it shows you turn by turn?
View 1 Replies
View Related
Oct 10, 2010
This is a followup to this post: http://stackoverflow.com/questions/3897176/findviewbyid-in-a-subclassed-surfaceview-throwing-runtimeexception Based on Romain Guy's feedback (which I'll accept shortly as it is a solution), I'd like to obtain the calling Activity from within the View, so that I can use it to obtain the desired Text View resource. I don't see any methods in View that return Activity. What is the proper way to do this? Or is there a better alternative for working with TextViews from within another View context. Basically, I am calling setContentView(R.layout.xxx) in onCreate() (as usual), so I don't really have a way to pass in references to additional TextViews unless I awkwardly retrieve the View after setContentView and then make calls on it.
View 1 Replies
View Related
May 7, 2009
We see API for saying which is the next focusable view.. however during the event handling we want to set the focus to xyz view object pro grammatically . Is that possible.
View 3 Replies
View Related
Mar 9, 2009
In the Tab2 of TabActivity in the APIDemo example, it has this method to create a View object for each tab. code...
Can you please tell me how can I create a View for each tab from an xml layout file? For example code...
View 2 Replies
View Related
Aug 7, 2009
I have a very simple requirement. I have a View object, lets say an ImageView object. I want to move this ImageView object in a circle.
More specifically, I want to move it along an arc, which is not a complete circle. I found in Android Documentation that comes with SDK that we can create a path from an arc but it does not mention how to use this path to make an animation that goes along that path.
Please note that I dont want to rotate the image. I have to move it in a circular path.
View 3 Replies
View Related
Jul 2, 2012
I'm having trouble developing an app, while it works in API level 10, it does not in API level 7. I wondery why and I've been looking for a site that summarizes the differences, or the new features from one API level to another and cannot find it.
09-04 04:24:21.485: E/AndroidRuntime(6834): Uncaught handler: thread main exiting due to uncaught exception
09-04 04:24:21.510: E/AndroidRuntime(6834): java.lang.VerifyError: [code]....
There seems to be a problem with an uncaught exception and reflection, although....why does it work on API level 10?
View 1 Replies
View Related
Jan 11, 2010
I have a Adapter View derived class (say GridLayout) in which I arrange views in a grid. When items in the grid exceed the height of the GridLayout( or screen) I want a scrollbar to appear. I have handled scrolling in onTouchEvent. But the problem is the scrollbars don't appear. I have set the vertical scrollbar to be enabled, but no use. The docs say the scrollbar appears every time the scrollTo or scrollBy methods are called.
View 2 Replies
View Related
Sep 15, 2010
I want to share streams of a socket connection between the activities of a tab view. In particular the tab activity creates the socket and gets the i/o streams,so i want that tabbed activities use these streams to retrieve informations without reconnect to the server each time i switch from a tab to another. I know i can use the application class to have a global state, but i don't know how.
View 4 Replies
View Related
Aug 3, 2010
I think this is a pretty simple question but I'm having trouble finding the answer out there.I'm developing an android application (currently developing against v1.5 API) and one of the activities use a ListView. I want to be able to set the properties of each List Item based on the state of an in memory object rather than the state of the view or list item.Here is a simple example....say I have a Person class who's public members are defined as follows. Code...
View 1 Replies
View Related
Dec 14, 2009
This subject originates here: http://groups.google.com/group/android-beginners/browse_thread/thread...
To sum up:
When I click on an item in the ListView, the background color that gets changed is not that of the clicked item but instead of the other item in the opposite side relative to the middle item:
1 <-- I click here 2 3 <-- Acts as a mirror 4 5 <-- This is the one that gets changed
1 2 <-- This is the one that gets changed 3 <-- Acts as a mirror 4 <-- I click here 5
This problem persists even when I use CheckedTextView like what is suggested in the post.
I use the latest stable SDK.
This problem occurs when the target platform is Android 1.6, 2.0 or 2.0.1.
The problem does not occur when the target platform is Android 1.1 or 1.5.
However, the problem will also occur when the program is compiled for 1.5 and run in 2.0.1.
The simple problematic code can be found here: [url]
There I also put the screenshots showing the problem: demo01.png: I click an item. demo02.png: the clicked item doesn't get changed but the reflective item does.
Is this a bug in newer Android platforms?
If it is intended, what is the reason and could you please show me how I should fix my code?
View 6 Replies
View Related
Nov 18, 2010
I want to get the current focus view in my Service to check the view is a EditText and append some texts in it (for all EditTexts, not only in my application).
I found some methods to do this, like Activity.getCurrentFocus() and Windows.getCurrentFocus(). But these methods are used in a Activity.
How can I use these methods in a Service? Or is there another way to do?
View 2 Replies
View Related
Nov 7, 2010
I have a custom view that draws to a canvas. I am trying to invoke changes to the canvas when the user pushes a button from the activity that this view is tied to. Currently, I am attempting to do this by calling a public method, called setNewDrawable, that I created inside the view.
The debugger is giving me different values for the view ID depending on whether I'm inside setNewDrawable or inside the Overridden onDraw method when I post an Invalidate.
For example the debugger variables show: (This - MyView id=830067720176) or (This - MyView id=830067712344) in setNewDrawable and onDraw respectively. This makes me think I basically have two copies of the object and I am essentially interacting with the wrong one.
How can I get information to my custom View in order to determine what it draws?
Here is the code I am running...
View 1 Replies
View Related
Mar 3, 2009
My purpose is very simple : each 1second, I want to redraw an object on different place on background. I do not know where my error on this code below. Here is my code:
public class My_View extends View{ private Bitmap mBackground_img;
private Drawable mMoveObject; private int mObjectw,mObjecth; private int Dx,Dy;
private Handler myHandler = new Handler(); private long lasttime;
public My_View(Context context,AttributeSet ats,int ds) {
super(context,ats,ds); init(context);
} public My_View(Context context,AttributeSet ats) { super(context,ats);
init(context); } public My_View(Context context) { super(context);
init(context); } public void change() { invalidate();
} private void init(Context context) {
Resources res = context.getResources();
mMoveObject = res.getDrawable (R.drawable.lander_firing);
mBackground_img = BitmapFactory.decodeResource(res, R.drawable.my_pic);
mObjectw = mMoveObject.getIntrinsicWidth();
mObjecth = mMoveObject.getIntrinsicHeight();
Dx = Dy = 0; lasttime = System.currentTimeMillis() + 1000;
Thread mthread = new Thread(null,doBackground,"Background");
mthread.start(); } private Runnable doBackground = new Runnable() {
public void run() { long now = System.currentTimeMillis();
if(lasttime < now ) { Dx = Dx + 10; Dy = Dy + 10;
lasttime = now + 1000; myHandler.post(change_view);
} } }; private Runnable change_view = new Runnable() {
public void run() { change();
} };
@Override public void onDraw(Canvas canvas) {
canvas.drawBitmap(mBackground_img,0 ,0 , null);
mMoveObject.setBounds(Dx, Dy, Dx+mObjectw, Dy+mObjecth);
mMoveObject.draw(canvas);
} }
View 7 Replies
View Related
Nov 7, 2010
In my program I have a custom view object. Inside the view class is a method called foo. For some reason when I call foo from my activity, it doesn't fire. Here is the code:
XML of the custom view:
<com.company.application.MyView android:id="@+id/my_view" android:layout_width="wrap_content" android:layout_height="wrap_content" />
The activity code:
public class Main extends Activity { MyView mView;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.main);
LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = li.inflate(R.layout.main, null); mView= (MyView) v.findViewById(R.id.my_view);
//A button to fire the method inside foo() Button switchLeft = (Button) findViewById(R.id.switch_left); switchLeft.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { callTest(); } } );
} public void callTest() { Log.w(this.getClass().getName(), "clicked left arrow");
mView.foo(); mView.postInvalidate();
} }
Finally here is foo:
public void foo() { mBackground = mContext.getResources().getDrawable(R.drawable.temp_canvas); Log.w(this.getClass().getName(), "background set");
}
The first log is always written when the button is pressed, but the second log is not because foo never fires. What is the deal here? Upon request, the full view
public class MyView extends View { Drawable mBackground; Context mContext;
public MyView (Context context) { super(context); mContext = context;
mBackground = mContext.getResources().getDrawable(R.drawable.leftarrow1);
} public MyView (Context context, AttributeSet attrs) {
super(context, attrs); mContext = context;
mBackground = mContext.getResources().getDrawable(R.drawable.leftarrow1);
} public void foo() { mBackground = mContext.getResources().getDrawable(R.drawable.temp_canvas);
Log.w(this.getClass().getName(), "background set"); }
@Override public void onDraw(Canvas canvas) { Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL); // draw a solid blue circle
paint.setColor(Color.BLUE); canvas.drawCircle(20, 20, 15, paint);
// draw a test background mBackground.setBounds(0, 0, 300, 400);
mBackground.draw(canvas); }
}
View 1 Replies
View Related
May 23, 2010
I'm looking into writing an Android game, tough I don't curerntly own an Android device. For those of you who own a device, how does the performance on the emulator relate to real device performance? I'm especially interested in graphics related tasks.This obviously depends on both the machine running the emulator, and the specific device in question, but I'm talking rough numbers here.This question is a duplicate, but since that post is heavily outdated, I figured it's irrelevant by now.
View 3 Replies
View Related
Sep 9, 2009
I want to do some automated testcase with Instrumentation . Suggest that my AUT has 2 Activity. After clicking the button in ther first Activity, the second one will be shown with new content base on what we enter in the first Activity.) Instrumentation provides us the function called startActivitySync() and return the Activity object for processing. My question is how we can get the pointer of the second Activity after the it is shown by clicking the button on the first activity.?
View 2 Replies
View Related
Jun 8, 2009
I would like to convert a Picture object to Bitmap object in memory, without writing data to disk.
View 2 Replies
View Related
Feb 20, 2010
Motorola CLIQ Over-the-Air Update
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
February 19 Update
The over-the-air update for the Motorola CLIQ has been delayed to the week of February 22. An updated article will be available once a date has been determined.
On February 18, Motorola will begin sending over-the-air (OTA) software updates to Motorola CLIQ customers. The software update will improve device performance and resolve several known issues.
Improved Performance:
Improved battery life
Improved software performance and stability
Improved widget response
Decreased Force Close error messages
New Manage SIM Card application
Support of .WMA and .WAV media files
Removal of the imeem mobile application
Known Issues Resolved:
Accessories & Bluetooth
Error: 'Unable to pair' or 'Unable to connect to device'
Call functions
Can activate other functions while listening to visual voicemail
Call not ended by pressing the End key
Speakerphone turns on unexpectedly when answer incoming call
Plays ringtone or vibrates while on an active call
Unable to answer incoming call using �Slide to answer� feature
Accidentally opens Dialer or makes outbound while holding device
Device hardware (battery, keys, power, screen)
Battery indicator may not display accurate battery power
Call not eded by pressing the End key
Touch screen issues
Cannot answer incoming call using the Slide to answer feature
Incorrect keys registered using on-screen keyboard
Touch display appears to have �dead spots� that are unresponsive
Accidentally selects item when trying to flick through screens or menus
Messaging
Wrong message deleted
Phone may reset when turning Wi-Fi off in area with no Wi-Fi coverage
Customers can manually download the OTA on demand by going to Settings > About Phone > System Updates. Customers do not need to wait for a notification message to download.
Action Steps
Be aware of the fixes and enhancements included in the Motorola CLIQ update.
If customers are experiencing any Known Issue that will be resolved by the software update:
Do not file a handset exchange
Advise customers that the issue will be resolved by a software update on February 18.
Important Rebate Changes
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
Customers eligible for rebates as part of new activations or upgrades must be advised they will receive their rebates in the form of a prepaid Visa card.
When customers take advantage of our new Early Upgrade or Early Upgrade Plus options, they are not eligible for upgrade rebate cards. These new upgrade options allow customers to take advantage of upgrades sooner and provide an instant discount, instead of having to wait for rebate cards.
To be eligible for an upgrade rebate card, customers must meet upgrade eligibility requirements.
Current, 1-year contracts: 11 or more active months since last discounted handset purchase.
Current, 2-year contracts: 22 or more active months since last discounted handset purchase.
Rebates on eligible purchases require contract extensions and a $9.99 or higher Data/Messaging feature.
Valid only on FlexPay plans with 1 or 2-year contracts.
Not valid for Even More Plus plans.
Active Months: The number of months in which the account has been in good standing and during which service has not been suspended.
Action Steps
Inform customers that Early Upgrade and Early Upgrade Plus are not eligible for upgrade rebate cards.
Advise customers eligible for rebates that they will receive their rebates in the form of a prepaid Visa card.
"With the purchase of your new handset, you can submit a rebate form to receive your rebate. The rebate will be in the form of a prepaid Visa card that can be used anywhere Visa is accepted. See the rebate form for additional details."
Trackball Replacement Program
[Retail Partner Sales - T-Mobile Employees and Authorized Dealers]
On February 24, T-Mobile will launch a Trackball Replacement program for BlackBerry Pearl 8100/8120 and BlackBerry Curve 8320 customers that are having trackball issues. This program will be available in T-Mobile retail stores only at this time.
Action Step
Refer customers to a T-Mobile retail store after February 24 for further assistance if they come in to your location looking to complete a trackball replacement.
First Connect for Dealers
[Retail Partner Sales]
First Connect for Dealers is an exciting class designed to help on-board and prepare Retail Partners to successfully sell T-Mobile products and services and provide differentiated customer experiences. This four hour class is conducted via the T-Mobile Live Virtual Classroom and covers the following:
Welcome to T-Mobile
Who is T-Mobile?
PCC
Differentiated Handsets
Differentiated Rate Plans
Service Excellence / Selling Skills
Tools and Resources
Customer On-Boarding
The attached flyer contains dates and times for these calls as well as registration details. ADRs should educate their locations about these calls and encourage them to attend.
To successfully be able to attend the training sessions, Retail Partners should have the following:
Computers with high speed Internet connections
The ability to play and hear video segments on the computer using speakers or headset
The use of a fully charged mobile phone to hear the audio portion of the conference call
Printer access to print Participant Workbook.
Action Steps
Share the attached flyer with your locations and encourage them to attend one of the scheduled calls.
View 1 Replies
View Related
Sep 21, 2009
I have an Activity that running on system. I can get the Intent that is used to start the activity. But i don't know how to get the Activity object from the Intent object or something else. Can anyone tell me how to do this??? Note that, I don't use Instrumentation object.
View 11 Replies
View Related
Feb 18, 2009
I am trying to get a FileInputStream object on an image that the user selects from the picture gallery.
This is the android URI returned by android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI content://media/external/images/media/3
When I try to construct a java URI object from this object, I get an IllegalArgumentException with the exception description Expected file scheme in URI: content://media/external/images/media/3 whereas the android URI shows the scheme as content
Never found a solution for the original question. But if you want the byte stream of an image in the pictures gallery, this piece of code will do that.
CODE:...................
View 4 Replies
View Related
Jun 26, 2009
I defined some complex AnimationSet in xml and would like to run it on several Views (View.startAnimation()). i cannot just create one instance of this AnimationSet (using AnimationUtils.loadAnimation()) and use it as parameter of View.startAnimation(), so i have to create several instances of this AnimationSet. since loading it from xml is rather slow operation, is there a way to load it once and then clone it when needed?
View 2 Replies
View Related
May 26, 2009
What's the most efficient way to clone a JSONArray?
View 2 Replies
View Related
Jun 24, 2010
I have a Samsung Q1 tablet PC installed in my car. I just got a Droid and like its GPS software better than any designed for PC I have tried. Is there a way I can clone my Droid screen onto my Q1? Sort of like the remote desktop apps out there but they all seem to be designed to access the PC via the Droid.
I don't care about controlling it via PC, I just want the GPS screen on my 7 inch screen instead of the 3.8 or whatever the Droid is. I have been researching installing Android onto PC but it doesn't sound like it works too well just yet.
View 1 Replies
View Related