Questions tagged methods

Explore the latest questions and answers asked by our top developers.

How to put a reference to different variables/class properties as method parameter instead of a value?

I need to create multiple editTexts with logic to handle the format of the input. The different editTexts will bind to different variables and save to different properties of viewModel.home. The editTexts will, however, use the same logic (although different for strings, ints, doubles, etc.) and thus I want to avoid copy-pasting code. For each […]

By zorigo
Categorized as android, kotlin, methods

EditText.setError("Error Text") not showing popups

Im creating a simple login activity and am implementing some user input error checking on some EditText fields. However, the setError public method seems to not show anything or, if it is, I’m unable to view when running the app. XML for one of the EditText elements <EditText android:id="@+id/userName" android:layout_width="250dp" android:layout_height="wrap_content" android:layout_below="@+id/imageView" android:layout_alignParentStart="true" android:layout_alignParentEnd="true" android:layout_marginStart="25dp" […]

Can a method parameter contain a reference to other variable instead of containing a value?

In the code below, i’d like to generalize it so I instead of viewBinding.editText.text and can use the same method for e.g viewBinding.secondEditText.text and I’m thinking exchanging viewBinding.editText.text for a variable defined in the primary constructor, but then I’d need the variable to contain a reference to viewBinding.editText.text/viewBinding.secondEditText.text etc. instead of containing a […]

By zorigo
Categorized as android, kotlin, methods

how to get all top classes interal classes to arraylist?

i am trying to get top classes interal classes to arraylist like (android.widget) or ( , i can get (android.widget.TextView) interal classes using this code:- void printClass(Class cls) { if(cls!=null){ txt.setText(txt.getText().toString()+"n"+cls.getSimpleName()); for(Class m:cls.getDeclaredClasses()){ txt.setText(txt.getText().toString()+"n"+m.getSimpleName()); } } Source: Android Questions

By Star4Droid
Categorized as android, arraylist, class, java, methods

how to become a pro mobile and web developer?

How to become a pro mobile developer which methods or techniques is very useful I read the article about 10k thours theory but i need a proper guidance I have already 1+ years mobile developer experience and my second Question is Bs Software Engineering degree is important or Google certification or Udemy is better in […]

By Awias Rehman
Categorized as android, computer-science, methods, mobile, software-design

Call method in Fragment from some class

i’ve been working on Android App in AndroidStudio. Application has Fragment, let’s call it MainFragment, and seperate Java Class file, let’s call it SQLiteControler.class The problem is when i try to call method from Fragment in SQLiteController im getting null object reference as error Here is some minified code: MainFragment public class MainFragment extends Fragment […]

By gmijo47
Categorized as android, class, fragment, java, methods

How to register a callback for an Activity Result with Xamarin Android

Background I am developing an application that needs to browse a file manager , pick an image file and display that in an Android ImageView object. The code that starts the image file picker is this one below. private void TextView_Click(object sender, EventArgs e) { //show the file manager with extensions Intent image_intent= new Intent(Intent.ActionOpenDocument); […]

Categorized as android, c#, methods, overriding

I have two methods and getting error what should i do now

protected void onActivityResult(int requestCode, int resultCode, Intent data) here is the code for integrating Google and facebook in same Activity . When i override this method it gives me an error what should i do now Source: Android Questions

By Hamzallah shinwari
Categorized as android, java, methods, onactivityresult

how to pass variables between three different methods in java

hello I need to use value from method A() to Method C() then after call Method C() inside the method B(). please any one show me the syntax. Source: Android Questions

By Meston Enock
Categorized as android, android-studio, java, methods

Send mail after a Method fail

Is there a way I could make a simple android program to send mail instead of a toast when a method or anything goes wrong ???? like this public Class MailNoToast extends Activity{if(my method do work){Toast.MakeTest(getApllicationContext(),"u rock!",Toast.LONG_LENGTH). show();}else {sendMail();}public void sendMail{Try{}catch()}} Source: Android Questions

By Dess17
Categorized as android, java, methods
1 2 3 10

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us