android-spinner

Using to spinners, app works fine, but when the button is clicked error is displayed

僤鯓⒐⒋嵵緔 提交于 2019-12-12 05:27:05
问题 here;s the coding <Button android:id="@+id/conv" android:layout_width="150dp" android:layout_height="70dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="76dp" android:text="Convert" android:onClick="onCreate"/> public class LstActivity extends Activity { EditText et; TextView tv; Button b1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState ) { super.onCreate(savedInstanceState);

Use sharedpreferences inside class

若如初见. 提交于 2019-12-12 04:23:02
问题 I am having a problem using my shared preferences inside a class. My code and program flow: I have a Spinner inside my activity.I am implementing my own OnItemSelectedListener like this: MyOnItemSelectedListener.java public class MyOnItemSelectedListener implements OnItemSelectedListener { SharedPreferences pref; Editor editor; @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { //parent.setSelection(7); Toast.makeText(parent.getContext(), "Selected

spinner with a rectangular border

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 04:14:03
问题 I am developing an android app inn which I want to use a Spinner with a white border as shown in the image. Please help me how can I achieve the same. Thanks in advance 回答1: The best Solution for such things is to Create 9 patch image . You need to create 9 patch image(Rectangle Box) which helps you to set the spinner with different resolution. After creating 9 patch image use it as a background of the Spinner. 来源: https://stackoverflow.com/questions/24758446/spinner-with-a-rectangular-border

Two linked spinners not saving as shared preferences

空扰寡人 提交于 2019-12-12 04:05:58
问题 I am able to save one spinner as shared preferences using Spinner not saving as Shared/Saved Preference. However I need multiple spinners to be interlinked and I am having issues when i try to save them and I am not sure why. Here is how my spinners are linked. The first Spinner enables second spinner when it is selected. spinner = (Spinner)findViewById(R.id.spnMondayExercise); adapter = ArrayAdapter.createFromResource(this, R.array.Exercise, android.R.layout.simple_spinner_dropdown_item);

Gradle build error : Duplicate entry

不想你离开。 提交于 2019-12-12 03:45:47
问题 My gradle file is apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "24.0.0 rc2" defaultConfig { applicationId "com.test.test" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build

Android Spinner not responding to clicks, does not close and OnItemSelectedListener does not fire off

喜欢而已 提交于 2019-12-12 03:39:52
问题 I am developing an app in Kotlin (if you don't know about kotlin I am sure you can still help with your Android/Java experience) Details: I have a Spinner in there my app.Though it is not responding to clicks once it pops up and even shows some weird views. And because of that the OnItemSelected listener is never fired either. I start the method to update the spinner from an AsyncRealm call. Here's the code: This whole function runs, the spinner is not null, after attaching the listener, it

Populate Spinner WITHOUT Strings.xml file

孤街浪徒 提交于 2019-12-12 03:09:32
问题 So everything I have found is using the strings.xml file to populate a spinner. What I want to do is populate a spinner based on information I get back from a JSON response. I have the following code that I used to populate a table but modified it for this. However, my spinner is still blank and I get no errors besides D/ViewRootImpl: #3 mView = null Here is the code to populate the spinner: public class SecondFragment extends Fragment implements APIRequestsUtil.APIRequestResponseListener {

Passing a parameter to spinner in android

蓝咒 提交于 2019-12-12 03:08:15
问题 I have 2 spinners and first loading the values to the 1st spinner from the json response. Then select a value from 1st spinner then selected value from 1st spinner will be send to a method another method called getFilteredDescriptions() and it returns a ArrayList() called resultDescription . I want to set it as the input to the 2nd spinner. I have assign the value resultDescription to the 2nd spinner but I haven't done in correct way because I have initialized or declare. Can anyone tell me

VM Shutting Down after loading data into Custom Text Spinner

主宰稳场 提交于 2019-12-12 01:23:34
问题 I have a Fragment that shows the user the product they have selected from the previous screen. I am loading different products into it via a separate CustomProduct class that basically assigns values to the product displayed in this Fragment. It will display things like name, title, cost, description, etc. The part I'm having trouble with is retrieving the String[] array for the product sizes, i.e. Small, Medium, Large, etc. All of this works with an explicit String[] array, i.e. String[]

setText TextView inside fragment

核能气质少年 提交于 2019-12-11 23:25:04
问题 I have a fragment with a spinner, button and a textview. My spinner has a string of Mansanas and Pakwan. I can't explain it clearly. My code will just explain what i want to do. lol. Here's my code: FragmentA: public class FragmentA extends Fragment { Spinner spinner1; Button button2; TextView textView6; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragmenta, container, false); textView6 =