Posts

Showing posts with the label java

does not have valid android:name [duplicate]

<activity> does not have valid android:name [duplicate] This question already has an answer here: I have trouble with the INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error where I looked into logcat where the following was my error: W/PackageParser: /data/app/vmdl-1226238136.tmp (at Binary XML file line #27): does not have valid android:name I looked into my manifest code and after searching through a lot of forums (adding . before my activity name, adding big letters and etcetera) it does not work. What is wrong with my activity name? Down below is my manifest code; <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="R.ekryt"> <uses-feature android:name="android.hardware.bluetooth" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> ...

Firebase “User is missing a constructor with no arguments”

Firebase “User is missing a constructor with no arguments” I am trying to retrieve my user details from the /User/ tree i have in Firebase. I have the following User object : public class User { private String name; private String email; private FirebaseUser firebaseUser; private String lastOnline; private LatLng latLng; private ArrayList<SwapLocation> locations; public User(){ } public String getName(){ if(firebaseUser.getDisplayName() != null && !firebaseUser.getDisplayName().equals("")) return firebaseUser.getDisplayName(); if(name != null && !name.equals("")) return name; return ""; } public void setName(String name){ this.name = name; } public String getEmail(){ if(firebaseUser.getEmail() != null && firebaseUser.getEmail().equals("")) return firebaseUser.getEmail(); if(email != nul...

How do I display a double in an af:inputText rounded down to an integer?

How do I display a double in an af:inputText rounded down to an integer? I have an af:inputText which displays a double value. For example: 17555.8 af:inputText <af:inputText value="#{bindings.regnum.inputValue}" disabled="true" simple="true" id="it4"/> I want to view this data as an integer: 17555. How can I achieve that? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

The activity is not responding

Image
The activity is not responding I have been working on developing an application which needed login and signup screen. My register activity is not working properly. The application is unable to take user from the start screen to the register activity, first the error arose of absence of intent filter then I included the intent filter in the manifest file but it seems like my app is ignoring the register activity. I am attaching both manifest file and the activity code please have a look. Don't use images to share code, use code snippet. – tahsinRupam Jul 2 at 10:39 2 Answers 2 As images are suggesting there are two LAUNCHER Activities in your AndroidMenifest.xml file, so you will have to make one of them as DEFAULT category . LAUNCHER AndroidMenife...

How to retieve specific text from a tag without using contains() and xpath?

How to retieve specific text from a tag without using contains() and xpath? <div> <label1>Hulk</label1> <label2>Ironman</label2> Thor </div> How do I get only Thor text without using contains in xpath ? If I try getting text of div it would give me all the 3(Hulk,Ironman,Thor) but I want only Thor. Show how did you try, current and desired output, add tag for your programming language – Andersson Jul 2 at 10:21 Assuming that the typo <label1? is fixed, and that there are no other div s in the document, //div/text() will select Thor . – jsheeran Jul 2 at 10:29 <label1? div //div/text() Thor @jsheeran ,...

Basic Authentication in spring boot using spring-boot-starter-security is not working for latetst version of spring-boot-starter-parent

Basic Authentication in spring boot using spring-boot-starter-security is not working for latetst version of spring-boot-starter-parent I am trying to implement basic auth to my end points of my micro-services. So I used spring-boot-starter-security. But I have noticed that spring-boot-starter-security does not work with spring-boot-starter-parent-version > 2.0.3. So I switched to spring-boot-starter-parent-version > 1.5.2 where it was working perfectly for my reference project. Can any one help me with any other method for implementing basic auth with latest version of spring-boot-starter-parent? My problem now is some class where I have written my logic, which is implemented in the latest version, are not functional with the former version of spring boot-starter-parent. Especially where there are methods for reading time stamps. Here is my pom.xml for reference. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/...

REST API request using Hibernate relationships

REST API request using Hibernate relationships Rest Controller: @PostMapping("transaction") public ResponseEntity<Transaction> init(@RequestBody Transaction transactionInput) { Transaction transaction = transactionRepository.save(transactionInput); return new ResponseEntity<>(transaction, HttpStatus.OK); } Transaction Entity: @Getter @Setter @Entity @NoArgsConstructor @AllArgsConstructor @DynamicInsert @DynamicUpdate @Table(name = "transaction") public class Transaction { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = false) @JoinColumn(name="currency_id") private Currency currency; Currency Entity: @Entity @NoArgsConstructor @AllArgsConstructor @Getter @Setter @DynamicInsert @DynamicUpdate @Table(name = "currency") public class Currency { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) priv...

Create a folder from Servlet and save file

Create a folder from Servlet and save file In my form, user uploads a photo(s) and then I want to store that photo in a network disk (in our local network). The following works fine, when I execute it from Netbeans in my PC: public void saveFiles(List<Part> fileParts,String targetId) { String pathRoot = "A:\ShareDisk1\Photos\"; String date = new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); try { int counter = 1; for (Part filePart : fileParts) { String destPath = pathRoot + "\" + targetId; Boolean flag = new File(destPath).mkdirs(); System.out.println("flag = " + flag); File file = new File(destPath, targetId + " " + date + "-" + counter + ".jpg"); try (InputStream input = filePart.getInputStream()) { Files.copy(i...

Hide an option in a spinner

Hide an option in a spinner So I'm creating currency converting app on android I have two spinners and I'm trying to hide option from the second spinner when that option is already selected by the first spinner, like if i choose to convert from USD the second spinner USD option should disappear but I just don't have any idea how to hide an option I searched on google most question asks about hiding the whole spinner not option package com.currencyconverter; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import static com.currencyconverter.globalData.amountToBeConvert; import static com.currencyconverter.globalData.cur...

Spark's Column.isin function does not take List

Spark's Column.isin function does not take List I am trying to filter out rows from my Spark Dataframe. val sequence = Seq(1,2,3,4,5) df.filter(df("column").isin(sequence)) Unfortunately, I get an unsupported literal type error java.lang.RuntimeException: Unsupported literal type class scala.collection.immutable.$colon$colon List(1,2,3,4,5) according to the documentation it takes a scala.collection.Seq list I guess I don't want a literal? Then what can I take in, some sort of wrapper class? 2 Answers 2 @JustinPihony's answer is correct but it's incomplete. The isin function takes a repeated parameter for argument, so you'll need to pass it as so : isin scala> val df = sc.parallelize(Seq(1,2,3,4,5,6,7,8,9)).toDF("column") // df: org.apache.spark.sql.DataFrame = [column: int] scala> val sequence = Seq(1,2,3,4,5) // sequence: Seq[Int] = List(1, 2, 3, 4, 5...

How to force to do when button clicked from other activity

How to force to do when button clicked from other activity I want to toDo() work App.class (AllActivity) when button clicked from other example.class.(Activity) public class Otherclass extend AppCompatActivity{ Button example = (Button)findViewById(R.id.option_language); example.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { example.isChecked(); } }); } public class App extends Application { @Override public void onCreate() { super.onCreate(); ToDo(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); toDo(); } public void toDo() { if(new OtherClass().example.isChecked()) { // To do something. } } } } I wanted to do it. But, I got java.lang.NullPointerException: .isChecked()' on a nu...

How to make a program that returns the first recurring character in a string in Java? [closed]

How to make a program that returns the first recurring character in a string in Java? [closed] I got a school assignment in computers in which I have to make a small program that returns the first recurring characters in a string using loops and conditional statements but I can't figure out how to so. Please help! Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question. Possible duplicate of how to find the first recurrring character in a string using java 8 stream without intermediate terminal operation – Joshua Simon Bloom Jul 2 at 10:05 Please show us ...

How to get Date formatted in locale with specific pattern?

How to get Date formatted in locale with specific pattern? After searching, i was unable to find a solution for this problem. i have this: Long parseDt = Long.valueOf(arrayJson.getJSONObject(i-j).getInt("dt")); // dt is a timestamp Locale locale = ConfigurationCompat.getLocales(Resources.getSystem().getConfiguration()).get(0); String date = new SimpleDateFormat("EEE d MMM", locale).format(new java.util.Date(parseDt * 1000)); So, the pattern works but when i change the phone language, it didn't swap the way it displays, i want to mean if the phone language is French it displays the date like this and it is good for most of the european language: lun 2 juil and if i switch language to English, it displays the date like that: mon 2 july instead of: mon july 2 Do you have any clue to solve this problem respecting my pattern knowing that i want the name of the day with 3 characters maximum? The existing predefined format (like FULL) could work but the name of the day...