farhoali

توسعه دهنده اندروید
  • تعداد ارسال ها

    1
  • تاریخ عضویت

  • آخرین بازدید

اعتبار در انجمن

0 Neutral

درباره farhoali

  • درجه
    Newbie
  1. سلام دوستان من تازه برنامه نویسی آندروید رو شروع کردم و در اجرای یه برنامه که می خواد عکس و متن رو از دیتابیس mysql بخونه بوسیله JSON به مشکل برخوردم البته برنامه خطا نداره ولی موقع لود اطلاعات کرش میکنه و خارج میشه. اینم اضافه کنم ورژن آندرید من 3.1.2 هست و از گردل 4.4 استفاده میکنم و build.gradle من اینه: apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.example.farshid.appand" minSdkVersion 14 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } و یه دیتابیس داخل gigfa ساختم و اسم دیتابیسم gigfa_22018905_sampleDB و یه جدول دارم با 3 فیلد یid, AndroidNames, ImagePath و اضافه کنم که فایل connection.php : <?php $servername = "sql207.gigfa.com"; //replace it with your database server name $username = "gigfa_22018905"; //replace it with your database username $password = "farshid"; //replace it with your database password $dbname = "gigfa_22018905_sampleDB"; // Create connection $con = mysqli_connect($servername, $username, $password, $dbname); // Check connection //if (!$con) { // die("Connection failed: " . mysqli_connect_error()); //} ?> فایل getandroidosnames.php : <?php require_once('connection.php'); $sql = "SELECT * FROM androidosnames"; $r = mysqli_query($con,$sql); $result = array(); while($res = mysqli_fetch_array($r)){ array_push($result,array( "AndroidNames"=>$res['AndroidNames'], "ImagePath"=>$res['ImagePath'] ) ); } echo json_encode(array("result"=>$result)); mysqli_close($con); exit(); ?> و سه تا فایل جاوا دارم که به ترتیب: Customadapter.java import android.app.Activity; import android.graphics.Bitmap; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; /** * Created by Shree on 10/25/2016. */ public class Customadapter extends ArrayAdapter<String> { private String[] androidosnames; private String[] urls; private Bitmap[] bitmaps; private Activity context; public Customadapter(Activity context, String[] androidosnames, Bitmap[] bitmaps ) { super(context, R.layout.layout, androidosnames); this.context = context; // this.urls = urls; this.bitmaps = bitmaps; this.androidosnames = androidosnames; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View listViewItem = inflater.inflate(R.layout.layout, null, true); TextView androidos = (TextView) listViewItem.findViewById(R.id.tvandroidosnames); // TextView textView = (TextView) listViewItem.findViewById(R.id.tvurl); // textView.setText(urls[position] ); androidos.setText(androidosnames[position] ); ImageView image = (ImageView) listViewItem.findViewById(R.id.imgvw); image.setImageBitmap(Bitmap.createScaledBitmap(bitmaps[position], 100, 50, false)); return listViewItem; } } فایل Getjson.java import android.graphics.Bitmap; import android.graphics.BitmapFactory; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; /** * Created by Shree on 10/25/2016. */ public class Getjson { public static String[] Image_Url; public static Bitmap[] bitmaps; public static String[] Android_Name; public static final String JSON_ARRAY="result"; public static final String IMAGEURL = "ImagePath"; public static final String AndroidName = "AndroidNames"; private String json; private JSONArray urls; public Getjson(String json){ this.json = json; try { JSONObject jsonObject = new JSONObject(json); urls = jsonObject.getJSONArray(JSON_ARRAY); } catch (JSONException e) { e.printStackTrace(); } } private Bitmap getImage(JSONObject jo){ URL url = null; Bitmap image = null; try { url = new URL(jo.getString(IMAGEURL)); image = BitmapFactory.decodeStream(url.openConnection().getInputStream()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return image; } public void getAllImages() throws JSONException { Android_Name = new String[urls.length()]; Image_Url = new String[urls.length()]; bitmaps = new Bitmap[urls.length()]; for(int i=0;i<urls.length();i++) { Android_Name[i]= urls.getJSONObject(i).getString(AndroidName); Image_Url[i] = urls.getJSONObject(i).getString(IMAGEURL); JSONObject jsonObject = urls.getJSONObject(i); bitmaps[i]=getImage(jsonObject); } } } و فایل MainActivity import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ListView; import org.json.JSONArray; import org.json.JSONException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class MainActivity extends AppCompatActivity { ListView lst; private static final String newurl = "http://farshidpc.gigfa.com/getandroidosnames.php"; private String json; private JSONArray urls; public Getjson getjsonobj; Customadapter customadapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lst = (ListView) findViewById(R.id.lst); getURLs(); } //Get FoodTYpe private void getImages() { class GetImages extends AsyncTask<Void, Void, Void> { ProgressDialog loading; @Override protected void onPreExecute() { super.onPreExecute(); loading = ProgressDialog.show(MainActivity.this, "Loading Menu", "Please wait...", false, false); } @Override protected void onPostExecute(Void v) { super.onPostExecute(v); loading.dismiss(); customadapter = new Customadapter(MainActivity.this, getjsonobj.Android_Name ,getjsonobj.bitmaps ); lst.setAdapter(customadapter); } @Override protected Void doInBackground(Void... voids) { try { getjsonobj.getAllImages(); } catch (JSONException e) { e.printStackTrace(); } return null; } } GetImages getImages = new GetImages(); getImages.execute(); } private void getURLs() { class GetURLs extends AsyncTask<String, Void, String> { ProgressDialog loading; @Override protected void onPreExecute() { super.onPreExecute(); loading = ProgressDialog.show(MainActivity.this, "Loading...", "Please Wait...", true, true); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); loading.dismiss(); getjsonobj = new Getjson(s); getImages(); } @Override protected String doInBackground(String... strings) { BufferedReader bufferedReader = null; try { URL url = new URL(strings[0]); HttpURLConnection con = (HttpURLConnection) url.openConnection(); StringBuilder sb = new StringBuilder(); bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream())); String json; while ((json = bufferedReader.readLine()) != null) { sb.append(json + "\n"); } return sb.toString().trim(); } catch (Exception e) { return null; } } } GetURLs gu = new GetURLs(); gu.execute(newurl); } } و دو تا هم لایه دارم اولی activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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" tools:context=".MainActivity"> <ListView android:id="@+id/lst" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> و لایه layout.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ImageView android:id="@+id/imgvw" android:layout_width="100dp" android:layout_height="100dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" /> <TextView android:id="@+id/tvandroidosnames" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout> ببخشید طولانی شد و اخریش Logcat: 05-15 17:42:58.567 8939-8939/? E/Zygote: v2 05-15 17:42:58.567 8939-8939/? I/libpersona: KNOX_SDCARD checking this for 10222 KNOX_SDCARD not a persona 05-15 17:42:58.567 8939-8939/? W/SELinux: Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0034 05-15 17:42:58.567 8939-8939/? W/SELinux: SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=com.example.farshid.appand 05-15 17:42:58.567 8939-8939/? I/art: Late-enabling -Xcheck:jni 05-15 17:42:58.627 8939-8939/? D/TimaKeyStoreProvider: TimaSignature is unavailable 05-15 17:42:58.627 8939-8939/? D/ActivityThread: Added TimaKeyStore provider 05-15 17:42:58.777 8939-8939/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.037 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.117 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.197 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.287 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.367 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.447 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.527 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.607 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.687 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.777 8939-8939/com.example.farshid.appand W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/com.example.farshid.appand-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.farshid.appand-2@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status 05-15 17:42:59.787 8939-8939/com.example.farshid.appand W/System: ClassLoader referenced unknown path: /data/app/com.example.farshid.appand-2/lib/arm 05-15 17:42:59.787 8939-8939/com.example.farshid.appand I/InstantRun: starting instant run server: is main process 05-15 17:42:59.947 8939-8939/com.example.farshid.appand 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 05-15 17:43:00.167 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 setTypeface with style : 0 05-15 17:43:00.187 8939-8939/com.example.farshid.appand D/AbsListView: Get MotionRecognitionManager 05-15 17:43:00.187 8939-8939/com.example.farshid.appand E/MotionRecognitionManager: mSContextService = null motionService = com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@1c5f98e 05-15 17:43:00.207 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 05-15 17:43:00.217 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 05-15 17:43:00.237 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 setTypeface with style : 0 setTypeface with style : 0 05-15 17:43:00.247 8939-8939/com.example.farshid.appand D/SecWifiDisplayUtil: Metadata value : none 05-15 17:43:00.257 8939-8939/com.example.farshid.appand D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{1b6b2a2 V.E...... R.....I. 0,0-0,0} 05-15 17:43:00.257 8939-9094/com.example.farshid.appand D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 05-15 17:43:00.287 8939-9095/com.example.farshid.appand I/System.out: (HTTPLog)-Static: isSBSettingEnabled false (HTTPLog)-Static: isSBSettingEnabled false 05-15 17:43:00.287 8939-8939/com.example.farshid.appand D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{1f156ee I.E...... R.....ID 0,0-0,0} 05-15 17:43:00.317 8939-9094/com.example.farshid.appand I/Adreno: QUALCOMM build : 267cb1c, I741a3d36ca Build Date : 05/03/16 OpenGL ES Shader Compiler Version: XE031.06.00.05 Local Branch : Remote Branch : quic/LA.BR.1.2.6_rb1.13 Remote Branch : NONE Reconstruct Branch : NOTHING 05-15 17:43:00.327 8939-9094/com.example.farshid.appand I/OpenGLRenderer: Initialized EGL, version 1.4 05-15 17:43:00.367 8939-8939/com.example.farshid.appand D/AbsListView: onsize change 05-15 17:43:00.417 8939-8939/com.example.farshid.appand W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 05-15 17:43:00.437 8939-9094/com.example.farshid.appand D/libGLESv1: DTS_GLAPI : DTS is not allowed for Package : com.example.farshid.appand 05-15 17:43:00.507 8939-8939/com.example.farshid.appand D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1 MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1 05-15 17:43:00.857 8939-8939/com.example.farshid.appand D/ViewRootImpl: #3 mView = null 05-15 17:43:00.877 8939-8939/com.example.farshid.appand W/System.err: org.json.JSONException: Value <html><body><script of type java.lang.String cannot be converted to JSONObject at org.json.JSON.typeMismatch(JSON.java:111) at org.json.JSONObject.<init>(JSONObject.java:160) at org.json.JSONObject.<init>(JSONObject.java:173) at com.example.farshid.appand.Getjson.<init>(Getjson.java:26) at com.example.farshid.appand.MainActivity$1GetURLs.onPostExecute(MainActivity.java:69) at com.example.farshid.appand.MainActivity$1GetURLs.onPostExecute(MainActivity.java:58) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.access$500(AsyncTask.java:180) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7329) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 05-15 17:43:00.877 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 05-15 17:43:00.897 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 05-15 17:43:00.897 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 setTypeface with style : 0 05-15 17:43:00.907 8939-8939/com.example.farshid.appand D/TextView: setTypeface with style : 0 05-15 17:43:00.907 8939-8939/com.example.farshid.appand D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{2805311 V.E...... R.....I. 0,0-0,0} 05-15 17:43:00.917 8939-9130/com.example.farshid.appand E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2 Process: com.example.farshid.appand, PID: 8939 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference at com.example.farshid.appand.Getjson.getAllImages(Getjson.java:49) at com.example.farshid.appand.MainActivity$1GetImages.doInBackground(MainActivity.java:47) at com.example.farshid.appand.MainActivity$1GetImages.doInBackground(MainActivity.java:30) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) 05-15 17:43:00.987 8939-8939/com.example.farshid.appand E/ViewRootImpl: sendUserActionEvent() mView == null 05-15 17:43:01.007 8939-8939/com.example.farshid.appand D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1 05-15 17:43:01.227 8939-8939/com.example.farshid.appand D/ViewRootImpl: #3 mView = null 05-15 17:43:01.247 8939-8939/com.example.farshid.appand E/WindowManager: android.view.WindowLeaked: Activity com.example.farshid.appand.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{2805311 V.E...... R......D 0,0-1002,483} that was originally added here at android.view.ViewRootImpl.<init>(ViewRootImpl.java:603) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:326) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109) at android.app.Dialog.show(Dialog.java:505) at android.app.ProgressDialog.show(ProgressDialog.java:151) at android.app.ProgressDialog.show(ProgressDialog.java:139) at com.example.farshid.appand.MainActivity$1GetImages.onPreExecute(MainActivity.java:35) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604) at android.os.AsyncTask.execute(AsyncTask.java:551) at com.example.farshid.appand.MainActivity.getImages(MainActivity.java:55) at com.example.farshid.appand.MainActivity.access$000(MainActivity.java:14) at com.example.farshid.appand.MainActivity$1GetURLs.onPostExecute(MainActivity.java:70) at com.example.farshid.appand.MainActivity$1GetURLs.onPostExecute(MainActivity.java:58) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.access$500(AsyncTask.java:180) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7329) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 05-15 17:43:01.247 8939-8939/com.example.farshid.appand D/ViewRootImpl: #3 mView = null 05-15 17:43:04.367 8939-9130/com.example.farshid.appand I/Process: Sending signal. PID: 8939 SIG: 9 این همه پروژه من بود موقع اجرا کرش میکنه و خارج میشه خواهشا راهنماییم کنید اینو اجراش کنم