web.xml
servlet_config.xml
Pluralsight ta yer alan Spring eğitimini yapmaya calisirken ilk örnekte Server loglarinda asagidaki hatayi aldim.
SEVERE: Context initialization failed
java.lang.IllegalArgumentException
SEVERE: StandardWrapper.Throwable
java.lang.IllegalArgumentException
SEVERE: Allocate exception for servlet fitTrackerServlet
java.lang.IllegalArgumentException
Tomcat v8.0 kullaniyordm
Yardim aldgim link asagidaki gibidir.
https://stackoverflow.com/ questions/32416540/http- status-500-servlet-init-for- servlet-fittrackerservlet- threw-exception
jdk
Tomcat v7.0 kurmak yerine Pom.xml deki versionlari asagidaki gibi değiştirdim.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
compile 'org.jsoup:jsoup:1.11.3'
Simdi de Manifest e gidip internet izni verelim cunku uygulamamiz internetten veri cekecek.package gykizmir.com.jsoupexample;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
public class MainActivity extends AppCompatActivity {
Button learnTitleBtn;
TextView titleOfBlog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
titleOfBlog = (TextView) findViewById(R.id.learnTitle);
learnTitleBtn = (Button) findViewById(R.id.learnTitle);
learnTitleBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Title().execute();
}
});
}
private class Title extends AsyncTask<Void, Void, Void>{
String url = "http://sengamze.blogspot.com/2019/04/android-resim-ekleme.html";
String title;
ProgressDialog progressDialog;
@Override
protected void onPreExecute(){
super.onPreExecute();
progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setTitle("Jsoup Example");
progressDialog.setMessage("Title is retrieving");
progressDialog.setIndeterminate(false);
progressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
Document document = Jsoup.connect(url).get();
title = document.title();
} catch (IOException ex){
ex.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void avoid){
titleOfBlog.setText(title);
progressDialog.dismiss();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="gykizmir.com.jsoupexample.MainActivity">
<Button
android:id="@+id/learnTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Learn Title"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Title" />
</LinearLayout>
<item android:id="@+id/navigation_diet"
android:icon="@drawable/ic_room_service_black_242dp"
android:title="@string/title_diet" />
compile 'com.android.support:design:26.0.0-alpha1'
Offline work
box.Gradle
) and add --offline
to Command-line Options
text box.gradle.properties
(create it if not exists in the following folders: Windows - C:\users\your_name\.gradle\
; Linux- /home/<username>/.gradle/
; Mac- /Users/<username>/.gradle/
; ) and in that file, add these two lines:org.gradle.daemon=true
org.gradle.parallel=true
Linki de asagiya birakiyorum.package com.example.gamze.googlemapsex02;
import android.location.Address;
import android.location.Geocoder;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ZoomControls;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.io.IOException;
import java.util.List;
public class MapsActivity2 extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private final static int REQUEST_LOCATION=90;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps2);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
final Button uyduBtn = (Button) findViewById(R.id.uydu);
uyduBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mMap.getMapType() == GoogleMap.MAP_TYPE_NORMAL){
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
uyduBtn.setText("NORMAL");
}else{
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
uyduBtn.setText("UYDU");
}
}
});
ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomControl);
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mMap.animateCamera(CameraUpdateFactory.zoomIn());
}
});
zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mMap.animateCamera(CameraUpdateFactory.zoomOut());
}
});
final EditText gidilecekYer = (EditText) findViewById(R.id.gidilecekYer);
Button bulBtn = (Button) findViewById(R.id.bul);
bulBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String gidilecekYerAdi = gidilecekYer.getText().toString();
if (gidilecekYerAdi != null && !gidilecekYerAdi.equals("")){
Geocoder geocoder = new Geocoder(MapsActivity2.this);
List
addressList = null;
try{
addressList = geocoder.getFromLocationName(gidilecekYerAdi, 1);
}catch (IOException ex){
ex.printStackTrace();
}
Address address = addressList.get(0);
LatLng latLng = new LatLng(address.getLatitude(), address.getLongitude());
mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.addMarker(new MarkerOptions().position(latLng).title("Burasi: "+ gidilecekYerAdi));
}
}
});
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
<resources> <string name="app_name">CheckBoxExample</string> <string name="btnName1">GONDER</string> <string name="text1"> Cinsiyetinizi secin</string> </resources>
Alttaki ise values-en alttaki strings.xml
<?xml version="1.0" encoding="utf-8"?><resources> <string name="app_name">Ornek Uygulama</string> <string name="btnName1">SEND</string> <string name="text1">Choose your gender</string> </resources>Ancak bu sekilde ayarlama yaptiktan sonra ekranda gosterecegimiz mesajlarin
statik degil dinamik olmasi gerekir. Ornegin bir buton icin :
<Buttonandroid:id="@+id/sec"android:text="@string/btnName1"android:gravity="center"android:layout_width="wrap_content"android:layout_height="wrap_content" />Uygulamanin calistigi telefondaki dil Turkce ise turkce , ingilizce ise ingilizcekarsiliklari yazar.Iyi calismalar
final FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
DatabaseReference dbRef = firebaseDatabase.getReference("orders");
String primaryKey = "20170807192734";
dbRef.child(primaryKey).child("cost").setValue("10");
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.gamze.cameraandvideoexample.MainActivity"> <Button android:id="@+id/imageButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Take Picture" /> <Button android:id="@+id/videoButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Capture Video" /> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <VideoView android:id="@+id/videoView" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
package com.example.gamze.cameraandvideoexample;
import android.content.Intent;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
private ImageView imageView;
private VideoView videoView;
private static final int IMAGE_REQUEST =1;
private static final int VIDEO_REQUEST = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button takePicButton = (Button) findViewById(R.id.imageButton);
takePicButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
imageView = ((ImageView) findViewById(R.id.imageView));
Intent pic_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(pic_intent, IMAGE_REQUEST);
}
});
Button captureVideoButton = ((Button) findViewById(R.id.videoButton));
captureVideoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
videoView = (VideoView)findViewById(R.id.videoView);
Intent video_intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(video_intent,VIDEO_REQUEST);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode != RESULT_OK) return;
else if(requestCode == IMAGE_REQUEST){
Bitmap image = (Bitmap)data.getExtras().get("data");
imageView.setImageBitmap(image);
}
else if(requestCode == VIDEO_REQUEST){
videoView.setVideoURI(data.getData());
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
videoView.start();
}
}
}