Привет, я немного новичок в android студии. Я кодирую с java, и мне нужна помощь, дело в том, что когда я добавляю свои модифицированные коды в Call in mainacctivity, он не реагирует, вот мой код в Mainactivity, как бы я ни положил свои коды, это дает мне эти ошибки при сборке. о, и я уже гуглил это, но не мог найти помощь кому-либо, пожалуйста, спасибо. Основная активность:
public class MainActivity extends ParentActivity {
Call<HealthServices>call;
final String TAG="here";
ArrayList<HealthServices> healthServices;
Button btn_signin, btn_signup;
EditText enter_eamil, enter_pass;
public static final String MY_PREFS_NAME = "MyPrefsFile";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(!getUserHelper().hasUser()){
openActivity(Activity_Register.class, true);
} else {
openActivity(HomeActivity.class, true);
}
// test kon
init();
login();
register();
HealthServices healthServices=APIUtils.getHealthServices();
Call<HList>call=healthServices.getInfoo("JSON","");
Log.d(TAG, "onResponse: "+"TEST");
call.enqueue(new Callback<HList>() {
@Override
public void onResponse(Call<HList> call, Response<HList> response) {
HList hList=response.body();
}
@Override
public void onFailure(Call<HList> call, Throwable t) {
Log.d(TAG+" ERROR", t.getMessage());
}
});
}
private void register() {
btn_signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), Activity_Register.class);
startActivity(intent);
}
});
}
private void login() {
btn_signin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String mainPass = enter_pass.getText().toString().trim();
String mainMail = enter_eamil.getText().toString().trim();
if (isValidInput(mainMail, mainPass)) {
Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
startActivity(intent);
finish();
}
}
});
}
private void init() {
btn_signin = findViewById(R.id.main_btn_signin);
btn_signup = findViewById(R.id.main_btn_signup);
enter_eamil = findViewById(R.id.main_et);
enter_pass = findViewById(R.id.main_pass);
}
private boolean isValidInput(String mail, String pass) {
//get data of memory
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
String emails = prefs.getString("EMAIL", "");
String pass1 = prefs.getString("PASS", "");
if (isEmpty(mail)) {
return false;
}
if (isEmpty(pass)) {
return false;
}
if (!mail.equals(emails)) {
return false;
}
if (!pass.equals(pass1)) {
return false;
}
return true;
}
}
и вот мои ошибки появляются в сборке:
02/22 22:20:16: Launching 'app' on Pixel 2 API 29.
$ adb shell am start -n "com.example.najmidpi/com.example.najmidpi.activity.MainActivity" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER
Waiting for process to come online...
Connected to process 30993 on device 'Pixel_2_API_29 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the
"Logcat output" section of the "Debugger" settings page.
D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
W/RenderThread: type=1400 audit(0.0:114): avc: denied { write } for name="property_service"
dev="tmpfs" ino=849 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768
tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission
denied)
D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
W/xample.najmidp: Accessing hidden method Landroid/view/View;-
>computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection,
allowed)
W/xample.najmidp: Accessing hidden method Landroid/view/ViewGroup;-
>makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.najmidpi, PID: 30993
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.najmidpi/com.example.najmidpi.activity.MainActivity}:
java.lang.IllegalArgumentException: baseUrl must end in /: http://teslam.ir/json%20files
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.IllegalArgumentException: baseUrl must end in /: http://teslam.ir/json%20files
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:527)
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:470)
at com.example.najmidpi.retrofit.remote.RetroClient.getClient(RetroClient.java:18)
at com.example.najmidpi.retrofit.remote.APIUtils.getHealthServices(APIUtils.java:12)
at com.example.najmidpi.activity.MainActivity.onCreate(MainActivity.java:56)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Process 30993 terminated.
и Logcat ясен. что мне делать? Может кто-нибудь подскажет плз?