[Solved] Translate Objective-C code to recognize links to Java for Android [closed]

This may work: import java.net.URL; import java.util.List; String input = /* text from edit text */; String[] words = input.split(“\\s”); List<URL> urls; for (String s : words) { try { urls.add(new URL(s)); } catch (MalformedURLException e) { // not a url } } // urls contains all urls from ‘input’. 1 solved Translate Objective-C code … Read more

[Solved] java.lang.NumberFormatException: Invalid int: “24 pm” [closed]

You can do the following : if (time != null && !time.equals(“”)) { StringTokenizer st = new StringTokenizer(time, “:”); String timeHour = st.nextToken(); String timeMinute = st.nextToken(); timePickDialog = new TimePickerDialog(v.getContext(), new TimePickHandler(), Integer.parseInt(timeHour), Integer.parseInt(timeMinute.replace(” am”,””).replace(” pm”,””)), true); } to replace both ” am” and ” pm” with “”. 5 solved java.lang.NumberFormatException: Invalid int: “24 … Read more

[Solved] No response from jsonArray request [closed]

1. Initialize your adapter and set it to RecyclerView from onCreate() method. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Initializing Views recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView.setHasFixedSize(true); layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); listcollege = new ArrayList<>(); adapter = new CardAdapter(this, listcollege); recyclerView.setAdapter(adapter); getData(); } 2. Instead of JsonArrayRequest, try using JsonObjectRequest: //Creating a json object … Read more

[Solved] How to show text area when check box is checked in android

The text area can be added to the layout XML and hidden until needed using: android:visibility=”gone” Once the checkbox is checked, you can check the state and show the text area: CheckBox checkBox = (CheckBox) findViewById(R.id.checkboxID); if (checkBox.isChecked()) { textarea.setVisibility(View.VISIBLE); } You can load all of this is an onClickListener so the action fires when … Read more

[Solved] How to save the state of fragment (Android) when application is closed and restore it when application is run again?

I would recommend using SharedPreferences to achieve this. They are meant to be to retain app state when run at a later time. In your case, you need to use putBoolean() method from SharedPreferences.Editor something like this: “Start” button onClickListener: SharedPreferences sharedPref = context.getSharedPreferences(context, MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.editor(); editor.putBoolean(“isJobRunning”,”true”); editor.commit(); In the same way, … Read more

[Solved] How i can use findViewById() in Android?

If you’re trying to use findViewById in Fragment, first of all make sure you’re using onCreateView() and you’re returning the view at the end. See the differences in here: Difference and uses of onCreate(), onCreateView() and onActivityCreated() in fragments Here is an example for that: @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { … Read more

[Solved] Getting values of edit text error NULLPOINTER why? [closed]

Try instead EditText edt1=(EditText)dialog.findViewById(R.id.EditTextNom); you need to look in the layout that is inflated for the Dialog. Right now it is looking in the one that was inflated for the Activity and, obviously, those Views don’t exist in that layout. 1 solved Getting values of edit text error NULLPOINTER why? [closed]

[Solved] Unable to declare variable

You need to do findViewById inside MessageViewHolder() Using itemView Try this public class MessageViewHolder extends RecyclerView.ViewHolder { public TextView chatText; public CircleImageView chatImage; public MessageViewHolder(View itemView) { super(itemView); chatText =itemView.findViewById(R.id.chatText); chatImage=itemView.findViewById(R.id.chatImage); } } 4 solved Unable to declare variable

[Solved] How do I solve this issue? I get this error while building an android project with gradle

To fix this error, you need to add a value for UniqueFirebaseUrl in your gradle.properties file. You should create a file and add a line that looks like this: UniqueFirebaseRootUrl = “https://shoppinglistplspls.firebaseio.com/“ source: https://github.com/udacity/ShoppingListPlusPlus/issues/8 solved How do I solve this issue? I get this error while building an android project with gradle

[Solved] How can I set the android channel notification from code in firebase cloud function?

Solution: It seems that you can assign the category that you want to relate the message: const message = { android:{ notification:{ title: ‘Game started!’, body: ‘Game ‘+ salaName +’ has started!’, channel_id: “notification.category.default”, } }, topic: “topicName” }; Source: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidfcmoptions 0 solved How can I set the android channel notification from code in firebase … Read more