[Solved] How can i add two buttons to the listview from the adapter?

For ListViews, there are two layout files used. One specifies the layout for the list as a whole, the other specifies the layout for the list_item. List Item Layout: list_item.xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:baselineAligned=”false” android:orientation=”horizontal”> <TextView android:id=”@+id/contact_phone” android:layout_width=”match_parent” android:layout_height=”40dp” android:layout_marginBottom=”2dp” android:layout_marginLeft=”5dp” android:layout_marginStart=”5dp” android:layout_marginRight=”5dp” android:layout_marginEnd=”5dp” android:layout_weight=”0.73″ android:background=”#00000000″ android:gravity=”start|center_vertical” android:text=”” android:textColor=”#FFFFFFFF” android:textSize=”16sp” /> … Read more

[Solved] Hello i have a issue with this example

You have to user Exifinterface and Matrix to get the right orientation. try this: public static void handleImageRotation(Context context, File mFileTemp) { if (!mFileTemp.exists()) { Toast.makeText(context, “File not found”, Toast.LENGTH_SHORT).show(); return; } ExifInterface exif = null; int orientation = ExifInterface.ORIENTATION_NORMAL; try { exif = new ExifInterface(mFileTemp.getAbsolutePath()); orientation = exif.getAttributeInt( ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); } catch (Exception e) … Read more

[Solved] What could be the regular expression for the text “192.168.71.1 GET HTTP/1.0 /test/abc”?

Using https://regex101.com/ the following works: 192\.168\.71\.1\sGET\sHTTP\/1\.0\s\/test\/abc Remember to escape special characters like . and \ if you want to use them as literals. If you want to use any of these characters as a literal in a regex, you need to escape them with a backslash Take a look at http://www.regular-expressions.info/characters.html to see more about … Read more

[Solved] How is it possible to use a “new” as parameter in side another new?

The new operator is used to create an instance of a class. What’s happening in new Bus(new PrototypeEngine1()).drive() is that an instance of PrototypeEngine1 is being created as an argument to new Bus(). To illustrate this concept, let’s refactor the single line of code in step by step manner: PrototypeEngine1 engine = new PrototypeEngine1(); Bus … Read more

[Solved] could not resolve property 3 [closed]

The problem with an alias com in HQL. com.company.location.entities.Compte has an incorrect meaning with this alias. select com from Compte com where com.statuts=”actif” and com.user=””+user+”” and com.pwd='”+pwd+”‘ ” + “and com.personnels.id in (select p.id from Personnels p where statuts=”actif” Just change it to compte select compte from Compte compte where compte.statuts=”actif” … And, please, use … Read more

[Solved] For loop resets after an exception

When you throw your exception, you go back to the beginning of your do while loop because that’s where your try block starts. If you don’t want to reset your loop in an exception, put a try catch block within your for loop. 0 solved For loop resets after an exception

[Solved] java. inheritance/polymorphism, quiz error?

Here what’s happening is when you call Base b = new Derived() it first calls Derived() on derived class. Now as Derived class extends Base class every constructor of Derived class internally calls the default cunstructor of base class, similer to Derived() { super(); addValue(); } which in turns calls the Base(). Now inside Base() … Read more

[Solved] how to return equivalent Arrays

public class Equavalenarray { public static void main(String[] args) { System.out.println(equivalentArrays(new int[]{0,1,2}, new int[]{2,0,1})); System.out.println(equivalentArrays(new int[]{0,1,2,1}, new int[]{2,0,1})); System.out.println(equivalentArrays( new int[]{2,0,1}, new int[]{0,1,2,1})); System.out.println(equivalentArrays( new int[]{0,5,5,5,1,2,1}, new int[]{5,2,0,1})); System.out.println(equivalentArrays( new int[]{5,2,0,1}, new int[]{0,5,5,5,1,2,1})); System.out.println(equivalentArrays( new int[]{0,2,1,2}, new int[]{3,1,2,0})); System.out.println(equivalentArrays( new int[]{3,1,2,0}, new int[]{0,2,1,2})); System.out.println(equivalentArrays( new int[]{1,1,1,1,1,1}, new int[]{1,1,1,1,1,2})); System.out.println(equivalentArrays( new int[]{ }, new int[]{3,1,1,1,1,2})); System.out.println(equivalentArrays( … Read more

[Solved] Selenium – How to confirm that captcha with two numbers are changed after submit [closed]

Here is the line of code that you have to use the before clicking submit and after clicking submit. Then compare they are not matching. driver.findElement(By.xpath(“//span[@class=”et_pb_contact_captcha_question”]”)).getText(); 0 solved Selenium – How to confirm that captcha with two numbers are changed after submit [closed]

[Solved] Unexpected NullpointExpection inside a setter [duplicate]

The title is still null when you are calling mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); so what you can do is public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_invalid_time, container, false); title = (TextView)view.findViewById(R.id.titleText); setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); return view; } // call it mAlertDialog dialog = new mAlertDialog(); dialog.show(fm, “InvalidTime”); 2 solved … Read more

[Solved] ava.lang.StringIndexOutOfBoundsException: String index out of range: 9 at java.lang.String.charAt(String.java:658)

Change for(x = 0; x < num +1; x++) to for(x = 0; x < num; x++) Also you might have meant for(boolean guessed = false; guessed == true;) // notice == instead and then setting this flag to true within this(outer) for loop. solved ava.lang.StringIndexOutOfBoundsException: String index out of range: 9 at java.lang.String.charAt(String.java:658)

[Solved] Error using Math.pow and Math.sqrt in Java [closed]

v_y = 51 – time*3; v = (int)Math.pow(v_y+20, 2); v_squart = (int)Math.sqrt(v); // why take the square root of something you just squared… height = 456 – v; System.out.print(“The height of the plane is” + height); Integers cannot contain decimal values, Math.pow and Math.sqrt both return double types. You have declared v_y, v and v_squart … Read more

[Solved] How to make POST request with HttpServer?

Correct, the HttpServer class can only handle (client) requests and respond to them. A HttpServer is bound to an IP address and port number and listens for incoming TCP connections from clients on this address If you want to POST a request to another service, you’ll need to implement a client to do so using … Read more