[Solved] OpenCV to android Opencv (JAVA)

I hope this might help you as I am doing something similar. Mat gray8 = new Mat(marked.size(), CvType.CV_8UC1); Imgproc.cvtColor(marked, gray8, Imgproc.COLOR_RGB2GRAY); Scalar mean = Core.mean(gray8); Imgproc.threshold(gray8, gray8, mean.val[0], 255, Imgproc.THRESH_BINARY); /*Imgproc.erode(gray8, gray8, new Mat(), new Point(-1, -1), 2);*/ List<MatOfPoint> contours = new ArrayList<MatOfPoint>(); MatOfInt4 hierarchy = new MatOfInt4(); Imgproc.findContours(gray8, contours, hierarchy, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE); Toast.makeText(getApplicationContext(), contours.size()+” … Read more

[Solved] How to draw path for given lat long values [closed]

You have to call this method at onCreate. private void getPath(){ float sourceLat = yourSourceLatitude; float sourceLng = yourSourceLongitude; float descLat = yourDescLatitude; float descLng = yourDescLongitude; LatLng origin = new LatLng((int)(sourceLat * 1E6), (int)(sourceLng * 1E6)); LatLng dest = new LatLng((int)(descLat * 1E6), (int)(descLng * 1E6)); // Getting URL to the Google Directions API … Read more

[Solved] I am working on OCR reader application. below is my java code. My question is how to start another method if one is completed?

just use the same mode on text to speech ADD and it will play when the first one is done, ADD = ADD, FLUSH = reset textToSpeech.speak(“this will play when first is done”, TextToSpeech.QUEUE_ADD, null); solved I am working on OCR reader application. below is my java code. My question is how to start another … Read more

[Solved] Add or Remove ImageView dynamically

when you want to show listView and hide ImageView, you can follow below code. listView.setVisibility(View.VISIBLE); // showing listview imageView.setVisibility(View.GONE); // hiding imageview you can choose which one to show and which one to hide. solved Add or Remove ImageView dynamically

[Solved] Recent apps button in android

Is that possible to override recent apps button in android? Not from an ordinary SDK app. You are welcome to build your own custom ROM that modifies the overview screen, then convince people to install your custom ROM on their devices. solved Recent apps button in android

[Solved] Calculate the distance between two points

import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity{ Cal cal; TextView textView; public void onCreate(Bundle s){ super.onCreate(s); setContentView(R.layout.<your layout name>); // You can not set id of any view here cal = new Cal(this); // This is a object cal.cal(); textView.setText(“”+ cal.result); // set the value instead of view object } } … Read more

[Solved] Creating SQL table in android [closed]

Next line is full of errors DATABASE_CREATE=”CREATE TABLE IF NOT EXISTS”+num+”(date VARCHAR,latitude VARCHAR,longitude VARCHAR);”; // FULL OF ERRORS!! It should be something like DATABASE_CREATE=”CREATE TABLE IF NOT EXISTS Table” + num + ” (date TEXT, latitude TEXT, longitude TEXT)”; So, correct the table creation and delete the Then, the next line sets the table creation … Read more

[Solved] How to replace a substring with ( from a string

This regex String a = “Want to Start (A) Programming and (B) Designing”; String b = a.replaceAll(“\\(“, “\n\\(“); System.out.println(b); results in Want to Start (A) Programming and (B) Designing Just escape the brackets with \\ and you’re fine. Edit: more specific, like mentioned below a.replaceAll(“(\\([AB]\\))”, “\n$1”); to match only (A) and (B) or a.replaceAll(“(\\(\\w\\))”, “\n$1”); … Read more

[Solved] When i tried to add the library it gives an error of versions .. help me to solve it please [closed]

this is not an error in fact. It is a warning telling that you are using one version of android support library (26.1.0), and your library is using another version (27.0.2) To solve this warning you should use version 27.0.2 too. But it might be not required. You may try building the app as it … Read more

[Solved] Android tutorial “Cannot resolve symbol ‘setText’ “

You have to place these lines: Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); TextView textView = findViewById(R.id.textView); textView.setText(message); Inside onCreate (or some other method). You can’t place code like that outside methods in Java. I say onCreate because you load views. That should be called from onCreate some or another way, but an external … Read more

[Solved] How can I draw Map in Android Activity?

If you make each state have unique color, you can check the pixel color on the clicked point: public boolean onTouch (View v, MotionEvent ev) { final int action = ev.getAction(); final int evX = (int) ev.getX(); final int evY = (int) ev.getY(); switch (action) { case MotionEvent.ACTION_DOWN : break; case MotionEvent.ACTION_UP : ImageView img … Read more