[Solved] Add the values on ArrayList in Android [closed]

After getting value from intent: ArrayList<String> arrayList = new ArrayList<String>(); valueaddlist = (Button) findViewById(R.id.valueaddlist); valueaddlist.setOnClickListener(new OnClickListener() { public void onClick(View v){ arrayList.add(product_id); arrayList.add(product_title); arrayList.add(product_image); arrayList.add(product_price); arrayList.add(product_desc); } valuedisplaylist = (Button) findViewById(R.id.valuedisplaylist); valuedisplaylist.setOnClickListener(new OnClickListener() { public void onClick(View v){ Intent intent = new Intent(this,AddedListProducts.class); intent.putStringArrayListExtra(“arrayList”, (ArrayList<String>) arrayList); startActivity(intent); } May be this will help you. In … Read more

[Solved] Main method not found in class Base [closed]

If you want to run the Base class, you should create a class Base (in a File Base.java, and delete the file Child.java before…) and write this inside it: package my.stuff; class Child extends Base { void get(int x,int y) { this.x=x; this.y=y; } } public class Base { int x; int y; void show() … Read more

[Solved] Android: Division and subtraction always equal 1.0

You are reading the value from display1 twice, you forgot to change the reading of number2 to display2. Replace: number2 = Double.valueOf(display1.getText().toString()); with number2 = Double.valueOf(display2.getText().toString()); Your function would end up being: if(minu){ number1 = Double.valueOf(display1.getText().toString()); number2 = Double.valueOf(display2.getText().toString()); display1.setText(“”); display2.setText(“”); displaySymbol.setText(“”); answer = number1 – number2; display1.setText(Double.toString(answer)); } 0 solved Android: Division and subtraction … Read more

[Solved] Importing classes Java [closed]

Which java version do you use? If I look at the scanner documentation, there are several constructors, but no default constructor. You need to pass some arguments for the call “new java.util.Scanner(xxxx)” See https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html solved Importing classes Java [closed]

[Solved] I’m a self-taught programmer so did i understand these concepts? can someone include example too [closed]

These things all work together. An object is something that is self-sufficient, it keeps track of its own state. Encapsulation enforces that separation, the object publishes methods that other objects call, but those methods are responsible for modifying the object’s state. In oo systems that use classes the class is a template for creating objects. … Read more

[Solved] my else if statement isnt working in my tic tac toe program [duplicate]

if (currentstate == you_win){ System.out.println(“‘X’ Won!!”); else if (currentstate == comp_win) System.out.println(“‘O’ won!!”); else if (currentstate == draw) System.out.println(“It’s a Draw :(“); } Take a look at this line (and I removed some extraneous code to make this easier to see): if (currentstate == you_win){ else if (currentstate == comp_win) //… } Looking at it … Read more

[Solved] How can I use youtubeinmp3 in my app?

“I need know how can I use API of the youtubeinmp3… Can you give me an example?” The API link you provided is the manual with example. Scroll down to Direct Links section an read that for reference (the fetch part of URL gives you the MP3 data). You simply access your link as: https://www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=12345 … Read more

[Solved] Why does compiler gives this exception [closed]

First off, a few things to note. First, compilers do not give Exceptions, they give compilation errors – what you are experiencing is at runtime, not compile-time. Second, fileIn.exists() != false is equivalent to fileIn.exists(), which is easier to read. The actual problem you’re receiving is because your condition is false – which implies in … Read more

[Solved] Converting a string into an List [closed]

A neat way to do it is String s = “[1,2,3]” s=s.sbustring(1,s.length-1); List<Long> numLongs = new ArrayList<Long>(); for(String eachString: s.split(“,”)){ try { numLongs.add(Long.parseLong(eachString)) } catch (NumberFormatException e){ System.out.println(“failed to convert : “+s); } } 0 solved Converting a string into an List [closed]

[Solved] Android, NullPointerException

You shouldn’t be setting the onClickListener for your button within the button itself, instead it should be set in the Activity that makes use of both of your buttons. Likewise, findViewById() in your example can’t find the TextView as it’s not within the same scope as your button. In absence of code from your activity, … Read more