Android :: NinePatchDrawable Constructor - Chunk And Padding

Mar 2, 2009

I am trying to create a NinePatchDrawable programmatically, but there is no documentation on the constructor's argruments (Bitmap bitmap, byte[] chunk, Rect padding, String srcName). Does anyone know what chunk and padding are... and how to specify them?

Android :: NinePatchDrawable constructor - chunk and padding


Android :: NinePatchDrawable As ItemizedOverlay

Jun 13, 2009

Is it possible to use "stretchable" graphic as pin in ItemizedOverlay? If not how can I draw NinePatchDrawable on Canvas?

View 4 Replies View Related

Android :: OutOfMemoryError While Uploading Video - How Best To Chunk?

Apr 8, 2010

I have the same problem as described here, but I will supply a few more details. While trying to upload a video in Android, I'm reading it into memory, and if the video is large I get an OutOfMemoryError. Here's my code:

// get bytestream to upload
videoByteArray = getBytesFromFile(cR, fileUriString);

public static byte[] getBytesFromFile(ContentResolver cR, String fileUriString) throws IOException {
Uri tempuri = Uri.parse(fileUriString);
InputStream is = cR.openInputStream(tempuri);
byte[] b3 = readBytes(is);
is.close();
return b3;
}
public static byte[] readBytes(InputStream inputStream) throws IOException {
ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();
// this is storage overwritten on each iteration with bytes
int bufferSize = 1024;...........................

View 3 Replies View Related

Android :: GetPadding() Of NinePatchDrawable Throw A NullPointerException?

Oct 12, 2009

I'm trying to use NinePatchDrawables in a LayerDrawable, but for some reason I get a NullPointerException. I've isolated the problem to the getPadding() method; the following code reproduces the problem:

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

What am I missing? Do I have to do anything special with the NinePatch? The program seems to work if I use the NinePatch directly (instead of putting it in a LayerDrawable).

View 6 Replies View Related

Android :: Can't Dispatch DDM Chunk Error / Solve This?

Sep 10, 2009

I have just recently setup my android environment on eclipse. I am having the following error when I try to run my helloworld program. Here is the error...

Unable to connect to activity manager; is the system running? solve this?

View 10 Replies View Related

Android :: NinePatchDrawable - Error No Resource Found That Matches The Given Name

Aug 9, 2010

The problem with NinePatchDrawable. Created 9.png file using a utility draw9patch, but when the throw the file in a folder res/drawable error: No resource found that matches the given name.

View 4 Replies View Related

Android :: Improving Upload Speed By Sending Chunk Of Bytes

Sep 22, 2010

I'm developing an android video uploading app and uploading large amounts of video is a problem, I get different type of exception sometimes (host not resolved, pipe broken), I do a multipart POST but I have a feeling if I upload chunk of bytes one at at time that'll increase upload speed as well as solve connection timeout and these type of problems.

View 1 Replies View Related

Android :: Activity Constructor Vs OnCreate

Jul 21, 2010

I understand that Android Activities have specific lifecycles and that onCreate should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the Activity constructor as well, or should you never touch it?

I'm assuming that the constructor should never be used because references to Activities aren't cleaned up entirely (thus hampering the garbage collector) and that onDestroy is there for that purpose. Is this correct?

View 2 Replies View Related

Android :: Subclass Of View Constructor Not Being Called

Jun 6, 2010

I'm subclassing Android's view class, but whenever I make an instance of the view from another class, the constructor never gets called (or so it seems). I've implemented both public myclass (Context context) and public myclass (Context context, AttributeSet, attrs) I can't figure out what I'm doing wrong. Do I need to override onDraw and onMeasure?

View 1 Replies View Related

Android :: Calling Superclass Method In Subclass Constructor

Apr 30, 2010

I get a NullPointerException calling a Superclass Method in Subclass Inner Class Constructor... What's the Deal?

In my application's main class (subclass of Application), I have a public inner class that simply contains 3 public string objects. In the parent class I declare an object of that inner class.

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

After I instantiate the object in the constructor, I get a runtime error when I try to assign a value in the inner class with a superclass method.

Can you not call superclass methods in the subclass constructor?

View 3 Replies View Related

Android :: Pass Enumerators To An Activity Constructor From An Intent?

May 14, 2010

I have an activity that when started needs access to two different ArrayLists. Both Lists are different Objects I have created myself.

Basically I need a way to pass these objects to the activity from an Intent. I can use addExtras() but this requires a Parceable compatible class. I could make my classes to be passed serializable but as I understand this slows down the program.

What are my options?

Can I pass an Enum?

As an an aside: is there a way to pass parameters to an Activity Constructor from an Intent?

View 3 Replies View Related

Android :: Class Derived From Intent Service Must Have Default Constructor

May 8, 2009

I'm posting this to share the lessons I learned while working with IntentService. IntentService has a single constructor that takes a string argument "name". The documentation has no description of what name is used for. In looking at the sources, I found that its only use is in naming the worker thread for the IntentService. This thread is named IntentService [name].

I initially implemented the constructor of the derived class to also take a String argument and passed it along to the derived class. This is wrong. This will cause the startService() call to generated a java.lang.InstantiationException in the application containing the service i.e. you don't get the exception in the application calling startService(). A clue to the actual problem is a little further up in the logs:"newInstance failed: no <init>()"

The derived class must have a Default constructor and that constructor must call super() passing a string for the name component of the worker thread name.
public class MyIntentService extends IntentService {
public MyIntentService() { super("MyIntentService");
} @Override
protected void onHandleIntent(Intent intent) {
// Handle events on worker thread here }

View 2 Replies View Related

Android :: How To Use Parcelable - If Class Requires Additional Parameters In Constructor

May 20, 2010

I'm trying to create class with generics that will have ability to serialize its state using Parcelable interface.
The problem is that class has to contain constructor with single parameter - Parcel, but in my case I need to create class with additional parameters.
Besides, Parcelable.Creator doesn't allow to use generics.

Here is an example:

public class Sample<T> { ...

public Sample(Context ctx, SomeInterface iface, Parcel parcel) {...}

...}

What is the best practice to do it?

View 1 Replies View Related

Android :: Retrieve Saved State Of Custom View In Constructor?

Oct 12, 2009

The "View" instance currently provides a way to retrieve the saved state using the methods below, but there doesn't seem a way to retrieve the view's saved state in the constructor, or onFinishInflate. The custom view is constructed via XML, so I cannot pass the saved bundle from the Activity to the View's constructor.

Relevant methods: - protected Parcelable onSaveInstanceState() and - protected void onRestoreInstanceState(Parcelable state)

I need this because I make an asynchronous network request in a custom view constructor, and if there is a configuration (orientation) change, the custom view is getting reconstructed, and the request is getting performed again. I want to intercept the second request in the constructor. I can do this in the onRestoreInstanceState, but I need to handle this in the constructor.

It would be nice if there was a method such as getSavedState so that the decision can be made in a constructor or onFinishInflate instead of waiting for the onRestoreInstanceState trigger.

View 3 Replies View Related

Android :: Dalvik Message - Default Buffer Size Used In BufferedInputStream Constructor

Aug 17, 2010

When I used BufferedInputStream and I specify a buffer size, Dalvik gives me this warning - Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.
But right now, my buffer size is already at 8k. What am I doing wrong?

View 1 Replies View Related

Android :: What Is The Significance Of Context In Various Constructor Of Intent Class When Starting An Activity

Mar 4, 2010

I had come across a code snippet which calls for an activity without referring to any context. Before, i was considering that context is used to tell about the calling component. But as i came see that another component can be called without any reference to context, it makes me wonder what purpose it might be serving. please put some light on it.

Here is the code which calls for an activity without referring to 'context'

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

View 1 Replies View Related

App Crash Every Time Try To Call Constructor Code From Map Class

Oct 10, 2013

I'm developing an app that uses google maps, but for some reason it crashed every time I try to call the constructor code from the map class.

main
[HIGH]import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {

[Code] ......

View 2 Replies View Related

Android :: How Do I Get Some Padding Around My Checkbox

Aug 10, 2010

I have a horizontal LinearLayout. This LinearLayout has a checkbox next to another LinearLayout. The layout width/height of the checkbox is wrap_content, whereas the inner LinearLayout is fill_parent/wrap_content. The layout_weight of the inner LinearLayout is set to 1.

I've tried to add some android:padding around the checkbox to give some space around it, but no padding is given. I've also tried android:paddingLeft/Right/etc. How do I get some padding around my checkbox?

Note: I have an inner LinearLayout because I will be adding more TextViews

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight">
<CheckBox
android:id="@+id/mycheck"
android:text=""
android:layout_width="30dip"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:focusable="false"
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="wrap_content">
<TextView
android:id="@+id/mytext"
android:layout_width="fill_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:lines="1"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="italic"/>
</LinearLayout>
</LinearLayout>

View 1 Replies View Related

Android :: Padding On Shape In Progressbar

Oct 27, 2010

I'm using xml file to define progress bar. I defined padding on background shape. But this setting will be sometimes displayed correctly, sometimes not. So If I start my application or Activity with progressbar inside, there will be correctly displayed progressbar with background and 'padded' progress. Then I close my application and start it again, and, progressbar is displayed without padded background, on next start will be displayed correctly and son on ... Could you please advice possible reasons for this?

xml file:..................

View 1 Replies View Related

Android :: Padding List Items?

May 31, 2010

I have a list where i basically need a hierarchy of items. Any children of an item would be padded slightly, as to easily distinguish their parent item. How could this be achieved? Note that i could, if needed, make each parent show no children, and then when the parent is clicked, a new list containing all of it's children is loaded. This however requires more clicking to display information than i would prefer. Also, the items themselves will contain graphics and whatnot (to show a drag'n'drop button, etc), so it would be best if it visually appeared as if the item itself had a margin, rather than the contents of the item being padded.

View 1 Replies View Related

Android :: Add Padding For Background Image?

Apr 26, 2010

I have a linear layout which has a background image (a 9 patched png file). How can I add padding to left and right so that the background image does not take up the whole width? I have tried 'android:paddingLeft' and 'android:paddingRight', but that does not change anything.

CODE:.....

The whole background still stretches the whole screen width.

View 1 Replies View Related

Android :: Extra Padding On The Bottom Of My Row / Why Is So?

Sep 28, 2010

I have the following layout. This defines a row in my ListView. I noticed that the text is not centered in the row. There seems to be extra bottom padding. How can I make the text appear in the center, vertically, so there is no padding? code...

View 1 Replies View Related

Android :: What Is Difference Between Padding And Margin

Oct 18, 2010

what is the difference between padding and margin?

i want to draw a view exactly at 200 dip from the top of the screen(0,0). there are some layout in the middle.

how do i draw a view exactly at 200 dip from the top?

View 4 Replies View Related

Android :: Making Padding Dynamic In A FrameLayout

Apr 2, 2010

I'm following an example where the author hard coded a paddingTop to 370px. How do I make that paddingTop dynamic? When I run this in 2 AVDs with HVGA and WVGA80 I get the frame floating at different heights. I'd like to say something like paddingTop=80%, but that doesn't work.

View 1 Replies View Related

Android :: How To Reduce Padding Between Cells In TableLayout

Sep 12, 2010

I have a 3*3 TableLayout that contains buttons. But I cannot seem to remove the spacing between the buttons in the Table.Setting pading to zero for the buttons has no effect. Setting padding and layout_margin to zero for the TableRow has no effect. Setting layout_margin for the TableLayout has no effect.Any idea on how I can alter/remove/reduce the spacing between the cells?

View 4 Replies View Related

Android :: Difference Between View Margin And Padding?

Oct 30, 2009

Difference between View margin and padding , mPadding and mUserPadding?

View 2 Replies View Related

Android :: Need Place To Gridview Padding Or Imageview?

Oct 16, 2009

I'm doing the HelloViews Gridview tutorial and I ran into this problem.

http://grab.by/9Vn

I have a padding that I can't find where is it coming from.

XML is the following: <?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numColumns="2" android:verticalSpacing="0px" android:horizontalSpacing="0px" android:stretchMode="columnWidth"android:gravity="center" android:layout_margin="0dp" />

and in my adapter:

I can't seem to find the place where I can get rid of that padding (or margin). Pictures are 160px x 160px.

View 3 Replies View Related

Android :: How To Add Padding To Gradient <shape> In Phone

Oct 25, 2009

I have a shape with a gradient that I'm using as a divider between ListView items. I've defined it as follows:

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<gradient
android:startColor="#ccd0d3"
android:centerColor="#b6babd"
android:endColor="#ccd0d3"
android:height="1px"
android:angle="0" />

</shape>
I would like to add 6 pixels of padding on either side of the gradient, so that it doesn't extend from edge to edge of the screen.

However, no matter where I put an android:left="6px" and android:right="6px", it doesn't seem to take effect. I can put it in the <shape> element, the <gradient> element, or in a separate <padding> child of <shape>, and it doesn't change anything.

How can I add padding on the left and right of my list divider?

View 2 Replies View Related

Android :: Padding Doesn't Take Effect For Shape In XML

Aug 15, 2009

I am trying to set padding in shape declared in XML file. But whatever I set, nothing changes related to padding. If I modify any other properties, I see updated UI. But it doesn't work with padding. Could you please advice possible reasons for this?

I will provide below example of my shape.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffff" android:dashWidth="2dp"/>
<solid android:color="@color/button_white_cover" />
<corners android:radius="11dp" />
<padding android:left="1dp" android:top="20dp"
android:right="20dp" android:bottom="2dp" />
</shape>

View 1 Replies View Related

Android :: Adding Padding Between Buttons In A Linear Layout

Jan 26, 2009

I am probably missing something totally obvious, but can someone tell me how to add padding between buttons of a Linear Layout?
Code...

View 5 Replies View Related







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