These two strings walk into a bar... - MDA, XDA, 1010 General

Two strings walk into a bar. The first one says, "Barkeep, I'll have a gin and tonic."
Second string says, "Hey, that sounds good, I'll have one too.faklshfshe98Y)#Pnufdy80qbnw35u89HkLBEOHGP IUYR#oui#Ghibfsgey78iAhurq29iY UI*3ry9024hrneu89r5ji2'sdaiofse7598- U(3ijnrioapy8irjn423lo8*Y*()*#YRHRJNFJKL^*@#heui0U
#NBU(*DH#(_JIDJ()ARH#JPF*&YG#keowfpy8q0938h4nklj*(H#&#Buydole9uq07hD#*()HD#*O*F)P$^GB DV E#(*YRE#HRJ$#)"
First string says, "Excuse my friend, he isn't null terminated."

And there was I, expecting "Ouch... it was an iron bar"
:lol:

And, in reality, the slack would ofcourse contain your PGP passphrase and some of yesterday's reading on alt.sex.stories.

Related

[Q] How to change SMS Colors/Attributes in Android: Nexus 1 Build.

Believe me, I've looked.
I'm working with a nexus build and I'm becoming more and more curious about making it truly mine! The ROM itself runs better than anything else that I've tried, but it isn't quite as brilliant and colorful as I'd like it to be.
I've given myself a denim notification bar with a painting for my status bar background, and a custom status bar close on.
So, I've poked around the file system a bit and get the basic idea of the structure.
I've extracted the MMS.apk and have made a few minor changes to a couple notification colors. But what I'm really looking to do is add colored text bubbles and black out the back ground.
Yes, I'm aware that I can just D/L one of the SMS apps from the market, but I want to have control over the final product. (I'm a big fan of textures, not just colors)
I'm attempting to read the android manifesto with little success as I don't have a strong background in programming. I've d/led a XML Text editor but I continue to get an error that ends in "hexadecimal value 0x03, is an invalid character. Line 1, position 1." I get that error on every XML file I try to open.
So I turned to the almighty google, but had little success in understanding the language that most people were speaking in.
I'm willing to learn and go the distance, but a little direction would be awesome!
Thanks XDA! You guys rock!
Not to be a bother but... Bump!
This sounds awsome.. how did u change the status bar Oo i want to do that by myself too >.<
would it be possible to change shortcuts on the standard keyboard that way too? :O
not to veer off subject but figured id ask. im also using the nexus build and cant seem to send mms. any suggestions?

Help with spinner

So this is actually help making an app not a ROM. I am trying to use a spinner in my app as a drop down menu.
Here is the xml code:
<Spinner
android:id="@+id/fromSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:spinnerMode="dropdown"
android:entries="@array/from_array" />
Here is the Java code:
Spinner fromSpinner = (Spinner) findViewById(R.id.fromSpinner);
Spinner toSpinner = (Spinner) findViewById(R.id.toSpinner);
ArrayAdapter<String> toAdapter = new ArrayAdapter<String>(this, R.id.toSpinner, R.array.to_array);
toSpinner.setAdapter(toAdapter);
ArrayAdapter<String> fromAdapter = new ArrayAdapter<String>(this, R.id.fromSpinner, R.array.from_array);
fromSpinner.setAdapter(fromAdapter);
String toCurrency = (String) toSpinner.getSelectedItem();
String fromCurrency = (String) fromSpinner.getSelectedItem();
I'm not sure what the adapters do but I think I need them. Anyway toCurrency and fromCurrency aren't getting the values they are supposed to get. Anyone know what I am doing wrong. I am a complete noob say it may be something really dumb.
Don't know if this is helpful. Just put the source for the whole app at https://github.com/Dmobbjr/CurrencyCalculator
Really? I know some developers here could figure this out in ~10 minutes.
I'm not able to look deeper but it would help for next time if you could post the value you are getting and the value that should be there.
I'm going to guess you are getting either the first element in the array or null?
You haven't selected a value anywhere and there is no evidence of a user interaction before you try and get the selected value so either there is no value selected or the first element in the array is selected (by default) and you are getting its value.
Have you looked through the documentation for Spinners in the API Guides section of the Android Developers website? I can tell the answer is no because if you had you would know why you need the Adapters.
Kavrocks said:
I'm not able to look deeper but it would help for next time if you could post the value you are getting and the value that should be there.
I'm going to guess you are getting either the first element in the array or null?
You haven't selected a value anywhere and there is no evidence of a user interaction before you try and get the selected value so either there is no value selected or the first element in the array is selected (by default) and you are getting its value.
Have you looked through the documentation for Spinners in the API Guides section of the Android Developers website? I can tell the answer is no because if you had you would know why you need the Adapters.
Click to expand...
Click to collapse
I will change it to see what the value is later but I know it is not getting the value of the first element.
The user interaction happens before any of the code above is executed. I assumed that when I create the spinners and adapters in java it just takes what was already selected. Do I have to initialize the spinners and adapters before user selection?
Also I did read the documentation which is why I even knew about adapters but I am still a noob so some of the docs can be pretty confusing.
dmobbjr said:
I will change it to see what the value is later but I know it is not getting the value of the first element.
The user interaction happens before any of the code above is executed. I assumed that when I create the spinners and adapters in java it just takes what was already selected. Do I have to initialize the spinners and adapters before user selection?
Click to expand...
Click to collapse
The spinner needs to be initialised with data before the user selects it otherwise it would be empty. That's what the ArrayAdapter in your OP is for (which is explained in the API Guides section on spinners), however the android:entries attribute in your xml file is also adding data to the spinner so you have redundant code.
The getSelectedItem() will return an Object containing the currently selected item but as you are changing the data in the spinner beforehand this could be altering the data in the selected item position.
I recommend you remove the android:entries attribute and move the code except for the getSelectedItem() lines to the onCreate() method of your Activity.
You really need to provide more info for me about what is happening for me to help. I can't view the source on github at the moment.
If I implement the spinners in onCreate(), how do I access them from my button's onClick() method. Wouldn't the spinners be local to the onCreate method and therefore not accessible outside of it?
dmobbjr said:
If I implement the spinners in onCreate(), how do I access them from my button's onClick() method. Wouldn't the spinners be local to the onCreate method and therefore not accessible outside of it?
Click to expand...
Click to collapse
You aren't implementing them in onCreate(), they are implemented in xml which is normally inflated in onCreate() when you call setContentView(). All you are doing is adding the data to them in onCreate(). After the layout is inflated everything in that layout file is global (can be accessed anywhere) to that class.
You can get a reference to them anywhere in your code, providing the layout that contains them has been inflated into memory, using findViewById() and passing in the id of the spinner you want to get a reference to.
You can declare a class variable to store the reference to these and then just get the reference once in onCreate() and access it anywhere else in your code, ie. in onClick(), instead of having persistant calls to findViewById(). This approach is more efficient and cleaner.
When I try to call findViewById(toSpinner).getSelectedItem() The compiler says it can't resolve toSpinner as a variable. When I try to call R.id.toSpinner.getSelectedItem() it says it can't invoke getSelectedItem() on and int. I still cant access the spinners from within my onClick(). Sorry for the extreme noobishness but I just clearly do not know as much java as I should.
dmobbjr said:
When I try to call findViewById(toSpinner).getSelectedItem() The compiler says it can't resolve toSpinner as a variable. When I try to call R.id.toSpinner.getSelectedItem() it says it can't invoke getSelectedItem() on and int. I still cant access the spinners from within my onClick(). Sorry for the extreme noobishness but I just clearly do not know as much java as I should.
Click to expand...
Click to collapse
You are calling findViewById() returns a View object, you can't call getSelectedItem() on a View object. You first need to cast the View returned by findViewById to a spinner and then call getSelectedItem() on the spinner.
R.id.toSpinner is just an integer value pointing to a resource.
I already pointed out how you should go about calling getSelectedItem() on your spinner.
You can declare a class variable to store the reference to these and then just get the reference once in onCreate() and access it anywhere else in your code, ie. in onClick(), instead of having persistant calls to findViewById(). This approach is more efficient and cleaner.
Click to expand...
Click to collapse
I'll write the outline of the code you need for you.
Code:
public class TestActivity extends Activity {
private Spinner toSpinner;
public void onCreate() {
toSpinner = (Spinner) findViewById(R.id.toSpinner);
}
public void onClick() {
toSpinner.getSelectedItem();
}
}

Better than equalsIgnoreCase?

I am trying to make this application in which user needs to type in keyword. I would like to make it so that if user inputs, for example "lessons", string, with name "lessons list" would still appear, because we are talking about lessons. Maybe you have any tips, or maybe there are any android api's functions that would look not for the ideal match of strings, but for relatively close match of strings.
Thanks.
str1.contains(str2) is all you need (str1 is your string to compare, and str2 is your keyword).
Note that uppercase and lowercase characters aren't the same, so you should match them: str1.toLowerCase().contains(str2.toLowerCase()).

[Q] Best Practices for Switching Between Fragments?

I'm wondering if I am doing Fragment navigation incorrectly. For the most part, my app is a series of full-screen fragments, and to get to the next one, I create a FragmentTransaction and then replace().
The problem is, occasionally, if I spam the screen with touch input, Fragments behind the current one will have onClick() called.
Is there something I need to do when replacing that I might have overlooked? How could views behind the Fragment I am looking at be recieving clicks?
What are the best practices for fragment switching/navigation?
(P.S. is this the best forum for this time op question?)

Some Android app designing help for a noobie

Hey guys, I will try to be concise.
I decided to do an Android app for my final degree project. I followed all the bucky's videos and I have been playing for a couple of weeks with some additional material (text to speech, external databases, creating my own server, php...). So I think I've got the basics.
Okay, here's the problem. I decided to make an app which, basically, includes 3 types of "exams". I will follow the users progression thanks to a learning algorithm and I will purpose different kind of activities according to his/her weak points. The exercises idea is pretty basic (because I want to make it really easy for anyone to afterwards add their own exercises). It will be an image with four options, and just one of them can be selected as the correct one. Each exam will be composed of 20 exercises, and each "individual screen" will have the following elements:
- The image (different for each question)
- The possible solutions (different for each question)
- A dropdown menu (The same for all questions)
- 2 arrows for going to the next and previous exercise (the same for all questions, except for the first and the last)
- Two rows, with 10 cells(squares) per row, as a navigating tool for the user ( so if the user clicks on the third cell, the third exercise of the exam will be displayed. I will probably change the colour of the cell if the user has already selected an option or not) (The same for all questions, except for the color probably)
The squeleton of the APP is more or less done. Users can register, login, my DB is working perfectly, the "selection screen" is done, with different ways of receiving help (text and audio). In other words, the next step is necessarily making the exercised themselves. I have enough time, but I really want to know which is the best way to proceed. I don't mind failing a couple of times (as long as I learn), but I would love to know your opinions.
Each exercise is a different fragment? I mean, all of them have the same structure, is there anyway to create a kind of "base" class for an exercise, as only the image and the options do change from one exercise to the other? The menu, the arrows and the navigation bar are the same.
Any opinions and ideas are totally welcome.
PS: Sorry for my terrible english, is not my mother language.

Categories

Resources