Questions tagged [getstring]

150 questions
3
votes
2 answers

java resultset.getstring("col_name") query

I have a simple query regarding ResultSet.getString() method in java for JDBC. Suppose the value in the Database column is having a \ which is javas escape character e.g. \n or \t etc. When i retrieve the value as getString() i see one more escape…
Anubhab
  • 1,736
  • 2
  • 18
  • 28
2
votes
2 answers

How can I use name of string instead of content of string?

Normally, I use String[] arrayName = getResources().getStringArray(R.array.name_array); So are there any ways to use String[] arrayName = getResources().getStringArray(R.array.NAME); with NAME is string (String NAME = "name_array";)?
2
votes
1 answer

Android getString performance issue in adapter holder

I access string resource in adapter. But I have a concern Which way to be usefull or better performance? First way seems like not usefull but does it create problems in terms of performance? 1; Context context; public Adapter(Context context){ …
kibar
  • 822
  • 3
  • 17
  • 37
2
votes
1 answer

getString is given not a valid String. -android-

I have: Toast.makeText(NewChatActivity.this, getString(R.string.invitation_sent_prompt, contact), Toast.LENGTH_SHORT).show(); (contact, is a String variable, as well as subForm ) and: new…
Shudy
  • 7,806
  • 19
  • 63
  • 98
2
votes
0 answers

JDBC getString(i) significant slower in server

I have an Oracle 12c database query, which pulls a table of 13 columns and more than 114470 rows in a daily basis. I was not concerned with this issue until I moved the same code from my DEV server to my PROD server. On my DEV environment the query…
Ziza
  • 161
  • 1
  • 4
2
votes
2 answers

getString from ResultSet with spaces

I'm managing a JDBC database with Servlets/JSPs and one of the attributes I have in a table is a string which may or may not have spaces in between words. I have one JSP to display all the information and another one to edit it, on both I perform…
localhostloco
  • 27
  • 1
  • 6
2
votes
3 answers

android application crashes at the getString() line

this is my strings.xml out I am trying to call this string in my main activity like below: final String net = getString(R.string.alert_internet); I also checked my R.java file…
Suhrahj Rothgar
  • 283
  • 6
  • 21
2
votes
0 answers

Android: getString causes NPE in Application subclass

I'm experiencing a weird bug in my application. I have a MyApplication class extending Application. In its onCreate() method I initialize some 3rd party libs which require API keys stored in a string resource file. Basically, it works fine on…
2
votes
3 answers

onPostExecute getResources().getString NullPointerException

When I run below code in the onPostExecute, it gives me an exception: java.lang.NullPointerException getApplicationContext().getResources().getString(R.string.lbl_sth); getBaseContext().getResources().getString(R.string.lbl_sth); R.string.lbl_sth…
fordiy
  • 264
  • 5
  • 10
1
vote
2 answers

XML error when trying to read string from preferences in android

In my app, I'm using getPreferences(MODE_PRIVATE) with putString(), putBoolean(), etc. to save app state. The amount of data is not great - possible a few strings and a couple of boolean values. I never get any errors when saving the data, however…
Aleks G
  • 56,435
  • 29
  • 168
  • 265
1
vote
1 answer

getString from a few SharedPreferences file and create listView

First - sorry for my english;) I'am writing profile manager for Android and i want getString from a few SharedPreferences file and create listView. It's part of my code: private static final String PN = "profile_name"; private EditTextPreference…
1
vote
4 answers

Why doesn't extra.getString() == "edit" work, but extra.getInt() == 1 work?

Here's the gist of my problem code: String from = extra.getString("from"); Log.d("Cat", from); //debugs as edit if(from == "edit") { Log.d("Cat", "Edit"); } else { Log.d("Cat", "Not Edit"); } It would go to "Not Edit" In the calling activity I…
spuppett
  • 547
  • 10
  • 26
1
vote
1 answer

What's better in a loop - context.getString() or a variable?

I use some strings which are defined in a resource file. What is better in terms of resource usage and performance? Call context.getString(stringId) every single loop or store the context.getString(stringId) in a variable outside of the loop and…
hitzi
  • 852
  • 2
  • 10
  • 23
1
vote
1 answer

I am receiving the following error: expected identifier or '('

The error is referencing the following line of code: tenant[i].name = get_string("Enter the residents name: "); and has an arrow pointing at the period . between tenant[i] and name. I am not sure what I am missing. typedef struct { string…
Dansah
  • 11
  • 2
1
vote
2 answers

Is there a way to use getString inside a util?

I succeeded in getString using getSystem. But I want to know how to use local string. If you know the answer to this problem, can you help me? Thanks in advance for those of you who know the answer. class QList { companion object { val…
온송정
  • 37
  • 6
1
2
3
9 10