Click here to Skip to main content
15,063,596 members

Comments by David Crow (Top 200 by date)

David Crow 26-Sep-21 21:35pm View
It was just an example of a data type object that gets added to the list. It could be anything.
David Crow 17-Sep-21 10:19am View
According to your "...when the first item countdown timer ends i want the item at the tom to go straight to bottom..." comment, you would add that code at the point where the item's timer is ending.
David Crow 17-Sep-21 9:46am View
I'm assuming that all of the items being shown in the RecyclerView are contained in some sort of List object. For example, if item 0 needs to be moved to the end, do something like:
ItemInfo itemInfo = list.remove(0);
David Crow 17-Sep-21 8:14am View
"just help me in positiong the items"

Use the add() method of the list object that is associated with the adapter.
David Crow 11-Sep-21 10:39am View
400 indicates something is wrong with the request. Is the request malformed?
David Crow 8-Sep-21 8:46am View
You can set/get a spinner's value, but what exactly does "call a spinner" mean?

Also, most of the code you've shown has nothing to do with your question. Advise you to remove all but what is absolutely necessary to exhibit the problem.
David Crow 27-Aug-21 10:42am View
"But I got errors everywhere..."

And those errors would be what exactly? None of the code you've shown has anything to do with playing sounds.

"There's no single API/tutorial guiding on playing weather sounds."

Playing a sound is just that: playing a sound. Regardless of what it represents or where it comes from, there is no difference from any other sound. Richard provided you the link to the MediaPlayer docs.
David Crow 17-Aug-21 19:26pm View
"when I use this code (new View.OnClickListener() it becomes disabled..."

What exactly does that mean? I've not ever known code to disable itself at runtime.

"...when is click on button 0then is a show error message 'unfortunately the project stoped'"

Nothing more in the stack trace?

It's a shot in the dark, but have you cleaned the project? What about invalidating the cache and restarting AS?
David Crow 9-Aug-21 13:46pm View
I'm guessing you read through this? The DetectedObject object contains a Rect that indicates the position of the object in the image. You could then use those coordinates to draw a rectangle "on top of" the object.
David Crow 8-Aug-21 10:46am View
"My idea was to have a custom listview layout which load user data like profile pic on e left of an item and specific information on the right of the image as string. The image and the string are user profile in my forum app. Each user will be displayed in its on listviewitem going down..."

You would need a "row" layout that gets inflated in the adapter's onCreateViewHolder() method. You can design such a layout any way you wish, but a simple version might look like:

<LinearLayout xmlns:android=""

    <ImageView android:id="@+id/image"
        android:layout_height="50dp" />

    <TextView android:id="@+id/tvText"
        android:layout_height="wrap_content" />

David Crow 5-Aug-21 16:32pm View
Do you have a CustomList object that is associated with the ListView? Do you also have an ArrayList<String> object that is associated with this adapter object? If you have both, then simply add String items to the list and call the adapter's notifyDataSetChanged() method.
David Crow 5-Aug-21 8:54am View
Have you tried removing everything related to the banner ad to see what effect that has? If it has no effect, it can be removed from your post since it is irrelevant.

"I do not know why they disappear during runtime..."

Disappear implies that they are shown, even if only briefly. Do you mean, instead, that they are not showing at all? Are you sure they are supposed to? Some orientations and screen sizes do not show icons. Perhaps try a tablet-sized AVD to ensure it is not a screen "real estate" problem.
David Crow 30-Jul-21 8:27am View
" I want to perform both operations on my app by exectuing two urls at the same time. How can i do this?"

Create two separate connections, each in its own thread.
David Crow 24-Jul-21 22:08pm View
"android.database.sqlite.SQLiteException: no such table: tbl_category (code 1): , while compiling: SELECT * FROM tbl_category"

This error should be self explanatory. You are trying to interact with a nonexistent table. Your onCreate() method is empty. That is where the three tables get created.

"After some time, I want to add more categories and questions to it but I am not able to do so if I tried on upgrade with version number increase either it gives me an error or not updating the database."

How did the initial categories and questions get in the tables? Are you reading them from some other source (e.g., text file, string literals in the code)?

If you want more, simply add more "insert" statements in a method such as populateDatabase().

"How to upgrade sqlite database..."

Upgrade implies you want to change the database schema (e.g., add more columns).
David Crow 22-Jul-21 22:53pm View
"nothing happens. It simply crashes as the error message states that I have not declared the Categories fragment..."

Because you forgot to comment out those two lines.

"You can not declare fragments within the manifest can you?"

Correct. You do not "start" a fragment. It belongs to a running activity.
David Crow 22-Jul-21 12:44pm View
What happens if you simply call finish() from within the onClick() method?
David Crow 21-Jul-21 12:13pm View
Don't call getTitle() from a null object.

From the docs:
public RemoteMessage.Notification getNotification ()
Gets the notification data from the message if set.

This field will be non-null if a notification message is received while the application is in the foreground.

The message notification or null.
David Crow 21-Jul-21 8:32am View
In the statement:

getNotification() is returning null.
David Crow 20-Jul-21 15:47pm View
"...I would like to know how can I use the ASP.NET CORE API to send a command from Android to the VB.NET app..."

You make it sound as though "ASP.NET CORE API" is running on your Android device.
David Crow 10-Jul-21 18:24pm View
"...and lastly, I saw no part that talks about setting up icons."

In either of the adapter's onBindViewHolder() method, you should've noticed the following three statements:
String sIcon = "i" + details.m_nIcon;
int nIcon = activity.getResources().getIdentifier(sIcon, "drawable", activity.getPackageName());
holder.mImage.setImageBitmap(BitmapFactory.decodeResource(activity.getResources(), nIcon));
All of the images were downloaded once from AccuWeather's web site and stored in the drawable folder. The files were named i#.png, with # ranging from 1 to 42.

"...I could eventually take it to StackOverflow and ask for further help. Taking it there with the current state will only heed some downvotes."

SO's inhabitants are all about points, ratings, and reputation. A large part of the regulars here at CP couldn't care less about those things. We just want to help, period.
David Crow 8-Jul-21 22:51pm View
I did a similar thing here. See if that helps.
David Crow 7-Jul-21 13:27pm View
"The Bottom Navigation works fine...but if I click on any tab it doesn't work."

What exactly does that mean? The tabs are what make bottom navigation what it is. If bottom navigation is working, then the tabs are working. Otherwise, if the tabs are not working, then bottom navigation is not working. If you meant something else, please elaborate.
David Crow 6-Jul-21 23:19pm View
You need to first narrow down whether it is a Java issue or a PHP issue. In your Java code, set a breakpoint on the statement in which the PHP code is called. Now, is that breakpoint hit once or twice? If once, then you know the problem is with your PHP code. If twice, then you know the problem is with your Java code.
David Crow 6-Jul-21 9:02am View
getLastKnownLocation() gets the last known location, or null if there is no last known location. You need to account for the latter.
David Crow 28-Jun-21 9:23am View
Have you tried adding padding to the ImageView?
David Crow 17-Jun-21 8:25am View
"...the error I face..."

Please provide another word or two to describe this error.
David Crow 14-Jun-21 11:23am View
What experience do you have with medium-difficulty Android apps, specifically those that deal with extracting data from your device, creating timers to run at set intervals, and communicating with an external database (e.g., Firebase)?
David Crow 9-Jun-21 22:47pm View
Have you seen this?
David Crow 22-May-21 11:21am View
"- it doesn't work until the search button is clicked."

Probably because your call to setBackgroundResource() is inside of the onClick() handler.
David Crow 22-May-21 10:45am View
See here. There are several Response methods you could use.
David Crow 21-May-21 9:29am View
Does the error happen during compile or execution?

It's not related to the error, but you will eventually need to call the start() method.

Your code snippet seems to be missing three closing brackets.

This compiles and runs as expected for me:
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;


public class HomeActivity extends AppCompatActivity
    protected void onCreate(Bundle savedInstanceState)

        ImageView Search = findViewById(;

        Search.setOnClickListener(new View.OnClickListener()
            public void onClick(View v)
                MediaPlayer player = MediaPlayer.create(HomeActivity.this,;
David Crow 17-May-21 12:13pm View
Since an invalid city will return a 404 code, I'm guessing you should be checking for that in the onResponse() method. Or only call the various setText() methods if the return code is 200.
David Crow 17-May-21 8:12am View
So then look at the call to getMain() on line 104 of FirstFragment. You did not show that piece of code, so I've no clue what to suggest.
David Crow 16-May-21 19:54pm View
Which is where you obtain the weather data from. That's not what the Places Autocomplete API is for.

With whatever method you are currently using to search, it is returning a value that you are not handling correctly. Have you stepped through your code using the debugger to find out why?
David Crow 15-May-21 11:51am View
Have you tried something like:

Date dt(1620792785);
String s;
s.format("%02d:%02d", dt.getHour(), dt.getMinute());
David Crow 15-May-21 11:48am View
Just curious why searching for a C# solution would be suggested?
David Crow 15-May-21 11:43am View
I'm almost sure it is a context issue. In scanning your code, you assign a value to RecyclerViewAdapter.context in the constructor. Later on in the adapter's ViewHolder constructor, you assign it a different value. Then in the Save button's onClick() handler, you are using that context to create a RecyclerViewAdapter object.

I would start by removing the reassigmnment in the ViewHolder class.
David Crow 15-May-21 11:31am View
Are you using the Places Autocomplete API? I talk briefly about it here.

As far as the crash goes, where? You've failed to show the code that is creating a Toast object.

I've also read that you can only call response.body() once; any calls after that will crash (or thrown an exception). I've not confirmed this.
David Crow 13-May-21 22:43pm View
Are you displaying the data in a ListView or RecyclerView? If so, does that control have an associated adapter?
David Crow 11-May-21 21:42pm View
What exactly is the problem?
David Crow 5-May-21 8:03am View
Have you considered an ExpandableListView instead? It's made for such a thing.
David Crow 1-May-21 23:42pm View
I'm guessing there are mismatched angle brackets.
David Crow 1-May-21 23:40pm View
Call setTag() in the adapter's onBindViewHolder() method, and then call getTag() when you need info for a particular item.
David Crow 30-Apr-21 10:47am View
That's more of a "what" rather than a "how." But anyway, since your friend created this service, does he not have total control over who gets registered and who doesn't? It may simply be a matter of keeping a whitelist of allowed users rather than a blacklist of unauthorized users.
David Crow 30-Apr-21 8:52am View
"We have had some who are abusing the service."

How did they get access to the service?
David Crow 29-Apr-21 22:07pm View
" can I write the UI test case for share app."

Your question is unclear. Since you are writing the code and therefore know what it is supposed to do, the test case is simply "Does it do it?"

When you click the sharebtn button, does the above code show up? In other words, do you get a "Share Using" dialog?
David Crow 28-Apr-21 8:40am View
"please solve it i need it for practice !"

So then shouldn't you be the one doing it?
David Crow 27-Apr-21 13:26pm View
The only examples I've been able to find show the SliderLayout on its own, not within a CardView. Are you sure those two widgets are meant to function together? If so, what should the result look like?
David Crow 27-Apr-21 13:02pm View
So if the card's radius is not showing up, then it has nothing to do with the SliderLayout.
David Crow 27-Apr-21 12:50pm View
Have you tried removing the SliderLayout to see if the card's radius shows up?
David Crow 26-Apr-21 7:55am View
How about checking to see that an object is not null before using it?
David Crow 25-Apr-21 21:09pm View
The problem is with line 107 of Did you look there? You are calling the getMain() method from a null object, most likely body().
David Crow 22-Apr-21 8:52am View
Have you considered contact the author of that library?
David Crow 19-Apr-21 22:54pm View
" Error occurs in the console."

How can you confirm this since no error checking is going on? Where are the try/catch blocks?

Have you single-stepped through the code using the debugger?
David Crow 18-Apr-21 21:45pm View
Since you are getting the duration of each song in s_duration, how about just accumulating that value?
David Crow 15-Apr-21 13:50pm View
The problem appears to originate at line 64 of The answer0 member of the Question class has a value of 0, which setText() interprets as an invalid string resource id. How are the answer# members of the Question class assigned?
David Crow 8-Apr-21 15:06pm View
Using a timer is always a bad idea. Instead, create a "splash screen" activity whose theme is the graphic you want to display. In that activity's onCreate() method, start the actual main activity, like:
startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
Don't forget to adjust the two activities in the manifest file. The action and category should be moved from the main activity to the "splash screen" activity.
David Crow 8-Apr-21 13:14pm View
So what does the screenshot look like now (that differs than before)?
David Crow 8-Apr-21 8:21am View
I don't see anything missing from the pink area, nor do I see the display cutout (i.e., notch). Perhaps you've shown the wrong screenshot, or have explained the problem incorrectly?
David Crow 7-Apr-21 22:19pm View
Can you provide a screenshot?
David Crow 4-Apr-21 22:05pm View
Does the app launch in a real device?

Does the app do the same with all AVDs or just the one?

Have you tried deleting the AVD and creating a new one?

Do other apps launch in the AVD or do they fail too?
David Crow 4-Apr-21 21:51pm View
" is the way the code is formatted."

I can't tell if it is a formatting issue or an omission issue. If the latter, please update your post to include the missing curly braces.

"...status code belongs to calculateStatus()..."

From what you've shown, statusCode is defined in getBedHistory(), and since it looks as though calculateStatus() is also defined in getBedHistory(), that's why calculateStatus() would have access to it.

" just jumps to bottom of method onComplete and returns 0"

Is it returning 0 because that was the value it was defined with, or because that's the value it was assigned in the switch statement? Change it's default value to -1 to help differentiate.
David Crow 3-Apr-21 22:17pm View
Your code snippet seems to be missing at least two closing curly braces. Without those, it's hard to tell if the calculateStatus() function is contained inside or outside of getBedHistory(). Which function does statusCode belong to? It appears to be defined in getBedHistory() but it is being returned in calculateStatus(). That seems odd. Should calculateStatus() have its own copy?
David Crow 26-Mar-21 11:30am View
Other than the inconsistency in the if/else statements, what exactly is the problem?
David Crow 24-Mar-21 14:26pm View
Exactly how is this a solution? At best, it's a suggestion to check for errors to help narrow the problem down.
David Crow 22-Mar-21 13:53pm View
One way would be for the fragment to save the data to a preference. The activity could then monitor for changes to that particular preference and update its UI accordingly.

Another way would be to use an interface between the activity and the fragment.
David Crow 21-Mar-21 22:42pm View
It looks as though the onCreateView() method in FirstFragment is trying to access a UI element that belongs to the activity. Not a good design.
David Crow 21-Mar-21 22:36pm View
What is the value of slaveAddr at the time ioctl() is called?
David Crow 21-Mar-21 22:24pm View
Have you tried creating a "test" Navigation Drawer Activity in Android Studio to see how the drawer items respond?
David Crow 3-Mar-21 16:40pm View
Android Studio allows you to create apps for the Android platform using languages such as Java, Kotlin, and C++. Xcode allows you to create apps for the iOS platform using languages such as Objective-C++, Python, and Swift. Some of these are cross-platform.
David Crow 1-Mar-21 8:13am View
"How to show the data to list view?"

Where the data comes from is irrelevant. See here.
David Crow 11-Feb-21 20:49pm View
How is this any different than what the OP showed he has already tried?
David Crow 10-Feb-21 8:40am View
"In the second of service..."

What exactly does this mean?
David Crow 10-Feb-21 8:30am View
"...but when i close the app, the service has been stopped"

How are you verifying this? Is the service's OnDestroy() method being called after the app is closed? What long-running code is in the service that is meant to keep it alive?

What version of Android is this for? Changes were made to v8 and newer in regard to background processes/services.

Shouldn't onStartCommand() be returning START_STICKY?
David Crow 8-Feb-21 17:35pm View
Have you see any of these:
David Crow 18-Jan-21 21:55pm View
In the second and third for(int i...) loops, the inner for(int j...) loop is terminating on some i value. Is that intentional?

If you know that first_name and last_name are going to be 30 characters, why not make them so rather than dynamically allocate the memory? It would make the code that much easier to read, maintain, and fix.
David Crow 18-Jan-21 9:31am View
The url variable referenced in onCreate() has not been declared.
David Crow 14-Jan-21 12:37pm View
I'm not sure what the statement in question does (probably because I know nothing of JNI or the NDK), but I was able to mock up a simple test that retrieves the current weather in my area:
StringBuilder sb = new StringBuilder();

    URL url = new URL("");
    HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
    if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK)
        String strLine;

        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        while ((strLine = reader.readLine()) != null)


        JSONObject object = new JSONObject(sb.toString());

        JSONObject coords = object.getJSONObject("coord");
        double latitude = coords.getDouble("lat");
        Log.d("Test2", "latitude = " + latitude);
        double longitude = coords.getDouble("lon");
        Log.d("Test2", "longitude = " + longitude);

        JSONObject main = object.getJSONObject("main");
        double temp = main.getDouble("temp");
        Log.d("Test2", "temp = " + temp);
        double feels_like = main.getDouble("feels_like");
        Log.d("Test2", "feels_like = " + feels_like);
        int humidity = main.getInt("humidity");
        Log.d("Test2", "humidity = " + humidity);

        JSONObject wind = object.getJSONObject("wind");
        double speed = wind.getDouble("speed");
        Log.d("Test2", "wind speed = " + speed);
        int dir = wind.getInt("deg");
        Log.d("Test2", "wind from = " + dir);
catch(Exception e)
    Log.e("Test2", e.getMessage());
It's probably comparing apples to oranges, but it at least shows you that their API works.
David Crow 13-Jan-21 9:54am View
Should this be GlideApp instead?

compile 'com.github.bumptech.glide:glide:3.7.0'
Have you tried 4.11.0 instead?
David Crow 11-Jan-21 9:08am View
Study this:
public void onClick(View v) 
    String username = userview.getEditText().getText().toString();
    Cursor c = sqLiteDatabaseObj.rawQuery("SELECT username FROM LOGINUSER WHERE username = ?", new String[] {username});
    if (c.getCount() == 0)

        String password = passview.getEditText().getText().toString();

        ContentValues cv = new ContentValues();
        cv.put(sqLiteHelper.KEY_User, username);
        cv.put(sqLiteHelper.KEY_PASS, password);

            sqLiteDatabaseObj.insert(sqLiteHelper.TABLE_NAME, null, cv);
        catch (SQLException e) 
            android.util.Log.e(TAG, e.getMessage());
        Toast.makeText(MainActivity.this, "User Login Successfully", Toast.LENGTH_LONG).show();
        Intent intent = new Intent(MainActivity.this, Galaxy_Main.class);
David Crow 10-Jan-21 14:42pm View
"if username is empty it will call databasebuild(),tablebuild(),and then insert into that table value..."

Since sqLiteDatabaseObj.insert() is called if username is empty, you are adding empty fields/columns to the table. Is that intentional?

"...and username is already exists then it will directly call the next page i.e Galaxy_Main."

Regardless of whether username is empty or not, you can starting the Galaxy_Main activity.

You are calling rawQuery() but are not using it for anything? Should that code be removed?

"...but still it has errors."

And those errors would be what exactly? Have you stepped through the code using the debugger? If not, why?
David Crow 10-Jan-21 11:38am View
Are the first and second variables non-null? Should you be calling setText() with a non-String value?
David Crow 9-Jan-21 12:14pm View
Ignore my incorrect question about MainActvity.
David Crow 8-Jan-21 9:31am View
Neither of the calls to addTextChangedListener() are doing anything so I would suggest removing them from your post to make it that much easier to read. You should only show relevant code.

In the InsertDataIntoSQLiteDatabase() method, what is the reference to wv.class? In that same area, why are you restarting MainActivity after inserting a record? That method should really look something like:
String username = userview.getEditText().getText().toString();
String password = passview.getEditText().getText().toString();

if (username.equals("admin") && password.equals("admin"))
    // SQLite query to insert data into table.
    ContentValues cv = new ContentValues();
    cv.put(sqLiteHelper.KEY_User, username);
    cv.put(sqLiteHelper.KEY_PASS, password);

        // Executing query.
        sqLiteDatabaseObj.insert(sqLiteHelper.TABLE_NAME, null, cv);

        // Closing SQLite database object.
    catch(SQLException e)
        android.util.Log.e(TAG, e.getMessage());
You also might consider cleaning up the layout file (activity_main) in this post. As it is, it will not compile due to all of the syntax errors. Normally that is not a major concern, but if you've overlooked something that egregious with errors, what else has been overlooked?
David Crow 18-Dec-20 15:17pm View
"...and there was none"

Since you failed to show any relevant code, I can only make the assumption that you are not catching any exceptions or calling any of the Log methods.

" they couldn't help me"

Couldn't or wouldn't?
David Crow 18-Dec-20 9:15am View
Are any exceptions being thrown?
David Crow 15-Dec-20 12:25pm View
How are you loading the initial video? Where is that video stored?

"...when I swipe up..."

So then why have you not shown the code tied to the swipe up event?
David Crow 13-Dec-20 17:58pm View
So it looks as if you've shown us everything that is shown here:

How is that helpful?  Unless you put those code snippets into their appropriate place in your project, I suspect it will not work.  You've not shown that.

"...but the SDK is still not initialized"

How are you verifying this?
David Crow 6-Dec-20 19:23pm View
"Getgradient() showing error..."

Are we supposed to guess what this error is? If you want help, at least provide the minimum information, preferably relevant.

"I had tried to give id to realtive layout. Dont know how to pass gradient in realtive layout"

What does this mean? Remember, only you know what you want your code to do.
David Crow 1-Dec-20 22:27pm View
Since a WebView widget is just a scaled down browser, how would you go about displaying the contents of the folder in your browser? In other words, shouldn't you be calling loadUrl() with a valid URL?
David Crow 28-Nov-20 19:43pm View
Scrolling a ListView will not change the contents of the underlying adapter. The position of a particular item in the ListView should be of no concern. You use it in getView() but usually for the sole purpose of indexing into the adapter's list.
David Crow 28-Nov-20 11:15am View
How many items are in the adapter? How many rows is the ListView able to display at once? What does "scrolling to zero" mean?
David Crow 22-Nov-20 22:32pm View
"...but not showed in listview"

You've shown bits and pieces of random sections of code, but what's actually important is nowhere to be found.

Have you considered discussing this in the actual Android forum? Show the relevant code there, rather than here in the Quick Answers section.
David Crow 21-Nov-20 20:35pm View
So have you bothered to step through the code using the debugger to find out WHY?
David Crow 20-Nov-20 22:42pm View
What exactly is the problem? The title of this post says one thing, but the code you've provided says something else. In fact, most of the code you've shown can probably be removed as it is not relevant.

You're pulling data from two JSON files, and want to add pieces of each to a ListView. Is that anywhere near correct?
David Crow 18-Nov-20 12:59pm View
Indexes are 0-based, so if there are 25 items in the array, the last item would be number 24. How did you put together all of that other code and not know this?
David Crow 18-Nov-20 10:53am View
Accessing any element of an array takes O(1) time. Perhaps you are thinking of a (singly-linked) list or a queue where you'd have to traverse every item?
David Crow 18-Nov-20 10:35am View
The entire JSON file has already been put in obj. What's your concern?
David Crow 18-Nov-20 9:59am View
"the program must find a last index for so long..."

What is this supposed to mean?

JSONArray array = obj.getJSONArray("");
JSONObject data = array.getJSONObject(last_index);
David Crow 18-Nov-20 8:23am View
"i wanna getting last data but it won't take so long"

What exactly does this mean? What is a "last data?" Usually when something does not take long, that's a good thing.

"in this case i want a pick the last array without loading.."

Yet you are calling getInt() in the onResponse() method.

Are you trying to parse a JSON file? If so, what does it look like?
David Crow 16-Nov-20 14:24pm View
So your question has nothing to do with JSON, but simply how to add a record/row to a MySQL table, correct? Where does this database reside?
David Crow 16-Nov-20 8:40am View
Have you tried FFMPEG?
David Crow 9-Nov-20 8:58am View
This is extremely hard to read, not to mention inefficient:
if (1 <= sum3) {
            if ("4".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                    ("5".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                            ("6".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                                    ("7".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                                            ("8".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                                                    ("9".equalsIgnoreCase(txt_alpha.getText().toString()) ||
                                                            ("10".equalsIgnoreCase(txt_alpha.getText().toString())))))))) {
How about:
if (1 <= sum3) 
    int alpha = Integer.parseInt(txt_alpha.getText().toString());
    if (4 <= alpha && alpha <= 10)

Now go do what Richard suggested.
David Crow 9-Nov-20 8:53am View
Clear movieItemList before adding to it.
David Crow 3-Nov-20 12:10pm View
"and has randomly found code on t'interwebz."

People do that?
David Crow 3-Nov-20 12:06pm View
"...send image to pc"

From where? If it's from an Android device, I do not think this will work:
FileOutputStream fos = new FileOutputStream ("C:\\Users\\ICT-PROGRAMER\\Pictures\\" + gambar + ".jpeg");
Can you confirm?
David Crow 30-Oct-20 8:27am View
"yes, i already have this date value..."

The date value and its visual format are two different things. To which do you refer?

"...but it keeps not sorted"

You've not shown any sorting code.
David Crow 28-Oct-20 10:14am View
Shouldn't it be an actual DATE type? If you use CHAR or TEXT instead, then you'll need to store your date values as YYYYMMDD instead.
David Crow 28-Oct-20 9:53am View
"'s not sorted well in mysql"

What does your SELECT statement look like? What type of field is used for the date?
David Crow 24-Oct-20 21:13pm View
Please edit your post and remove all the unnecessary code (which is probably about 75% of it). No one wants to wade through all of that.

What exactly does "post data with multiple edittext" mean?
David Crow 23-Oct-20 9:22am View
It looks as though you may be confusing a file path with a URL.
David Crow 23-Oct-20 8:52am View
Each row of the ListView needs its own layout (rather than using simple_list_item_checked). That "row" layout will contain a TextView and three CheckBox controls.
David Crow 23-Oct-20 8:49am View
"Paths must not contain // in them."

Is this a question or a statement?
David Crow 23-Oct-20 8:22am View
Only you would know the answer to that. Look at the two if() conditions that determine whether an item should be removed or not. They do not appear to be related. Perhaps the second if() could be an else if() instead?
David Crow 22-Oct-20 20:33pm View
How exactly is this a solution instead of just a helpful suggestion? Shouldn't the OP determine whether your suggestion is solution-worthy or not? Just curious...
David Crow 22-Oct-20 20:29pm View
You appear to be calling the remove() method twice using the same value of position with each.
David Crow 21-Oct-20 23:10pm View
"...but when i insert in the text field and press on of the button..."

What text field? What button? What code is being executed as the result of the "press?"

"...the app will crash..."

Where? Is an exception being thrown?

After the "press", have you stepped through the code using the debugger?
David Crow 19-Oct-20 8:12am View
If you are referring to jumlahizin, it has not been declared. If not, you need to better explain what "it turns red and error" means.
David Crow 11-Oct-20 11:02am View
Add the items to an adapter. Associate the adapter with the ListView.
David Crow 9-Oct-20 9:47am View
What exactly do you mean by "disable past day or future day?"
David Crow 5-Oct-20 22:09pm View
"Can you give me an example ?"

To what, exactly?

i still don't get it"

Which part?
David Crow 5-Oct-20 9:22am View
After the item has been removed from the array, you need to call notifyDataSetChanged().

As far as the exception goes, you have four calls to getText() in the code you've shown. One of those is throwing a NullPointerException because the object being used to call getText() is null. You can easily find out which one using the debugger.

Your adapter object should really be created and assigned in the onCreate() method rather than in an anonymous inner class.
David Crow 1-Oct-20 9:06am View
I use something similar to the following:
DatabaseOpenHelper databaseOpenHelper = new DatabaseOpenHelper(this);
SQLiteDatabase db = databaseOpenHelper.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put("CustNum", m_customerInfo.m_nCustNum);
Calendar calNow = Calendar.getInstance();
cv.put("OrderDate", (double) calNow.getTimeInMillis() / 1000.0);
cv.put("Status", OrderInfo.STATUS_NEW);
long lOrderNum = db.insert("Orders", null, cv);
Log.d("Test", "Added order " + lOrderNum);
It's not needed to solve your problem, but DatabaseOpenHelper is derived from SQLiteOpenHelper, and I explain it a bit further here.
David Crow 29-Sep-20 9:09am View
Oh gads, no I did not. I sometimes look at dates, and other times not. I need to make it more of a habit so I don't fall prey to old posts. Sorry about that.
David Crow 29-Sep-20 8:46am View
David Crow 18-Sep-20 8:25am View
The exception seems to be self-explanatory. getDimensionPixelSize() is being called with an index of 2032337659, which apparently is outside the array's size.
David Crow 18-Sep-20 8:08am View
"Where would I place them in this code?"

See here.

"Also how do I look to see what is being returned by findViewById()?"

By using the debugger.
David Crow 17-Sep-20 23:09pm View
Around code for which an exception might be thrown.
David Crow 17-Sep-20 16:33pm View
It has nothing to do with the database. It has everything to do with myTextView being null. Have you stepped into the ViewHolder constructor to see what is returned from findViewById()?

I don't see any try/catch blocks in your code. Is that intentional?
David Crow 17-Sep-20 10:47am View
I once wrote a test Firebase app years ago just to see what it was all about. My takeaway from it was that when devices and/or browsers "subscribed" to the Firebase database, any changes to that database would be known by all subscribers. So, you could create a service request, which would then be sent out to all subscribed devices, and whichever device accepted the service first, got it. The service would then be marked as closed. This is similar in fashion to how DoorDash works.
David Crow 16-Sep-20 14:25pm View
Where is the call to registerReceiver()? I think you need to call it, passing to it the instance of BroadCastRecevier.
David Crow 16-Sep-20 8:35am View
So what is the problem, exactly?
David Crow 15-Sep-20 8:00am View
And you've stepped through the code using the debugger?
David Crow 14-Sep-20 22:32pm View
Is it just me, or are there references to "room" and "credit" tables? Did you write all of the above code?
David Crow 14-Sep-20 14:34pm View
Do you have a RecyclerView widget on the main layout? Have you implemented the onCreateOptionsMenu() and onOptionsItemSelected() methods? For the last item, you need to study up on the SwipeRefreshLayout class.
David Crow 5-Sep-20 22:00pm View
***** Slightly off topic *****

By sending an almost unique 32-bit value to VirusTotal.scan(), how does that method know that the associated file is a virus or not?
David Crow 31-Aug-20 9:20am View
I can't improve upon Richard's answer, but I would like to add that I think _id is a required column. Just for grins, you might could try incrementing DATABASE_VERSION.
David Crow 31-Aug-20 8:26am View
So while viewing the image, if you opt to delete it, then the app closes?
David Crow 29-Aug-20 18:43pm View
Have you considered moving this topic to the actual Android forum? The Q&A section is really geared toward quick questions and answers.
David Crow 28-Aug-20 8:44am View
So your app's sole purpose is just to delete a file?
David Crow 28-Aug-20 8:26am View
Is this the signature of the setColorFilter() method you are meaning to call:

If so, will Color.GRAY work as the ColorFilter parameter?
David Crow 28-Aug-20 8:20am View
"it would be going back (or forward) through the tab's history."

Which is part of a browser, correct? I don't see where the OP is trying to display web pages (in a browser). The Back button he refers to is an entirely different animal.
David Crow 27-Aug-20 15:29pm View
"You need to use javaScript "DOM" facilities."

Wouldn't that be for just going backward in a web page?
David Crow 26-Aug-20 15:09pm View
What is (not) happening, exactly?
David Crow 26-Aug-20 9:32am View
See here, especially #4.
David Crow 20-Aug-20 8:30am View
Why are you calling finish()?
David Crow 19-Aug-20 8:52am View
Have you stepped through the code using the debugger?
David Crow 18-Aug-20 13:34pm View
I did it this way:

public void onBindViewHolder(ViewHolder holder, int position)
    holder.itemView.setOnClickListener(new View.OnClickListener()
        public void onClick( View view )
            ItemDetails details = (ItemDetails) view.getTag();
David Crow 12-Aug-20 15:12pm View
Where does this assignment happen? Have you stepped through render() using the debugger (to see if an exception is being thrown)?
David Crow 12-Aug-20 11:02am View
The variable path has not been assigned a value? Is that intentional?
David Crow 10-Aug-20 22:03pm View
"I want to..."
Ok, so what exactly is the problem?

Have you associated an adapter with the list view?

Where are you referencing product_detail_recyclerview that is contained in activity_product_list?

Do you have a layout file containing the card view? Where is it being inflated?
David Crow 31-Jul-20 22:08pm View
Most of the code here is unrelated to your quest, but it does show a clean way to implement a two-pane ViewPager. Adding more panes is trivial.

Yes, I started with the boilerplate project that Android Studio created, but broke the fragment code up into separate classes.
David Crow 30-Jul-20 8:23am View
"I'd strongly suggest that you look at writing a parser to check the expression syntax and build an execution tree or RPN stack while it's doing it for evaluation when it's shown to be valid. Then execute the tree / stack to produce your result."

One of my more favorite assignments when I was in school.
David Crow 27-Jul-20 8:52am View
"... but i was wondering what recommendations people over here would give to a beginner on the subject."

Come up with a problem, and then start writing code to solve it. This has always worked for me when wanting to learn something new.
David Crow 24-Jul-20 12:36pm View
You can create as many BroadcastReceiver-derived classes as you need. Call registerReceiver() for each one.
David Crow 24-Jul-20 8:30am View
Whether sms is final or not, that does not change that findViewById() is returning null.
David Crow 23-Jul-20 11:39am View
And you are hoping/expecting someone here, or anywhere for that matter, to be able to figure out why?

Regarding the emulator (AVD) you created, did it match your device or your friends?

Regarding the code that is behind the button that does not work, have you actually looked at it to see what it is doing? Expecting?

Using a phone/emulator to verify whether your code is correct is very bad practice. Alas, that seems to be a common practice these days.
David Crow 22-Jul-20 13:04pm View
"...I don't have that much of time to make layout for every type of screen"

You're not supposed to, unless you need to make a specific layout for large or high-density screens, or for when the orientation changes. Other than that, most layouts will work across all screens. If not, then you need to explain in more detail exactly what is happening so that we can offer better suggestions.
David Crow 22-Jul-20 11:17am View
"...but when I have converted to apk and used in my phone and my parents phone I found my widgets messed up , some text automatically changed their size , framelayout changed its position etc"

This is normal and expected behavior. Layouts are supposed to acclimate/adjust themselves to the various screen sizes, densities, pixels, DPI, etc. Otherwise, you'd have to make a layout for each and every combination.

Now, if something else is going on, you need to explain in more detail exactly what is happening so that we can offer better suggestions.
David Crow 21-Jul-20 16:13pm View
You've provided no useful information to help in tracking down the problem. If the problem happens with some buttons but not others, you need to look at the code behind the buttons that work and compare to the code behind the buttons that do not work. Narrow the problem down by removing as much code and UI components as possible but still be able to reproduce the problem. If you have physical access to the other phone, hook it up to your computer and step through the code using the debugger.
David Crow 21-Jul-20 8:59am View
"Using above code will suddenly stop my app."

Where? Is an exception being thrown? Have you stepped through the code using the debugger?
David Crow 18-Jul-20 22:21pm View
1) Run ==> Toggle Line Breakpoint
2) Run ==> Run app
3) When the breakpoint is hit, see what the value of uid and currentUserUid are.

Is this code that you actually wrote?
David Crow 18-Jul-20 15:06pm View
Set a breakpoint on the if(uid == currentUserUid) statement to find out why it's not evaluating to true.
David Crow 17-Jul-20 10:44am View
So when you step through the code using the debugger, what happens?
David Crow 16-Jul-20 22:38pm View
"There is no output in the logcat..."

Maybe because there are no calls to any of the Log methods.

Are you missing try/catch blocks on purpose?
David Crow 15-Jul-20 8:26am View
Have you tried using System.arraycopy()?
David Crow 14-Jul-20 14:35pm View
So what's (not) happening?

I would recommend something like:
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent)
    if (convertView == null)
        LayoutInflater vi = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = vi.inflate(resource_id_of_row, parent, false);

    int nColor = Color.Green;

    // conditions that could change color go here


    return convertView;
David Crow 14-Jul-20 14:23pm View
Why did you post code twice? If there's no difference between the two, remove one. Otherwise, folks reading this are going to be toggling back and forth between the two trying to figure out what you did differently.
David Crow 14-Jul-20 14:21pm View
Have you seen this?
David Crow 13-Jul-20 23:11pm View
"Its been a month since I started into android...what should I go about next in order to be able to be called atleast an itermidiate ."

So in one month's time, you feel you are 1-2 topics away from being able to call yourself an "itermidiate." At that rate, perhaps Google, Inc. should be your next stop. I've been writing Java code on an Android platform for about 10 years now and I wouldn't even feel comfortable claiming intermediate knowledge (of all things Android). YMMV.
David Crow 13-Jul-20 14:51pm View
Do the nodes "Users" and "username" exist? Perhaps you should break that assignment up into its individual pieces to confirm.
David Crow 9-Jul-20 12:32pm View
The actual file contents, or just the relative/absolute path to/of the file?
David Crow 9-Jul-20 11:56am View
Ummm, what file?
David Crow 8-Jul-20 9:03am View
Seems self-explanatory to me, but nonetheless, go here.
David Crow 8-Jul-20 8:46am View
Consider using the actual Android forum instead.
David Crow 8-Jul-20 8:45am View
You do realize this is the "Quick Answers" section, don't you? Try using the actual Android forum instead.
David Crow 7-Jul-20 8:56am View
I'm not struggling with anything.
David Crow 7-Jul-20 8:15am View
A ConstraintLayout is not being used.
David Crow 7-Jul-20 8:14am View
The buttons are laying on top of each other because their width is the same as their parent.
David Crow 6-Jul-20 14:03pm View
"...and its shows null data toast ."

As it should, since no data has been added to the Intent. Perhaps the Intent you are interested in is the one obtained from calling getIntent() from within the Activity.
David Crow 4-Jul-20 15:46pm View
Is an Intent, with valid data, being passed to the MainActivity3 activity? If so, how are you verifying this?

What is the value of contactUri?
David Crow 3-Jul-20 16:04pm View
If your "pdfviewer app" allows you to browse and select files (I assume they are displayed in some sort of list view), then you simply need to get the path to the file that is selected and pass that to the fromUri() method.
David Crow 1-Jul-20 12:59pm View
Comment out the call to setAllListners(). Does the exception go away?
David Crow 30-Jun-20 12:26pm View
Your app needs to be "registered" for that type of file. When I tap on a text file whilst browsing, I've got an app that comes up as one of the possible "Open With" choices. I had code similar to the following in the AndroidManifest.xml file:

    android:theme="@style/AppTheme" >

        android:label="@string/app_name" >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />

            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
David Crow 29-Jun-20 23:00pm View
What exactly does "stuck on Login.class" mean?

Are you working with action_settings2 or action_settings3?

if (getIntent().getBooleanExtra("EXIT", false))

What is the purpose of this at the end of onOptionsItemSelected()?
David Crow 22-Jun-20 11:37am View
I assumed his "The textview is changing text everwhere expect OnActivityResult" meant otherwise. Oh well. 'Tis true about knowing the difference between compile and execute.
David Crow 22-Jun-20 11:06am View
But it shouldn't have compiled, let alone run.
David Crow 22-Jun-20 8:54am View
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
startActivityForResult(intend, 10);

While likely not the source of the problem, shouldn't these match?
David Crow 20-Jun-20 23:00pm View
"I tired to access indx from a class WebViewActivity..."

Which you did not show.
David Crow 19-Jun-20 8:42am View
"Can you please help me in this sir?"

See my previous reply.
David Crow 18-Jun-20 12:15pm View
Have you stepped through the code using the debugger? Is an exception being thrown? What is being returned from loginResponse.getUsername()?
David Crow 15-Jun-20 9:27am View
"... but the link is searched in the System browser like Mi browser..."

What exactly does this mean?

"... but it opens correctly in the browser like Chrome and Microsoft Edge."

If a page opens correctly in one browser but not another, your code is not the issue.
David Crow 6-Jun-20 10:32am View
See my misplaced comment below.
David Crow 5-Jun-20 16:22pm View
"I wonder if you call this an answer or a solution.."

I would call it an answer. Only you can determine if it is a solution.

"I started my post about being a extremely beginner which means a did my best.
I hope that I got a useful hint..."

Whether you are a beginner or an expert, suggesting that someone always start with the debugger is the best advise one can give/receive. There's nothing offensive or demeaning about it, especially the way Patrice offered it.

"I hope that you ignore this post."

If you wanted it to be ignored, perhaps you should not have posted it.

Lastly, why are there no try/catch blocks around your code?
David Crow 5-Jun-20 8:42am View
So is this issue closed since you provided a solution?
David Crow 2-Jun-20 10:21am View
"I know there might be some similar questions to this but this is totally different from them."

It can't be both.

"When I define the adapter in the, it gives me the error:
Adapter cannot be applied to (package_name, java.utill.List<package_name>)"

What line is producing this error? Is it a compile-time error, or an exception being thrown at run-time?

Is it intentional that your JSON file does not contain name, creator, or likes fields?

You might want to consider moving your itemLoader() code to a separate thread to avoid a NetworkOnMainThreadException being thrown.
David Crow 28-May-20 16:19pm View
What exactly does this mean:

"I am using a RecyclerView which calculates the working hours of the day."

A RecyclerView is for displaying large data sets.
David Crow 14-May-20 8:54am View
Have you tried something like:

DhcpInfo dhcp = wifi.getDhcpInfo();
Log.i(TAG, "Gateway = " + dhcp.gateway);
David Crow 13-May-20 12:10pm View
Do those two widgets show up in an emulator or an actual device?
David Crow 8-May-20 15:20pm View
I assume you are referring to case 1. If so, could singleSelectSpinner be going out of scope?

Is it your intent to have the switch()/case statements inside the for() loop?