Soru & Cevap

unfortunately has stopped hatası

19.08.2017 - 12:03

arkadaslar android studioyu yeni öğrenmeye başladım. Kitaptan bir kod yazdım ama genymotion emilatörde unfortunately has stopped hatası hatası alıyorum . Biraz araştırma yaptım . Bu hata ile ilgili çok yazı soru vs var ama ben yinede soruma tam cevap bulamadım. Aşağıa programın tüm kod yapısınıda yazıyorum. Ek vermem gereken bir bilgi varsa yazın hemen cevaplarım 

Kodlar...

 

package deneme.com.deneme;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;


public class denemeilk extends AppCompatActivity {
    public void CustomToast2(String title, String message)
    {
        Toast t= new Toast(this);
        LayoutInflater li = this.getLayoutInflater();
        View v= li.inflate(R.layout.a,null);
        FrameLayout pnl = (FrameLayout) v;
        LinearLayout pnlInner = (LinearLayout)
                v.findViewById(R.id.pnlOuter).findViewById(R.id.pnlInner);
        TextView txtTitle =
                (TextView) pnlInner.findViewById(R.id.txtTitle);
        txtTitle.setText(title);
        TextView txtMessage =
                (TextView) pnlInner.findViewById(R.id.txtMessage);
        txtMessage.setText(message);
        t.setGravity(Gravity.CENTER, 0 ,-20);
        t.setView(pnl);
        t.show();
    }
    @Override
    protected void onCreate(Bundle Bnd) {
        super.onCreate(Bnd);
        setContentView(R.layout.activity_denemeilk);
        CustomToast2("emre","boran");


    }




}

---------------------------------------------------------------------------------------------------------------------------------------------------------------



   <FrameLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
    android:id="@+id/pnlOuter">

       <ImageView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:adjustViewBounds="false"
           android:src="@drawable/post" />
<LinearLayout
    android:id="@+id/pnlInner"
    android:paddingTop="35dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
<TextView
    android:id="@+id/txtTitle"
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:textColor="#FF0000"
    android:textSize="30sp"
    android:textAlignment="center"
    android:layout_margin="10dp"
    />
    <TextView
        android:id="@+id/txtMessage"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:textColor="#000000"
        android:textSize="20sp"
        android:layout_margin="10dp"
        />
    </LinearLayout>
</FrameLayout>






--------------------------------------------------------------------------------------------------------------------------------------------------------

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "deneme.com.deneme"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
}

 

 

14 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user Hamza3444
Hamza3444
20.08.2017 - 11:27
Yardimci olabilecek kimse yokmu ?