Android :: DIP Scale And Setting Values In Code

Jul 7, 2009

I have read about using a 'dip' scale rather than just px, this is straightforward to implement in XML. But how do I adjust values accordingly in the java code? For example:

tv.setTextSize(20)

will result in text of size 20 px right? What's the quickest way of making this 20 dip, other than adding a resource?

Android :: DIP Scale and Setting Values in Code


Android : Put All Code Relating To Creating Time - Date Dialogs Setting Values

Sep 24, 2010

I'm currently learning android and java, and I am having some issues with importing a java file.

I am working with the time and date example in the android api demos, and I want to put all the code relating to creating the time and date dialogs setting the values etc into a separate java file, and in my main java file run when the application starts, just declare the buttons and onclick events.

What is the best way to do this? Do I need to put all the code inside a class(that extends activity) or method? How do I use this inside my main class. Code...

View 1 Replies View Related

Jelly Bean :: Animation Scale Setting?

Nov 5, 2013

I turned it off and didnt notice a difference. What animation is it for?

View 1 Replies View Related

Android :: Need To Obfuscate Code For Small Scale Paid Application

Nov 3, 2010

I'm nearing the end of a small project to develop an android app. As a first time developer, and a one-man band, I am anticipating selling it at a low price point. I have followed some of the discussions on the Android blog and elsewhere about licensing and obfuscation, and I am in two minds. Part of me thinks that I have spent a long time on the development, so why should I make it easy for people to pirate the app? The other part thinks that it could be fairly time consuming to implement licensing and obfuscation, stop people using the app from non-google supported countries and wondering how much of an issue it is anyway for a small app.

However, if you google even a small app and add .apk at the end the number of "warez" downloads is fairly shocking if it's true. Just wondering whether anyone has any opinions either way, about the impact of piracy on a small developer. I'm not expecting to make my fortune with this app, and would aim for I guess 1000 downloads or so. I may even release an ad-supported version some way down the line depending on how sales held up, which would solve most of the problem I guess.

View 1 Replies View Related

Android :: Licensing - Setting Server Response Values Per Application

Aug 5, 2010

So I've just published my first paid app to the Market and I used the new LVL with the default ServerManagedPolicy. On working through the docs and getting it set up I noted the references to the server response extras VT, GT, GR & UT, and the impression I got from quotes such as "a typical value would be 5 or more days.", "a typical value would be "10" or higher." etc., was that we would have some way of setting these server response values per app when we upload them to the Market. Either I'm missing something, or there does not seem to be a way to set these in the Developer Console that I can see? If we can't set these, it's not really a 'managed' policy at all, but a random 'whatever the server decides to respond with' policy, particularly given the vagueness of the documentation.

I really hate phone home licensing, and am only using it because it seems to be the only option to combat Android piracy. Ideally I want to just check once when the app is first launched, once a day or two later to check they didn't return it, then cache that for 6 months (forever?) to minimize disruption to my users. Is this kind of thing possible with the ServerManagedPolicy or do I have the wrong end of the stick about the 'management' features and have to roll my own? On a side note, if I can't buy my own app, how can I test my licensing is working in the wild? I got several 'NOT_LICENSED' responses in testing even when I set it to return 'LICENSED' in the console, so I'm not 100% convinced of its stability and want to actually see how well it works outside the testing environment, but apparently can't buy my own app to do so!

View 4 Replies View Related

Android :: Defined Color Under Res / Values Not Usable In Code

Jul 15, 2010

I defined a white color in mycolors.xml under res/values as below:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="my_white">#ffffffff</color>
</resources>

In my code, I set the text color of a TextView as the white color I defined:

TextView myText = (TextView) findViewById(R.id.my_text);
myText.setTextColor(R.color.my_white);

But the text in the TextView turned out to be a black color. When I use @color/my_white in layout xml files, it works fine. I check the generate R.java, and see: public static final int my_white=0x7f070025;

View 3 Replies View Related

Android :: Access Values Defined In A Java Manifest From Code?

Feb 4, 2010

Can I access the values defined in a java manifest from code?

View 3 Replies View Related

Android :: Bugs Of WebView - Could Not Handle Color Values When Use HTML Code

Feb 11, 2009

I don't know where to put the bug report of APIs.

I use WebView to display some pages in my dictionary software. I met some problems with WebView.

1) could not handle the color values When I use the HTML code: <font color="#00FF00"></font> the WebView could not handle this type of tags. But <font color="red"></font> can work well.

This bug exist both in SDK1.0 & SDK1.1

2) Chinese Char: I use UTF-8 as the charset, and if there exist some Chinese chars, then this HTML code could not be displayed in WebView: <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body> <p><font color="red">[-------- 美国 统词典[双解] --------]</font></p> </body> </html>

This bug exists in SDK1.1.

View 11 Replies View Related

Android :: Android - Avoiding Conflict Of Setting Text Field Values

Nov 17, 2010

I'm writing an Android application that allows a user to maintain a list of products. In the EnterProductData activity, the user can enter information about the product into form fields, which will then save the info to a SQLite DB. The EnterProductData activity also allows the user to initiate a barcode scan via the Barcode Scanner app in order to capture the UPC code. The problem I'm facing is trying to set the value of the UPC text field in onActivityResult() once the barcode scan activity is complete and returns the value.

What is ending up happening is my onResume() method is calling a function (populateFields()) that sets the values of the text fields to whatever is currently saved in the DB. And this seems to be happening after onActivityResult() is called. This means the scanned UPC is set as the text field value, only for an empty value to be set to it immediately after. The line of code to blame is commented with asterisks next to it. I imagine that if I immediately save the scanned UPC to the DB in the onActivityResult() method, I can avoid this problem, but that doesn't seem to be the best practice, in my opinion. Can someone advise me on what I should do?

EnterProductData.java
public class EnterProductData extends Activity {
private Button mScanButton;
private EditText mUPC;
private Button mSaveButton;
private Long mRowId;
private DbAdapter mDbHelper;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new DbAdapter(this);
mDbHelper.open();
setContentView(R.layout.enter_product_data);
mUPC = (EditText) findViewById(R.id.UPC);
mScanButton = (Button) findViewById(R.id.scanButton);
mSaveButton = (Button) findViewById(R.id.saveButton);

mRowId = (savedInstanceState == null) ? null :
(Long) savedInstanceState.getSerializable(DbAdapter.KEY_PRODUCT_ROWID);
if (mRowId == null) {
Bundle extras = getIntent().getExtras();
mRowId = extras != null ? extras.getLong(DbAdapter.KEY_PRODUCT_ROWID): null;}
populateFields();
mScanButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
IntentIntegrator.initiateScan(EnterProductData.this);}});
mSaveButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setResult(RESULT_OK);
finish();}});
}private void populateFields() {
if (mRowId != null) {
Cursor product = mDbHelper.fetchProduct(mRowId);
startManagingCursor(product);
mUPC.setText(product.getString(
product.getColumnIndexOrThrow(DbAdapter.KEY_UPC))); //******}
}@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
saveState();
outState.putSerializable(DbAdapter.KEY_PRODUCT_ROWID, mRowId);
}@Override
protected void onPause() {
super.onPause();
saveState();
}@Override
protected void onResume() {
super.onResume();
populateFields();
}private void saveState() {String upc= mUPC.getText().toString();
if (mRowId == null) {
long id = mDbHelper.createProduct(mRowId, UPC);
if (id > 0) mRowId = id;
}} else {mDbHelper.updateProduct(mRowId, UPC);
}}protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode) {
case IntentIntegrator.REQUEST_CODE: {
if (resultCode != RESULT_CANCELED) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (scanResult != null) {
String upc = scanResult.getContents();
mUPC.setText(upc);
}}break;
}}}}

View 1 Replies View Related

Android :: Setting Values And Display Text In Android Spinner

May 31, 2010

I need help in setting up value and display text in spinner. As per now I am populating my spinner by array adapter e.g. mySpinner.setAdapter(myAdapter);

And as far as I know after doing this the display text and the value of spinner at same position is same. The other attribute that I can get from spinner is the position on the item. Now in my case I want to make spinner like the drop down box, which we have in .NET. Which holds a text and value. Where as text is displayed and value is at back end. So if I change drop down box , I can either use its selected text or value. But its not happening in android spinner case.

For Example:

Text Value
Cat 10
Mountain 5
Stone 9
Fish 14
River 13
Loin 17

So from above array I am only displaying non-living objects text, and what I want is that when user select them I get there value i.e. like when Mountain selected I get 5. I hope this example made my question a bit more clear.

View 2 Replies View Related

General :: Always Scale To Max Frequency Or Scale It Based On CPU

Jun 30, 2012

the cpu scaling of Android.. First, do the system use the lowest frequency when not in use? Aka screem off..After i unlock the phone do it always scale to max frequency or scale it based on the cpu needed? For example write a text makes the phone use thr same freq as playing a game?

View 1 Replies View Related

Android :: Store Values In SharedPreferences In Library Code / Have It To Projects That Include Library?

Nov 11, 2010

I have an Android library project that makes calls to PreferencesManager.getDefaultSharedPreferences.

I have 2 version of my app, paid/free, and they are not able to access the preferences stored by the library code.

Can someone tell me the right way to store values in SharedPreferences in library code and have the values available to projects that include the library?

View 2 Replies View Related

Android :: Setting Wallpaper Through Code

Jun 14, 2010

I was trying to make an app which also had the facility to let user select wallpaper he would like to set. I have managed this by calling the Gallery Intent. Once the user selects a specific image, the data path of the image is returned to me which then i preview to the user by setting the image onto an imageview.

The problem crops up when the image size (and/or resolution) is greater than what android expects. This results in failure of my module.

And as if this was not enough, wen the user tries to select some other wallpaper(and in my test case the "other" wallpaper was also of size >700kb) then the app crashes with the "OutOfMemoryException"...

For Gallery Intent i use:

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

For setting the wallpaper i use:

CODE:.......

So i have 2 problems to deal with:

How to crop the image before setting it as wallpaper...Cant understand y OutOfMemoryException is thrown, coz none of my image sizes exceed even 1mb... and i guess the VM budget in case Of N1 is 24Mb if m not mistaken...

View 1 Replies View Related

Android :: Setting Up Code For Different Runtimes

Oct 18, 2010

I am working on an Android application that is supposed to run on Android 1.5 and later devices. I am using RawContacts.CONTENT_URI enumeration for registering a ContentObserver in my application subclass. Now, RawContacts was introduced in Eclair and running this code on Android devices having runtime less than 2.0, gives java.lang.VerifyError. For older devices, I have to use Contacts.CONTENT_URI.

So to fix this, I've put something like the following in my code:

CODE:.......

I am still getting java.lang.VerifiyErrors.

How do I setup my code for different runtimes?

View 1 Replies View Related

Android :: Setting Different Browser Homepage Through Code Possible?

Jun 12, 2009

Can I set a different Browser Homepage through code? If so then how? Need info about this urgently.

View 5 Replies View Related

Android :: Setting Activity Orientation By Code?

Nov 24, 2010

It is possible to set the orientation of an activity in the manifest file. but is it also possible to do it from code? if so, how?

View 2 Replies View Related

Android :: Setting Preferred Home Activity From Application Code

Jan 7, 2010

I'm trying to have my home-screen application register itself as the default home-screen so the user is not prompted with the IntentResolver's list of all the available home-activities.

This is my code:

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

I have the android.permission.SET_PREFERRED_APPLICATIONS set in the manifest. After executing the code above, the logs claim things have been added like expected (same logs as when I tick off "Make default" from IntentResolver's list). However, when I proceed by clicking home, the list still shows up and the logs say:

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

So it seems the resolver deletes the default entry. Am I doing something wrong, or is this a security measure? What are the ideas behind this?

View 2 Replies View Related

Android :: Clear Defaults By Code - After Setting Use By Default For This Action

Mar 10, 2009

I'm playing with the alternative Home app that comes with the SDK.

I can set this as default for 'Home' action.

I can unset this by -->Setting->Manage Application->My Alternative Home-> "clear defaults"

Question:

How to do this "clear defaults" by code?

I've browsed the forums but cannot find an answer.

View 2 Replies View Related

Android : Setting A Debug Breakpoint At First Line Never Runs Through Code In Class

Jul 21, 2010

I set a toggle breakpoint at line 36 of the main class, of APIDemos 8, the debug begins at the OnCreate but never processes another line in the class. Why is that?

Here's the code starting a line 36. Code...

View 1 Replies View Related

HTC EVO 4G :: Area Code Setting On The Phone?

Jul 23, 2010

in my area code, i have to dial it before dialing a local number. is there a setting on the phone (evo4g) that will automatically place the area code infront of a 7 digit dialed number?

View 5 Replies View Related

General :: How To Edit Default Values Of Memory Min-free Values Of Rom Reside

Apr 9, 2014

I want to ask where does the defaults values of memory min-free values of a Rom reside? I mean what file I would have to edit to edit those values?

View 1 Replies View Related

Android :: How To Scale A Web View

Nov 2, 2010

How can I set the scaling in a web view (or any view at all)? I have a box of 200 and 200, for example. If I apply a web view to it, a web view bigger than the box, it will give me scrollbars. I am seeking for a way to scale the content in order for the webView to fit the box.

Assume that I know the dimesions of the box, and ALSO the dimensions of the WebView.

View 1 Replies View Related

Android :: Scale Down Video Playback

Nov 9, 2010

How to scale down a video playback as there is a memory constraint and the video playback uses software codecs...

View 3 Replies View Related

Android :: Scale & Translate Animation

Nov 11, 2010

I require an animation for an image in my application.The image should start coming from the top left corner till the middle of screen. The image size will be smaller at the initial stage. While coming to the middle of the screen, its size should increase(i.e. scaling should take place). Image should not go back to its original position. It should be placed at the middle of the screen itself after the animation.

View 1 Replies View Related

Android :: Make Digital Scale App?

Sep 8, 2009

there is anyway you can make a Digital scale app? or if anyone can please , Let me know if it's possible willing to pay someone if so. My family owns a jewelry shop and it would be convenient to use my phone to weigh jewelry or gold out

View 2 Replies View Related

Android :: Change Tab Image Scale?

Nov 3, 2010

I have a tab layout with drawable resources as tab images.
In landscape mode everything fine. But in portrait mode images doesn't have some margin from tabs. How I can change images scale or how to set some margin to image? I don't want use fixed size, don't think that it is right way.

Here is my layout code...

Here is tab creation code...

View 1 Replies View Related

Android :: Want To Scale View Dynamically

Sep 21, 2010

I want to display 4 frames in layout which contains customized views.when ever i clicked on one frame it has to occupy total screen. please let me know how to do .

View 2 Replies View Related

Android :: Best Way To Scale A Bitmap In A View?

Mar 24, 2010

I have a custom view which is drawing some bitmaps on screen. I want to scale the bitmaps depending on some sensor data. Can anyone suggest to me the best way (performance wise) to scale the bitmaps.

Right now I'm creating the bitmaps in the constructor of the view but if I start to scale it in the onDraw method I believe I'll just be re-drawing the bitmaps (Which will be a memory / cpu hog).

View 1 Replies View Related

Android :: Possible To Change Scale Of Sp Unit?

Oct 6, 2010

In my XML I can set textSize="18sp". Is it possible to change the scale of the sp unit which would affect all sp sizes but not affect dp sizes?

View 1 Replies View Related

Android XML Layout Auto Scale?

Jan 6, 2014

on different screen size, my layout becomes smaller than expected. So is there any way to make the layout keep the same ratio on all screen? in other word how can I do scaling my layout ?

I think that my layout using drawable-mdpi Instead of drawable xhdpi.

Mylayout:
[HIGH]
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical"
android:layout_gravity="center_vertical"

[code]...

View 2 Replies View Related







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