java

java

java – How to display the drawn image in ImageView?

Question: I draw like this: Bitmap bitmap = Bitmap.createBitmap(w, w, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawARGB(1, 178, 229, 255); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(Color.BLACK); p.setStyle(Paint.Style.STROKE); p.setStrokeWidth(1); canvas.drawCircle(400, 400, 100, p); There is a component: ImageView iv = (ImageView) findViewById(R.id.iv); How now to display the drawn on the screen …

java – How to display the drawn image in ImageView? Read More »

java – How to print a decimal number with dot, not comma?

Question: If I do: float a=5; System.out.printf(“%d”, a); Its output will be: 5.000000 How do I print 5.000000 ? That is, I want to replace the comma with a period. Answer: Maybe this will help you: import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; public class Teste { public static …

java – How to print a decimal number with dot, not comma? Read More »

java – How to explicitly resolve overloaded method ambiguity in Scala?

Question: Question: I'm trying to use the overloaded methods provided by the Java library in Scala. class X{ public <E> void f(E… values){ System.out.println(1); } public void f(Object value){ System.out.println(2); } } However, in Scala, if the parameter types are compatible, you will not be able to resolve which of …

java – How to explicitly resolve overloaded method ambiguity in Scala? Read More »

java – Switch from one fragment to another by means of a button

Question: What I'm trying to do is move from one fragment to another when a button is pressed, the code I'm using is: public class DimensionFragment extends Fragment { Button Bmeters, Bfeet; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment //return …

java – Switch from one fragment to another by means of a button Read More »

java – How to prevent an Android EditText from showing the keyboard when it receives focus (without disabling the control)?

Question: It happens that I have an Edit Text of type textPersonName and when I pass the focus to another Edit Text of type date it shows me the virtual keyboard but I want it not to be shown, since instead I want a dialog to be shown that contains …

java – How to prevent an Android EditText from showing the keyboard when it receives focus (without disabling the control)? Read More »

Scroll to Top