Android :: How To Get Custom Xml Values
Nov 17, 2010
I want to get the number of launcher:cellWidth in xml:
CODE:.........
I know that I can get it in a Custom view by:
CODE:....................
But how Can I get it in a Activity? not a Custom view.
View 1 Replies
Aug 13, 2010
Im creating a custom layout and I want to use the text declared in the layout.xml file in my layout.
Like when I create a TextView in XML and set android:text=@string/text1 when I run the app text view automatically loads the text from android:text. So how can I access attributes declared in the layout XML file in my custom component.
View 2 Replies
View Related
Oct 30, 2013
How to make a module which sets the auto brightness to custom values like on cm or codename?
View 2 Replies
View Related
May 28, 2010
I'm pretty sure it's not viable to do what I'd like to based on some initial research, but I figured it couldn't hurt to ask the community of experts here in case someone knows a way.
I'd like to create a custom field for contacts that the user is able to edit from the main Contacts app; however, the user should only be allowed to select from a list of four specific values. A short list of string values would be ideal, but an int with a min/max range would suffice.
I'm interested in knowing if it's possible either way, but also wondering if it make sense to go this route performance wise. More specifically, would it be better to look up a contact (based on a phone number) each time a call or SMS message is received or better to store my own set of data (consisting of name, numbers, and the custom field) and just syncing contact info in a thread every so often? Or syncing contacts the first time the app is run and then registering for changes using ContentObserver?
View 1 Replies
View Related
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
Apr 16, 2010
I have a collection of strings and declared the strings individually as arrays using ArrayList<String> al=new ArrayList<String>(); and called the arrays in the program by using al=getIntent().getStringArrayListExtra("titles");
Now, instead of declaring each of the arrays i have created SongsArray.java like below...
public class SongsArray {
private String title;
private String movieName;
private String singerName;
private String imagePath;
private String mediaPath;
public String gettitle()
{
return title;
}
public void settitle(String title) {.................
View 1 Replies
View Related
Jun 24, 2010
I have a string that contains a xml structure and there are two pieces of data in separate tags that I am after.
xpath has been added since API level 8, and with me being stuck with API level 3 (old phone for you ;-)) I need a way to get the data.
Would using a regular expression commit a huge sin? ;-) The xml isn't that big...
View 1 Replies
View Related
Jul 26, 2010
One of the Preferences in my PreferenceActivity needs to get its values from a database. How do I add these values?
View 1 Replies
View Related
Sep 13, 2010
I am new to android development, My new requirement is find Latitude and longitude for current position where device is present. how I get this.
View 2 Replies
View Related
Apr 6, 2010
That's a lot of code... no time to read it over now.. but off the top of my head: look into either using a database, an Application class (that will run the whole time your app is alive), or adding extras to the Intent bundle before starting your subactivity. These are all methods to pass data around between activities.
View 4 Replies
View Related
Jun 11, 2010
Code... I want to get Session Key from here. How to get it.
View 2 Replies
View Related
Jul 5, 2010
I wanna set a textview as the values from SQLite when I click the ListView Here is my way...
View 1 Replies
View Related
Nov 17, 2010
I have searched and searched and I just can't get this code to work. I have a main.xml layout and a setting.xml. I have some values I would like the Settings.class to change in my main apps class.Three string to be exact. I have tried this simple test code in my main app class.
settings.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), Settings.class);
startActivityForResult(intent, 0);}});
//Then a function
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
super.onActivityResult(requestCode, resultCode, intent);
Bundle extras = intent.getExtras();
String value = extras.getString("myKey");
if(value!=null){
Log.d("hmmm",value);}}}
In my settings.class I have the following
returnHome.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.putExtra("myKey", "YEAH");
setResult(RESULT_OK, intent);
finish();}});
Back in main app class it is not getting logged. Like I said I have three string in the main class that I want settings class to change and send back.
View 2 Replies
View Related
Feb 11, 2010
I have an app which makes use of several layout-views. Every layout - view also got a class for it, which extend the Activity class. One class for example retrieves some database values whilst offering a search form to the user. Afterwards the user can select one of those values and he gets presented with another screen which gives similar options as the one selected. Anyways, I'd like for the first Activity to be able to send an array with data (Strings for example) to the second one. Right now I show an activity by using:
Intent i = new Intent(this, activitysName.class); startActivity(i);
I have no idea whilst using this construction how I can "initialize" the new object with the String array I want to pass to it. So how should this be achieved ? Should I be using something else instead of an Intent-Activity combination ?
View 5 Replies
View Related
Apr 16, 2010
I do not know the reason why am i getting same values of different JSON date values. Here is my code for parsing date values in JSON date format:
package com.jsondate.parsing;
import java.text.SimpleDateFormat; import java.util.Date;
import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView;
public class JSONDateParsing extends Activity {/** Called when the activity is first created. */String myString;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = new TextView(this);
//Date d = (new Date(1266029455L));
//Date d = (new Date(1266312467L));
Date d = (new Date(1266036226L));
//String s = d.getDate() + "-" + d.getMonth() + "-" + d.getYear() + d.getHours() +
d.getMinutes() + d.getSeconds();
// SimpleDateFormat sdf=new SimpleDateFormat("yyyy MMM dd @ hh:mm aa"); //Toast.makeText(this, d.toString(), Toast.LENGTH_SHORT);
Log.e("Value:", d.toString());
myString = d.toString();
String []words = myString.split(" ");
for(int i = 0;i < words.length; i++)
Log.e("Value:", words[i]);
myString = words[2] + "-" + words[1] + "-" + words[5] + " " + words[3];
tv.setText(myString);
setContentView(tv);
} }
View 2 Replies
View Related
Apr 9, 2009
Hello everyone, and thanks in advance for the help. What I'm trying to do is a relatively simple task, but one that doesn't seem to be working. What I'm trying to do is display the Orientation X,Y,Z coordinates on the screen in basic TextView boxes. The sensors are constantly updating my Global.myOrientation float array, and then I'm running a Timed thread (I'm very new to threading, so forgive me if it's ugly, but it gets the job done almost). In this thread I just set the value of each TextView's text to the desired value. The problem is that it only seems to work the first time.
It correctly displays whatever my initial data is, but then subsequent runs of the thread do nothign to update the onscreen values when I change the orientation of the phone. LogCat output shows me that inside the run() method, the values of Global.getOrientationX,Y,Z are being updated correctly, and that the right data is being passed to TextView. How can I get around this limitation of TextView being initialized once and then immutable?
Any assistance in fixing this, or providing an alternate solution would be greatly appreciated. Code posted below:
CODE:...............
View 3 Replies
View Related
May 8, 2010
I have trouble (example<http://groups.google.com/group/android-developers/browse_thread/threa...>) wrapping my head around styles/themes. Can somebody help me or point me to actual documentation?
Let's say I have a drawable that I want to use as the background of a layout:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle>
<gradient android:startColor="#9F9FA4" android:endColor="#66FFFFFF" android:angle="270" /> </shape>
Now I want to have a dark and a light theme. Depending on the chosen theme I want to have a different value for startColor and endColor. How do I do that? I am aware of extending themes, but what do I put into the items? How do I reference those new values then?
View 7 Replies
View Related
Aug 23, 2009
I am experimenting with orientation sensor, register it like this: SesnorManager sensor_manager = (SensorManager)getSystemService (Context.SENSOR_SERVICE); Sensor sensor_orientation = sensor_manager.getSensorList (SensorManager.SENSOR_ORIENTATION).get(0); sensor_manager.register Listener(sensor_listener, sensor_orientation, SensorManager.SENSOR_DELAY_UI); and then read the orientation values in the sensor event listener: private final SensorEventListener sensor_listener = new SensorEventListener() { ... float sensor_data_x = event.values[SensorManager.DATA_X];}
View 4 Replies
View Related
Nov 21, 2010
I am creating a Quiz application. Questions are added thru web form.I am using Mysql and ruby on rails for doing so. I would like to display the questions and its options in android application with next and previous options.I am very new to android.Can somebody please tell me how do i do this?
View 1 Replies
View Related
May 16, 2010
I am setting multiple alarms like this, with different values of id. Multiple calls to AlarmManager.setRepeating deliver the same Intent/PendingIntent extra values, but I supplied different ones.
AlarmManager alarms = (AlarmManager)context.getSystemService(
Context.ALARM_SERVICE); Intent i = new Intent(MyReceiver.ACTION_ALARM);
// "com.example.ALARM" i.putExtra(MyReceiver.EXTRA_ID, id);
// "com.example.ID", 2 PendingIntent p = PendingIntent.getBroadcast(context, 0, i, 0);
alarms.setRepeating(AlarmManager.RTC_WAKEUP, nextMillis, 300000, p); // 5 mins
And receiving them like this:
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION_ALARM)) {
// It's time to sound/show an alarm
final long id = intent.getLongExtra(EXTRA_ID, -1);
The alarm is delivered to my receiver at the right times, but often with EXTRA_ID set to the wrong value: it's a value that I have used at some point, just not the one that I wanted delivered at that particular time.
View 1 Replies
View Related
Sep 13, 2010
I have a marker on the map using an Overlay. I also have access to the compass sensor which I'm able to show a textView with the orientation values (0 to 359). How can I apply this values to the marker? (which is a drawable). I already have a MAtrix created but when I insert the orientation value gives me an error, here it is:
GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6),
(int) (newLocation.getLongitude() * 1E6)); Paint paint = new Paint();
Point pt = new Point(); mapView.getProjection().toPixels(geopoint, pt);
Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.user2);
Matrix matrix = new Matrix(); matrix.postTranslate(-25, -25);
matrix.postRotate(direction); matrix.postTranslate(pt.x, pt.y);
paint.setAntiAlias(true); paint.setFilterBitmap(true);
int width = bmp.getWidth(); int height = bmp.getHeight();
Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true);
BitmapDrawable icon = new BitmapDrawable(changedBitmap);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
userOverlay useroverlay = new userOverlay(icon); useroverlay.addItem(item);
mapView.getOverlays().add(useroverlay);
I used the value retrieved from the sensor on "direction" but it doesn't work.
View 5 Replies
View Related
Jun 15, 2010
I need to pass data's (String) from one screen to another screen. At the time of button click i need to pass values from first screen to the next screen.
View 3 Replies
View Related
Nov 22, 2010
I am developing an android application based on web services. How can I run query (server using php and MySQL) based on the item clicked and get the result from the web. I also want to show some values as list (List layout). Is there anyway to accomplish this?
View 1 Replies
View Related
Oct 14, 2010
I develop app and I need to store and read ( read every 60 seconds, store rare ) data. What is the most easy way to achieve this?
View 1 Replies
View Related
Sep 27, 2010
I create database using sqlite in command prompt. In my login screen user can enter loginid and password. then click the login button. while click the button I need to check that ..if login successful I need to retrieve other details from the same table . How can i achieve this. is there any sample code...
View 4 Replies
View Related
Jul 8, 2009
I was wondering if it is possible to start the gps receiver on the phone if the current activity is not a mapactivity. I am displaying a listview and when I start the gps I get the last location found correctly, however the gps indicator never appears on top of the phone's display even if I wait or restart this activity. The location of the gps stays the some. The gps indicator appears on top only if I enter an activity where a mapview is displayed. If I wait in the map activity for a little while then If I go back to my other activity and request the location there, then the location is updated with the last value that it had before exiting the map view. It never gets updated If I move around after that, though..
View 2 Replies
View Related
May 31, 2010
How can i pass values of one activity to another?
View 3 Replies
View Related
Feb 6, 2010
I seriously need help with a quite strange problem. I created a client which communicates with a server. Therefore, I have three classes. An activity providing a nice dialog to configure some data, a background service which checks the connection status periodically and a server class which handles the socket connection. Originally, the background service owned a server connection object but because I could not manage to provide data from the activity to the service, I decided to create the server connection class as singleton. The user is now able to change data in the activity (IP, Port, Username, Password) which shall be transmitted to the server object, if the save button is pressed. The data is read correctly, the activity calls the setter of the server class and the logcat also says that this data is correctly applied to the variable that stores the data in the server class. However, if I try to start the socket connection still the old values are stored in my variables although they've been overwritten before. What I am doing wrong, or how can I fix this?
View 13 Replies
View Related
Nov 12, 2009
I'm a new Droid owner, and being a mechanical engineer, I could use a good unit converter app that includes conversion of harness units (Vickers, Brinell, Rockwell, etc.). I've run across quite a few unit conversion apps, but without installing them, I don't know if they include hardness conversions.
View 1 Replies
View Related
Oct 13, 2009
I have made an application of reading all contacts and its values from android address book, but i am not able to read all the vlaues of contact. Currently i am getting only its name and mobile number. How can i get its all phone numbers,all eamil values and address values?
View 1 Replies
View Related