当前位置: 首页 > 知识库问答 >
问题:

不幸的是项目已经停止。没有工作捐赠插图。为什么?

姬实
2023-03-14

我正在尝试创建一个应用程序。所以我在捐赠插页上有一个错误。可能smth是错误的短信按钮。虽然它们在其他插页中工作,但链接也是如此。这是代码:

捐赠JAVA

    package com.example.sadaka;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

public class Donate extends Activity{
@Override
public void onCreate(Bundle donate){
    super.onCreate(donate);
    setContentView(R.layout.donate);
    Button sms1,sms2,sms3,sms4,b1,b2,b3,b4;
    TextView t1,t2,t3,t4,t5,t6;
    ImageButton payment;
    payment=(ImageButton)findViewById(R.id.n);
    payment.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Uri addr=Uri.parse("http://sadakafund.com/donate_phone.php");
            Intent myIntent=new Intent(Intent.ACTION_VIEW,addr);
            startActivity(myIntent);
        }
    });
    sms1=(Button)findViewById(R.id.cont);
    sms2=(Button)findViewById(R.id.butt7);
    sms3=(Button)findViewById(R.id.button5);
    sms4=(Button)findViewById(R.id.help);
    b1=(Button)findViewById(R.id.aboutapp);
    b2=(Button)findViewById(R.id.don);
    b3=(Button)findViewById(R.id.zkt);
    b4=(Button)findViewById(R.id.button6);
    t1=(TextView)findViewById(R.id.textView1);
    t2=(TextView)findViewById(R.id.View1);
    t3=(TextView)findViewById(R.id.View2);
    t4=(TextView)findViewById(R.id.View3);
    t5=(TextView)findViewById(R.id.View4);
    t6=(TextView)findViewById(R.id.textView2);
    sms1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            SmsManager smsm=SmsManager.getDefault();
            String number="3116";
            smsm.sendTextMessage(number, null, "nasr 50", null, null);
        }
    });
    sms2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            SmsManager smsm=SmsManager.getDefault();
            String number="3116";
            smsm.sendTextMessage(number, null, "nasr 100", null, null);
        }
    });
    sms3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            SmsManager smsm=SmsManager.getDefault();
            String number="3116";
            smsm.sendTextMessage(number, null, "nasr 250", null, null);
        }   
    });
    sms4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            SmsManager smsm=SmsManager.getDefault();
            String number="3116";
            smsm.sendTextMessage(number, null, "nasr 500", null, null);
        }
    });
    b1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i1=new Intent(Donate.this,MainActivity.class);
            startActivity(i1);
        }
    });
    b2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i1=new Intent(Donate.this,Donate.class);
            startActivity(i1);
        }
    });
    b3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i1=new Intent(Donate.this,Zakat.class);
            startActivity(i1);
        }
    });
    b4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i1=new Intent(Donate.this,Inf.class);
            startActivity(i1);
        }
    });
}

}

donate.xml

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@style/AppBaseTheme"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/View1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Пожертвовать"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="12dp" />

    <Button
        android:id="@+id/help"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button5"
        android:layout_alignBottom="@+id/button5"
        android:layout_alignLeft="@+id/butt7"
        android:text="500 Р"
        android:textSize="16dp" />

    <TextView
        android:id="@+id/View2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginTop="31dp"
        android:layout_toLeftOf="@+id/View4"
        android:text="Банковская карта"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Button
        android:id="@+id/butt7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/cont"
        android:layout_centerHorizontal="true"
        android:text="100 Р"
        android:textSize="16dp" />

    <Button
        android:id="@+id/aboutapp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:text="Новости"
        android:textSize="12dp" />

    <TextView
        android:id="@+id/View4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/aboutapp"
        android:layout_alignParentLeft="true"
        android:text="Услуга доступна для жителей России"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textSize="8dp" />

    <Button
        android:id="@+id/zkt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@+id/don"
        android:text="Закят"
        android:textSize="12dp" />

    <Button
        android:id="@+id/button6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@+id/zkt"
        android:text="Информация"
        android:textSize="12dp" />

    <TextView
        android:id="@+id/View3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/don"
        android:layout_centerVertical="true"
        android:text="С помощью СМС*"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="12dp" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/View3"
        android:layout_below="@+id/View1"
        android:text="Банковская карта"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Button
        android:id="@+id/cont"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button5"
        android:layout_alignRight="@+id/View1"
        android:text="50 Р"
        android:textSize="16dp" />

    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/View4"
        android:layout_alignLeft="@+id/cont"
        android:layout_marginBottom="15dp"
        android:text="250 Р"
        android:textSize="16dp" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/butt7"
        android:layout_alignLeft="@+id/cont"
        android:layout_marginBottom="14dp"
        android:text="Выберите сумму пожертвования"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <Button
        android:id="@+id/don"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@+id/aboutapp"
        android:text="Пожертвовать"
        android:textSize="12dp" />

    <ImageButton
        android:id="@+id/n"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/butt7"
        android:layout_below="@+id/textView1"
        android:src="@drawable/visa_mc" />

</RelativeLayout>

显示

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sadaka"
    android:versionCode="1"
    android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <permission 
        android:name="com.example.sadaka.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

    <uses-permission android:name="com.example.sadaka.permission.MAPS_RECEIVE"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
<uses-feature android:glEsVersion="0x00020000"
    android:required="true"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library android:name="com.google.android.maps" />
        <meta-data 
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyAZ4ntXyoqLud8mjORXQPuCUsQ9yTrLUD4"/>
        <meta-data 
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

        <activity
            android:name=".Splash"
            android:label="@string/app_name" >
                        <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.sadaka.MAINACTIVITY"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        </activity>
          <activity
            android:name=".Donate"
            android:label="@string/app_name" >
                <intent-filter>
            <action android:name="com.example.sadaka.DONATE"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        </activity>
         <activity
            android:name=".Zakat"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.ZAKAT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>
                 <activity
            android:name=".Inf"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.INF"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>
                         <activity
            android:name=".Cont"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.CONT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
        <activity
            android:name=".About"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.ABOUT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
        <activity
            android:name=".Email"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.EMAIL"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
        <activity
            android:name=".Sms"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.SMS"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
            </application>

</manifest>

LogCat:

04-29 01:35:35.854: E/AndroidRuntime(2319): FATAL EXCEPTION: main
04-29 01:35:35.854: E/AndroidRuntime(2319): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sadaka/com.example.sadaka.Donate}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.os.Looper.loop(Looper.java:137)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread.main(ActivityThread.java:5103)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at java.lang.reflect.Method.invokeNative(Native Method)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at java.lang.reflect.Method.invoke(Method.java:525)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at dalvik.system.NativeStart.main(Native Method)
04-29 01:35:35.854: E/AndroidRuntime(2319): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.createView(LayoutInflater.java:620)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.Activity.setContentView(Activity.java:1895)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at com.example.sadaka.Donate.onCreate(Donate.java:17)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.Activity.performCreate(Activity.java:5133)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
04-29 01:35:35.854: E/AndroidRuntime(2319):     ... 11 more
04-29 01:35:35.854: E/AndroidRuntime(2319): Caused by: java.lang.reflect.InvocationTargetException
04-29 01:35:35.854: E/AndroidRuntime(2319):     at java.lang.reflect.Constructor.constructNative(Native Method)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
04-29 01:35:35.854: E/AndroidRuntime(2319):     ... 23 more
04-29 01:35:35.854: E/AndroidRuntime(2319): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f090000 a=-1 r=0x7f090000}
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.content.res.Resources.loadDrawable(Resources.java:2063)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.View.<init>(View.java:3364)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.View.<init>(View.java:3293)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.view.ViewGroup.<init>(ViewGroup.java:453)
04-29 01:35:35.854: E/AndroidRuntime(2319):     at android.widget.RelativeLayout.<init>(RelativeLayout.java:242)
04-29 01:35:35.854: E/AndroidRuntime(2319):     ... 26 more

多谢帮忙

更新:

styles.xml

 <resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

共有1个答案

柯升
2023-03-14

错误可能来自于您将RelativeLayout的背景设置为donate.xml中的样式android: background="@style/AppBaseTheme"

更改背景以使用DrawableColor来解决您的问题。

如果您想设置活动的样式,请查看此问题中的代码:设置Android主题背景颜色

 类似资料:
  • 代码 和logcat 06-03 16:59:26.570 972 0-9757/com.example.abhijitroy.superhero E/AndroidRuntime:致命异常:AsyncTask#1进程:com.example.abhijitroy.superhero,PID:9720 java.lang.RuntimeException:在Android.os.AsyncTask

  • 我会在我的模拟器上得到谷歌地图。我按照上面的说明操作,当我运行应用程序时,会出现一条错误消息:不幸的是,DemoGoogleMapsV2已经停止。 我的AndroidManifest.xml: 我的activity_main.xml: my mainactivity.java: 日志错误: 09-04 17:43:51.170:E/trace(1477):打开跟踪文件时出错:没有这样的文件或目录(

  • 可以通过捐赠时间(开发新的软件包, 维护现有软件包, 或为用户提供技术支持), 资源(提供镜像空间), 或资金(提供测试的硬件平台)来资助这个项目. 12.1 如何成为一个 Debian 软件开发者? Debian 的开发是全面开放的, 熟练的或好学的用户可以去维护被前任维护者 "遗弃" 的软件包, 开发新软件包, 或为用户提供技术支持i. 详见 Debian 站点的New Maintainer'

  • web3j项目捐赠地址 当然,你可以捐献比特币Bitcoin或以太币Ether来帮助web3j开发基金。 以太币:0x2dfBf35bb7c3c0A466A6C48BEBf3eF7576d3C420 比特币:1DfUeRWUy4VjekPmmZUNqCjcJBMwsyp61G

  • 我正在通过proj.android-studio编译一个新项目,使用:

  • 我正试图将我的启动器活动更改为我刚刚使用twitter数字开发的身份验证活动,我已经在android和java代码中进行了必要的调整,但注意到每次尝试启动时应用程序都会崩溃,身份验证活动的名称是。在调试会话期间,我从android监视器控制台观察到,在com.close.close.aboutactivity.oncreate(aboutactivity.java:34)处蓝色突出显示的一行