2017-04-06 44 views
1

我不僅是新的到Android工作室,我是新來的,一般的編程(我一直在慢慢地教自己,我能在過去一年左右作爲業餘愛好)。的Android應用程序崩潰,一旦重新打開

我碰到我的Android應用程序的問題,我無法找到答案 - 儘管我知道很多人都問過類似的問題,我似乎無法理解的解決方案,足以使其適應我的特殊問題。編譯時,我的應用程序將運行良好,並做我希望它「正確」做的所有事情(除了一個小工具,但我會後來哈哈)。

的一件事它沒有做到的是開放的,我關閉後,其正確。我可以進入主屏幕並返回到應用程序,但如果我完全關閉應用程序並嘗試重新打開,則表示它「一直停止」。

現在,我認爲這將是給你我的代碼(也有在此應用程序只有兩個活動),我的「logcat的」有用。然而,我目前正試圖讀取和理解如何檢索我的「logcat」在第一個地方哈哈,所以希望我會很快在這裏。

從我讀我的理解是,我的問題是,要麼我聲明瞭全局變量或東西與按鈕ID時,我做的按鈕動態的。我遇到了與他們的「主題」有關的人,但我無法將其與我的特定位置相關聯。但是,如果這些問題中的任何一個是問題,我很難理解問題實際上是什麼。

這裏是我的主要活動......

package com.example.getcoins; 

import android.content.Intent; 
import android.icu.text.DecimalFormat; 
import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.support.v7.widget.Toolbar; 
import android.view.Menu; 
import android.view.MenuInflater; 
import android.view.MenuItem; 
import android.view.View; 
import android.widget.Button; 
import android.widget.LinearLayout; 
import android.widget.TextView; 

import com.jjoe64.graphview.GraphView; 
import com.jjoe64.graphview.series.DataPoint; 
import com.jjoe64.graphview.series.PointsGraphSeries; 

import java.util.ArrayList; 

public class MainActivity extends AppCompatActivity { 

    int intialCoins = 21; 
    int coins; 
    int buttonColor = android.graphics.Color.rgb(0, 150, 150); 
    int textColor = android.graphics.Color.rgb(255, 255, 255); 
    ArrayList<Integer> coinsOverTime = new ArrayList<Integer>(); 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); 
     setSupportActionBar(myToolbar); 

     Intent intent = getIntent(); 
     coins = intent.getIntExtra("COINS", 1); 

     if (intent.getExtras() != null) 
     { 
      Boolean winner = intent.getBooleanExtra("WINNER", true); 
      int gambleamount = intent.getIntExtra("GAMBLE", 1); 
      Bundle bundle = intent.getExtras(); 
      coinsOverTime = bundle.getIntegerArrayList("COIN_HISTORY"); 

      if (winner == true) 
      { 
       coins = coins + gambleamount; 
       coinsOverTime.add(coins); 
      } 

      if (winner == false && gambleamount == 1) 
      { 
       coins = coins; 
       coinsOverTime.add(coins); 
      } 

      else if(winner == false) 
      { 
       coins = coins - gambleamount; 
       coinsOverTime.add(coins); 
      } 
     } 

     else 
     { 
      coins = intialCoins; 
      coinsOverTime.add(coins); 
     } 

     String number = Integer.toString(coins); 
     double amount = Double.parseDouble(number); 
     DecimalFormat formatter = new DecimalFormat("#,###"); 
     String formatted = formatter.format(amount); 

     TextView textView = (TextView) findViewById(R.id.textView); 
     textView.setText(formatted); 

     GraphView graph = (GraphView) findViewById(R.id.graph); 
     PointsGraphSeries<DataPoint> series = new PointsGraphSeries<>(generateData()); 
     graph.addSeries(series); 
     series.setShape(PointsGraphSeries.Shape.POINT); 
     graph.getViewport().setXAxisBoundsManual(true); 
     graph.getViewport().setMinX(0); 
     graph.getViewport().setMaxX(coinsOverTime.size()); 

     if (coins >= 0 && coins < 101) 
     { 
      Button getCoinButton = addButton("Get 1 coin"); 
      getCoinButton.setId(R.id.one); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getOneCoin(v); 
       } 
      }); 
     } 

     if (coins >= 11 && coins < 501) 
     { 
      Button getCoinButton = addButton("Get 10 coins"); 
      getCoinButton.setId(R.id.ten); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getTenCoins(v); 
       } 
      }); 
     } 

     if (coins >= 21 && coins < 2001) 
     { 
      Button getCoinButton = addButton("Get 20 coins"); 
      getCoinButton.setId(R.id.twenty); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getTwentyCoins(v); 
       } 
      }); 
     } 

     if (coins >= 101 && coins < 5001) 
     { 
      Button getCoinButton = addButton("Get 100 coins"); 
      getCoinButton.setId(R.id.one_hundred); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getOneHundredCoins(v); 
       } 
      }); 
     } 

     if (coins >= 501 && coins < 10001) 
     { 
      Button getCoinButton = addButton("Get 500 coins"); 
      getCoinButton.setId(R.id.five_hundred); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getFiveHundredCoins(v); 
       } 
      }); 
     } 

     if (coins >= 2001) 
     { 
      Button getCoinButton = addButton("Get 2,000 coins"); 
      getCoinButton.setId(R.id.two_thousand); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getTwoThousandCoins(v); 
       } 
      }); 
     } 

     if (coins >= 5001) 
     { 
      Button getCoinButton = addButton("Get 5,000 coins"); 
      getCoinButton.setId(R.id.five_thousand); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getFiveThousandCoins(v); 
       } 
      }); 
     } 

     if (coins >= 10001) 
     { 
      Button getCoinButton = addButton("Get 10,000 coins"); 
      getCoinButton.setId(R.id.ten_thousand); 
      getCoinButton.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) { 
        getTenThousandCoins(v); 
       } 
      }); 
     } 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     MenuInflater inflater = getMenuInflater(); 
     inflater.inflate(R.menu.action_items, menu); 
     return true; 
    } 

    public boolean onOptionsItemSelected(MenuItem item) { 
     switch (item.getItemId()) { 
      case R.id.rules: 
       // User chose the "Settings" item, show the app settings UI... 
       return true; 

      case R.id.action_settings: 
       // User chose the "Favorite" action, mark the current item 
       // as a favorite... 
       return true; 

      case android.R.id.home: 
       return true; 

      default: 
       // If we got here, the user's action was not recognized. 
       // Invoke the superclass to handle it. 
       return super.onOptionsItemSelected(item); 
     } 
    } 




    public void getOneCoin(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 1); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getTenCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 10); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getTwentyCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 20); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getOneHundredCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 100); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getFiveHundredCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 500); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getTwoThousandCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 2000); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getFiveThousandCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 5000); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void getTenThousandCoins(View view){ 
     Intent intent = new Intent(this, gamble.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
     intent.putExtra("GAMBLE", 10000); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public Button addButton(String name) 
    { 
     LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linearLayout); 
     Button newCoinButton = new Button(this); 
     newCoinButton.setText(name); 
     newCoinButton.setTextSize(30); 
     //newCoinButton.setBackgroundColor(buttonColor); 
     newCoinButton.setTextColor(textColor); 
     //newCoinButton.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); 
     linearLayout.addView(newCoinButton); 

     return newCoinButton; 
    } 

    public DataPoint[] generateData() 
    { 
     int size = coinsOverTime.size(); 
     DataPoint[] values = new DataPoint[size]; 
     for (int i=0; i<size; i++) 
     { 
      int y1 = coinsOverTime.get(i); 
      DataPoint v = new DataPoint(i, y1); 
      values[i] = v; 
     } 

     return values; 
    } 
} 

和這裏的賭博活動也會談...

package com.example.getcoins; 

import android.content.Intent; 
import android.os.Bundle; 
import android.support.v7.app.ActionBar; 
import android.support.v7.app.AppCompatActivity; 
import android.support.v7.widget.Toolbar; 
import android.view.Menu; 
import android.view.MenuInflater; 
import android.view.View; 
import android.widget.TextView; 

import java.util.ArrayList; 
import java.util.Collections; 

public class gamble extends AppCompatActivity { 

    ArrayList<Integer> buttonValues = getButtonValues(); 
    //ArrayList<Integer> coinHistory = getCoinHistory(); 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_gamble); 
     Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); 
     setSupportActionBar(myToolbar); 
     ActionBar ab = getSupportActionBar(); 
     ab.setDisplayHomeAsUpEnabled(false); 

     TextView textViewLeft = (TextView) findViewById(R.id.textView2); 
     TextView textViewRight = (TextView) findViewById(R.id.textView3); 
     TextView textViewCoins = (TextView) findViewById(R.id.textView4); 

     textViewCoins.setText("Good Luck!"); 


     if (buttonValues.get(0) == 0) 
     { 
      textViewLeft.setText("Winner"); 
     } 

     else 
     { 
      textViewLeft.setText("Loser"); 
     } 

     if (buttonValues.get(1) == 0) 
     { 
      textViewRight.setText("Winner"); 
     } 

     else 
     { 
      textViewRight.setText("Loser"); 
     } 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     MenuInflater inflater = getMenuInflater(); 
     inflater.inflate(R.menu.action_items, menu); 
     return true; 
    } 

    public ArrayList<Integer> getButtonValues() 
    { 
     ArrayList<Integer> buttonvalues = new ArrayList<Integer>(); 
     buttonvalues.add(0); 
     buttonvalues.add(1); 
     Collections.shuffle(buttonvalues); 
     return buttonvalues; 
    } 

    public void leftButtonClick(View view) 
    { 
     if (buttonValues.get(0) == 0) 
     { 
      winner(); 
     } 

     else 
     { 
      loser(); 
     } 
    } 

    public void rightButtonClick(View view) 
    { 
     if (buttonValues.get(1) == 0) 
     { 
      winner(); 
     } 

     else 
     { 
      loser(); 
     } 
    } 

    public void winner() 
    { 
     Intent oldintent = getIntent(); 
     Bundle oldbundle = oldintent.getExtras(); 
     int gambleamount = oldintent.getIntExtra("GAMBLE", 1); 
     int coins = oldintent.getIntExtra("COINS", 1); 
     ArrayList<Integer> coinHistory = oldbundle.getIntegerArrayList("COIN_HISTORY"); 

     Intent intent = new Intent(this, MainActivity.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinHistory); 
     intent.putExtra("WINNER", true); 
     intent.putExtra("GAMBLE", gambleamount); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 

    public void loser() 
    { 
     Intent oldintent = getIntent(); 
     Bundle oldbundle = oldintent.getExtras(); 
     int gambleamount = oldintent.getIntExtra("GAMBLE", 1); 
     int coins = oldintent.getIntExtra("COINS", 1); 
     ArrayList<Integer> coinHistory = oldbundle.getIntegerArrayList("COIN_HISTORY"); 

     Intent intent = new Intent(this, MainActivity.class); 
     Bundle bundle = new Bundle(); 
     bundle.putIntegerArrayList("COIN_HISTORY", coinHistory); 
     intent.putExtra("WINNER", false); 
     intent.putExtra("GAMBLE", gambleamount); 
     intent.putExtra("COINS", coins); 
     intent.putExtras(bundle); 
     startActivity(intent); 
    } 
} 

我感謝所有幫助任何人都可能能夠提供。

盧克

更新:這是我的logcat的......或者至少是我認爲這是相關部分。一旦發生事故,我抓住了它給我的文字。

04-06 16:10:39.091 3897-3897/? I/art: Late-enabling -Xcheck:jni 
04-06 16:10:39.322 3897-3897/com.example.getcoins W/System: ClassLoader referenced unknown path: /data/app/com.example.getcoins-1/lib/arm64 
04-06 16:10:39.363 3897-3897/com.example.getcoins I/InstantRun: Starting Instant Run Server for com.example.getcoins 
04-06 16:10:42.158 3897-3897/com.example.getcoins W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
04-06 16:10:42.643 3897-3897/com.example.getcoins D/AndroidRuntime: Shutting down VM 
04-06 16:10:42.645 3897-3897/com.example.getcoins E/AndroidRuntime: FATAL EXCEPTION: main 
                    Process: com.example.getcoins, PID: 3897 
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.getcoins/com.example.getcoins.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.ArrayList.add(java.lang.Object)' on a null object reference 
                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2671) 
                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2736) 
                     at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478) 
                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                     at android.os.Looper.loop(Looper.java:154) 
                     at android.app.ActivityThread.main(ActivityThread.java:6154) 
                     at java.lang.reflect.Method.invoke(Native Method) 
                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 
                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) 
                    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.ArrayList.add(java.lang.Object)' on a null object reference 
                     at com.example.getcoins.MainActivity.onCreate(MainActivity.java:50) 
                     at android.app.Activity.performCreate(Activity.java:6683) 
                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140) 
                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624) 
                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2736)  
                     at android.app.ActivityThread.-wrap12(ActivityThread.java)  
                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)  
                     at android.os.Handler.dispatchMessage(Handler.java:102)  
                     at android.os.Looper.loop(Looper.java:154)  
                     at android.app.ActivityThread.main(ActivityThread.java:6154)  
                     at java.lang.reflect.Method.invoke(Native Method)  
                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)  
                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)  

UPDATE:

首先,感謝您的答覆!這對我來說非常有教育意義!我想按照我目前的想法運行,看看我是否在正確的軌道上。看起來,當應用程序首次編譯到我的手機上時,一切都可以(即主要活動中的全局變量可以正確查看和處理)。

然而,看着鏈接後帕維爾B.建議我看看,好像是通過這個過程...... A simplified illustration of the activity lifecycle.

......一旦我終止該應用並打開它回來了,它會直接到onCreate()方法(並且似乎跳過了上面定義的全局變量)。這是怎麼回事?

我投了評論,我發現有用的,但它說,因爲我的名聲小於15也不會公開。

再次謝謝你太棒了!

盧克

+0

讓我們解決您的問題的最簡單方法是分享您的日誌貓。 –

+0

您可以在左側屏幕底部的欄中點擊_Android Monitor_,以查看logcat – Sunshinator

+0

謝謝Sunshinator指引我找到logcat的正確方向。我已經把它貼在上面了! –

回答

0

這可能會或可能不會解決您的問題,但是當你從你的主要活動打電話給你的「賭博」的活動,你應該使用startActivityForResult(),並註冊一個回調接收處理結果.. 。

即你目前「正在啓動」您的主要活動本身上,而不是僅僅通過的setResult

見傳遞結果返回給它:

https://developer.android.com/training/basics/intents/result.html

https://developer.android.com/reference/android/os/ResultReceiver.html

UPDATE:

考慮創建一個靜態的最終請求的代碼,你可以使用:

public static final int REQUEST_CODE_GAMBLE = 172; 

改變你的getCoin方法startActivityForResult( ),使用你的st ATIC請求代碼:

public void getOneCoin(View view){ 
    Intent intent = new Intent(this, gamble.class); 
    Bundle bundle = new Bundle(); 
    bundle.putIntegerArrayList("COIN_HISTORY", coinsOverTime); 
    intent.putExtra("GAMBLE", 1); 
    intent.putExtra("COINS", coins); 
    intent.putExtras(bundle); 
    startActivityForResult(intent, REQUEST_CODE_GAMBLE); 
} 

然後重寫onActivityResult()在您的MainActivity:

@Override 
protected void onActivityResult(final int requestCode, final int resultCode, final Intent intent){ 
super.onActivityResult(requestCode, resultCode, intent); 
    if(requestCode == REQUEST_CODE_GAMBLE){ 
     if(resultCode == RESULT_OK){ 

      //do all that same stuff you were doing in onCreate() in your MainActivity 
      //i.e. : 
      coins = intent.getIntExtra("COINS", 1); 
      //etc 

     } 
    } 


} 

然後在冠軍()和輸家()在賭博活動的方法,簡單地設置結果並致電完成():

public void winner() 
{ 
    Intent oldintent = getIntent(); 
    Bundle oldbundle = oldintent.getExtras(); 
    int gambleamount = oldintent.getIntExtra("GAMBLE", 1); 
    int coins = oldintent.getIntExtra("COINS", 1); 
    ArrayList<Integer> coinHistory = oldbundle.getIntegerArrayList("COIN_HISTORY"); 
    Intent intent = new Intent(); 
    Bundle bundle = new Bundle(); 
    bundle.putIntegerArrayList("COIN_HISTORY", coinHistory); 
    intent.putExtra("WINNER", true); 
    intent.putExtra("GAMBLE", gambleamount); 
    intent.putExtra("COINS", coins); 
    intent.putExtras(bundle); 
    getParent().setResult(Activity.RESULT_OK, intent); 
    finish(); 
} 

當您的賭博活動y「完成」,它會將所有意圖數據發送到您的MainActivity的新的onActivityResult()方法,並且您可以使用它執行您想要的操作

+0

非常感謝你爲這個信息buradd!我還沒有聽說過這個功能,但它肯定聽起來像是即使這不是我目前問題的解決方法,也是我想要做的事情,所以謝謝!我也在上面添加了我的logcat。 –

+0

不客氣,如果它可以幫助你考慮投票 - 如果它最終解決了你的問題,考慮接受答案..在查看你的logcat後,我相信這會解決你的問題,因爲你的崩潰是因爲你的數組列表爲空,因爲它沒有從意圖中得到任何東西,因爲你的主要活動已經在沒有它的情況下創建了。將這些數據放入onActivityResult()的回調接收器中很可能會解決這個問題 – buradd

+0

在與一位朋友交談後,他暗示我沒有「 t正確地聲明一旦我結束應用程序會發生什麼(聽起來像他說我應該在應用程序被要求銷燬時清除我的數組列表)。 我目前主要感興趣的是沒有得到aoo運行,但更好地理解爲什麼我的arraylist是空的,當我試圖重新打開它。我無法理解我的手機正在做什麼哈哈 –

0

看來錯誤在於您的coinsOverTime數組爲空。當您的活動以將數組存儲爲額外的意圖開始時,它工作正常,但是當您的應用程序正在關閉屏幕並返回時,情況並非如此。

當您按下home時,您的活動應保存其狀態並在屏幕上恢復。 請閱讀保存和恢復活動狀態節在這裏: https://developer.android.com/guide/components/activities/activity-lifecycle.html

0

只要把if(coinsOverTime != null)coinsOverTime.add(coins);每一個地方之前。發生此次崩潰是因爲您的活動恢復時coinsOverTime數組爲空指針。

+0

這甚至沒有接近解決他的問題,它會停止崩潰,但他將不會有任何數據爲他的arraylist ..這就像建議一個空嘗試/ catch – buradd

+0

這是正確的。他的Android編程是基本的,他只是想在他的應用程序中防止崩潰問題。 – Afshin