I m calling it in method by creating function with the java class from another package..
private void drawRegressionLine() {
//Toast.makeText(MainActivity.this, "Regression line view ", Toast.LENGTH_SHORT).show();
ArrayList<String> point = new ArrayList<String>();
Algorithm algorithm = new MaxLikelihood() {
point = c.KNN(point);
plot(point);
};`
package firstpackagename;
import secondpackagename.*; /*add other necessary imports*/
public class MainActivity extends Activity {@
Override public void onCreate(Bundle s) {
super.onCreate(s);
TheClassInOtherPackage X = new TheClassInOtherPackage(); /*If empty constructor used*/
Object o = X.methodInOtherpackage(params1, params2, ....); /*Replace this with X.methodInOtherpackage(...) if method returns voids. Replace object o with the proper return type*/
}
}
Note - You can also return values from the constructor by adding a return type to it just like the methods. Hope this helps. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.