[Solved] Android App Crushing Unexpectedly [closed]

Since you are using Arrays.asList to create your list, this list is unmodifiable, you cannot add or delete any element. Arrays.asList: Returns a fixed-size list backed by the specified array. So when you get to the line facts.remove(randomNumber); you get an Exception like the following (just guessing because you have not shared any stacktrace or … Read more

[Solved] getText().toString().trim().length() == 4 not working

Since you are just checking if your EditText has string or not, why dont you use. if(mSwitcher.getText().toString().isEmpty()) { …. … } More over it becomes if (mSwitcher.getText().toString().isEmpty()) { final Button button2 = (Button) findViewById(R.id.button2); final Animation buttonz = new AlphaAnimation(0.0f, 1.0f); buttonz.setDuration(3000); button2.startAnimation(buttonz); } else { } I do not recommend to use final Button … Read more

[Solved] Should I use a native or a hybrid app for an an app based Online-Shop [closed]

Native vs Hybrid App debate is a one which varies its outcome based on your priorities. You should always go for whatever best suits your needs. Some points to consider while choosing to go with Native or Hybrid are, Development Time – The foremost pointer to consider while Native vs Hybrid comparison is that the … Read more

[Solved] Receive json in android

JSONArray json = new JSONArray(result); First calculate the length of the array! int len=json.length(); String[] str=new String[len]; for(int i=0;i<len;i++) { str[i]=json.get(i).toString(); } First add a spinner to your activity Spinner s=(Spinner)findViewById(R.id.Spinner); ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item,str); s.setAdapter(adapter); solved Receive json in android

[Solved] How to split a string at the n’th occurrence of a specific separator in Java [closed]

You can do something like this: Pattern pat = Pattern.compile(“((?:[^\u0003]*\u0003){30}[^\u0003]*)\u0003(.*)”); Matcher matcher = pat.matcher(input); if (matcher.matches()) { String leftPart = matcher.group(1); String rightPart = matcher.group(2); } The pattern works as follows: The first capture group finds a substring with exactly 30 occurrences of the separator \u0003; the subpattern that finds a substring with no separators, … Read more

[Solved] Determine why my android app crashes upon opening [duplicate]

first of all change this line of code: mPagerAdapter = new ScreenSlidePager.ScreenSlidePagerAdapter(getSupportFragmentManager()); to this: mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); it seems you copied your adapter from another page change place you are defining your pager: private ViewPager mPager; above the onCreate 8 solved Determine why my android app crashes upon opening [duplicate]

[Solved] Receive json in android

Introduction Android is a powerful platform for developing mobile applications. It provides a wide range of features and capabilities that can be used to create powerful and engaging applications. One of the most important features of Android is its ability to receive and parse JSON data. JSON (JavaScript Object Notation) is a lightweight data-interchange format … Read more

[Solved] How to split a string at the n’th occurrence of a specific separator in Java [closed]

Introduction String manipulation is a common task in programming, and Java provides a number of ways to split a string at a specific separator. In this article, we will discuss how to split a string at the n’th occurrence of a specific separator in Java. We will look at various examples and discuss the different … Read more

[Solved] How to prompt error on TextInput [closed]

This is with Text Input Layout in xml Layout file <android.support.design.widget.TextInputLayout android:id=”@+id/input_layout_password” android:layout_width=”match_parent” android:layout_height=”wrap_content”> <EditText android:id=”@+id/textView_password” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”@string/password” android:inputType=”textPassword” /> </android.support.design.widget.TextInputLayout> Your activity should be something like this. passwordTIL = (TextInputLayout) findViewById(R.id.input_layout_password); passwordET = (EditText) findViewById(R.id.textVIew_password); passwordET.addTextChangedListener(new SigninTextWatcher(passwordET) //you can use this for username too or to check if the email format is correct … Read more

[Solved] GridView is not refreshing with notifyDataSetChanged()

First thing first notifyDataSetChanged() only will work with the same reference of dataset . And you have created a new list int your adapter’s constructor . So you are going nowhere from here . It should as simple as . private ArrayList mArraylist = new ArrayList(); public MenuGridViewAdapter(Activity activity, ArrayList mArraylist) { this.activity = activity; … Read more

[Solved] two buttons with onClick in same place

Try with something like this: public class MyActivity extends Activity { Button buttonStart; Button buttonStop; protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.content_layout_id); buttonStart = (Button) findViewById(R.id.buttonStart); buttonStop = (Button) findViewById(R.id.buttonStop); buttonStart.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click //for example mediaPlayer.start(); if you have a media player } }); buttonStop.setOnClickListener(new … Read more

[Solved] Call a c++ function that returns a int value from java

I just had to place the cpp file name in the Android.mk file… This is my first time so sorry… Fixed code: C++ #include <string.h> #include <jni.h> extern “C” { JNIEXPORT jint JNICALL Java_net_pixeldroidof_addonedit_MainActivity_getScreenY(JNIEnv* env, jobject thiz) { int number = 30; return number; } } Java public native static int getScreenY(); //And you can … Read more