• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

My first app - getting input values

Hi

I am new to Android development (but not to development).

I have read most of Android Programming for Beginners 2nd edition by John Horton, and I have Android Studio v. 3.4.1.

I am trying to create my first app. My app will take a couple of input figures, do some calculations and provide a result.

I have the layout and I have started on the code and it all works as far as it goes, but I am struggling to fathom out how to get the input values to use in the calculations.

This is my code. Can anyone help, please? Thanks.

package domain.com.myfirstapp;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final EditText editSPrice = (EditText) findViewById(R.id.editText2);
final EditText editPPrice = (EditText) findViewById(R.id.editText3);

Button button = (Button) findViewById(R.id.button);

button.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
doCalculations();
}
});
}

void doCalculations() {
Log.i("info", "In doCalculations");
// get inputs ** this is where I'm stuck **
}
}

How can I stop harassment from blocked calls?

This person has been harassing me for several years, and until recently it was limited to facebook posts and bogus complaints to my job, but the last several days they have called my phone 800+ times from a private, hidden, or blocked number.

That's not a typo. Eight HUNDRED phone calls.

It is a woman doing most of it, though it sounds like she has her friends in on it. She's left multiple voicemails telling me to kill myself, that I'm worthless, etc. It's really sick.

I have tried changing my number, but because I use the number for my family's business, she simply finds the new number and starts again, and in the meantime, I lose business.

Is there any app that will actually unmask private numbers, or block them and keep them from going to voicemail?

I tried going to the phone company and they blocked spam calls, but all the private numbers are still coming through.

Every app I try, has some failing. One of them, I was unable to make or receive calls while she was calling, my phone would simply hang up in the middle of the conversation.

Please help. My father is in a nursing home and I need to be able to get ahold of his carers. My business depends upon my phone working.

FireStick UK and US apps

Hey,
Does anyone know if of a tutorial on how to install UK and US apps on the same firestick? I'm in the US and want to install iplayer, ITV hub, and what not. I have a smart DNS running on a merlin router which is capable of routing the traffic accordingly. I also have a valid UK amazon account, so I can download the UK apps, but when I re-register the firestick to install the US apps, it greys out iplayer and gives the message "you do not own this app."
Thanks ppl

Understanding charging options

Hi, I have a new Samsung Galaxy S10+ along with a number of other Android devices (kindle, other android phones, etc). I've also recently purchased the Anker PowerWave Pad (A2503).

Can you recommend an Anker power supply that's appropriate for this? What is the amperage that's needed to charge using "Fast charging"? Does this support "super fast charging" wirelessly?

I have a number of 2A chargers, including a Samsung 5.3V/2A charger (EP-TA10JWE). Is that sufficient?

This page says the S10+ supports "super fast charging" as well as Power Delivery. Am I reading that right?
https://www.samsung.com/global/galaxy/galaxy-s10/specs/

I also have the Anker PowerPort 2 (A2141), but that does not appear to be sufficient to fast-charge wirelessly. This is 2.4A per port. I thought 2A per port would be sufficient for fast charging?

If I purchased the PowerPort 2 with power delivery, would I be able to have the USB port connected to the powerpad *or* the USB-C port (PD port) connected to the phone for super fast charging when needed?
https://www.anker.com/products/variant/powerport-ii-with-power-delivery/A2321121

If someone could help me understand the current charging methods that are best for the S10+, I'd appreciate it. I also have a number of older chargers. What is the minimum that is useful? I'm ready to toss some of the old 1A/500ma chargers. I'm not even sure they work with current kindle's, etc.

What's your favorite YouTube Channels?

Hey so I'm interested to know what are some of your favorite youtube channels. right now i am extremely addicted to Sailing La Vagabonde. It is about a young Australian couple. the boy early on bought a sail boat (La Vagabonde) and sailed to the Greek Island and ended up meets a beautiful girl Australian there. He ended up asking her top sail with him......and 4 or 5 years later they are sailing around the world together.

for the past week or so i have been binge watching and have been living vicariously through them. it has always been my dream to float around the world like they are doing. i am very glad that i can live it out thru them. i would highly recommend that you check them out.
this is their first video :

so right now this is my favorite.......what is yours?

Help Is there a Nokia 7.1 user who would help me capture a dl link to a new OTA update?

My Nokia 7.1 got bricked after the latest OTA update, and capturing the link to the upcoming one, downloading it and installing it manually via the recovery mode seems to be the only way to fix my phone without factory resetting it.

This is probably a long shot, but is there anyone who is familiar with ADB and Fastboot and would be willing to help me?

https://www.thecustomdroid.com/how-to-capture-ota-update-url-android/

Context = NullPointerException error

I am doing a tutoria to build an Instagram app. The tutorial is about two years old and I am having some problems with the coding.

I am having the following error and am not sure why.
error:
..............................................................................................................................................
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
...............................................................................................................................................
My UniversalImageLoader class:
...............................................................................................................................................
public class UniversalImageLoader {

private static final int defaultImage = R.drawable.ic_android;
private Context mContext;

public UniversalImageLoader(Context context) {
mContext = context;
}

public ImageLoaderConfiguration getConfig(){
//File cacheDir = StorageUtils.getCacheDirectory(mContext);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(mContext)//<--the error is in this line
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.diskCacheExtraOptions(480, 800, null)
.threadPriority(Thread.NORM_PRIORITY - 2) // default
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(mContext)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.writeDebugLogs()
.build();

return config;
}

............................................................................................................................................................
I use it in several activities, and call it as a function in the Activity.Class file:
............................................................................................................................................................
private void initImageLoader(){
UniversalImageLoader universalImageLoader = new UniversalImageLoader(mContext);
ImageLoader.getInstance().init(universalImageLoader.getConfig());
}

.............................................................................................................................................................
and in OnCreate I call it like this:
.............................................................................................................................................................
initImageLoader();
............................................................................................................................................................

any information and help will be highly appreciated....I've read about solutions but nothing makes sense...

The beginner needs help in programming

I practice Kotlin and need help.
Can somebody write a sample example of a diet i get this
update for help? I have my own web server that I want to update my program.
I'm not going to put Google Play on
I need help this https://medium.com/grandcentrix/implement-an-in-app-updater-1f50fbc38416
AndroidManifet is okay
xml/file_provider_paths is okay
DownloadProgressBody is okay
build.gradle implementation 'com.squareup.okhttp3:okhttp:3.11.0' is okay

I don't understand the other code and its writing MainActivity.kt

H850 9008 Mode

Hello, my Lg G5(H850) is randomly turn off and i can`t turn on if i connect my phone to PC .In the Device managger i see my phone Qualcom HS-USB QDLoader 9008. I found QFIL tutorials . So i want to create the files for QFIL becouse i can`t found any files. I donwload the kdz file and the LG Firmware Extractor . The program created the dz file and after the system ..... But ti have not only the PrimaryGPT_0 becouse i have got PrimaryGPT_0 , PrimaryGPT_1,PrimaryGPT_2,PrimaryGPT_3,PrimaryGPT_4,PrimaryGPT_5,PrimaryGPT_6.
And I can`t create the rawprogram.xml and patch0.xml.

Anyone knows how i can merge the primaryGPT-s or what i do wrong or another solution ?

Sorry for my English .

Help Please i need help

My tablet screen is black, i was watching yt on it a day ago and i think it was 20 or 14% so i charged it when i was sleeping i woke up aroun 13:00 and i was gonna ckeck the time but the screen was black when i pressed the home button i was confused so i tested charging it with my dads charger i heard the sound it does when it loads but nothing on my screen like you know when it says howmuch% the screen is just black how could it have broke over a night also my dad massaged my ipad no sound so it must be off or i disabled the sound. I really need it fixed

Wear OS update - now has annoying semi-circle

I just got the new "tiles" update, or whatever it is - and now I have a constant orange semi-circle on the right side of my Nixon Mission watch. Can't find any setting to get rid of it, but it is annoying that it is always there on my watchface. Any ideas? Thanks!

EDIT: Nevermind! It apparently just stays until you use it as a "tutorial". A reboot after using it will get rid of it.

Attachments

  • thumbnail_screen.png
    thumbnail_screen.png
    98.3 KB · Views: 233

Help Can't unlock phone due to needing privacy protection password

Can someone please help me? I have a Leagoo m8 phone which I took my sim card out and tried to put another sim card in and phone locked, I then put my original sin back in phone and switched on phone but now phone won't let me in. The only screen that is showing says I need to enter the privacy protection password which I have no idea what it is or how I find it as I can't access phone at all until I have the password. Any tips would be greatly appreciated. Thanks

Mobile data doesn't work

Hi
So I just bought a one plus 6t on a trip to China.
When I got home, I chose setup in English , Installed the app store manually etc.
When I put my sim card, I can make phone calls, but I don't have mobile data. When I try choosing a carrier, all my options are in Chinese.....
How do I enable mobile data?
How do I change the phone to be completely in English?
Thanks

Missing features from Gestures

Hi all,
I've just bought a new phone a OUKITEL C15 PRO from Amazon that has Android 9 Pie
getting to grips with the different o/s, my current phone is a Galaxy Ace with Android 2.x :D

Looking through some sites about the new features, one being Swipe Up from Home, yet when I go into my phones for gestures there is only
Jump to camera
Prevent ringing

I've tried a wireless update and it says I am up to date.

Not a ball breaker, but curious as to why it was not there.

EG, I had to find out how to enable Developer Mode as it was not present by default anymore.

TIA

Filter

Back
Top Bottom