עזרה | בעניין אפליקציית me אופליין.
-
היי חברים,
בהמשך לנושא שאני טרוד ממנו יום יום
אני רוצה קודם ליצור אפליקציה, יש לי מאגר, (אומנם לא גדול, אבל לאט לאט) ואני רוצה לראות איך זה יעבוד עם מה שיש,
בקשתי מgpt שיצור לי אפליקציה, והוא נתן לי קודים לעתיק ל'אנדרואיד סטודיו' ואין לי אנדרואיד סטודיו בשביל לעשות את זה, הקודים יהיו בספוילר בהמשך,
אני סגרתי את gpt, אבל כבר בפעם הראשונה בקשתי ממנו שישמור לי את הקודים, מקווה שהוא שמר,
אז הנה הקודים
קובץ מספר 1package com.example.numberidentifier import android.os.Bundle import android.widget.* import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { private val phoneBook = mutableMapOf( "0501234567" to "יוסי כהן", "0529876543" to "דוד לוי" ) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val phoneInput = findViewById<EditText>(R.id.phoneInput) val resultText = findViewById<TextView>(R.id.resultText) val checkButton = findViewById<Button>(R.id.checkButton) val addButton = findViewById<Button>(R.id.addButton) checkButton.setOnClickListener { val number = phoneInput.text.toString() val name = phoneBook[number] if (name != null) { resultText.text = name } else { resultText.text = "המספר לא נמצא" } } addButton.setOnClickListener { val dialog = AddNumberDialog { number, name -> phoneBook[number] = name Toast.makeText(this, "נשמר בהצלחה", Toast.LENGTH_SHORT).show() } dialog.show(supportFragmentManager, "AddDialog") } } }קובץ מספר 2
package com.example.numberidentifier import android.app.Dialog import android.os.Bundle import android.view.LayoutInflater import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment class AddNumberDialog( private val onSave: (String, String) -> Unit ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val view = LayoutInflater.from(context).inflate(R.layout.dialog_add, null) val numberInput = view.findViewById<EditText>(R.id.numberInput) val nameInput = view.findViewById<EditText>(R.id.nameInput) return AlertDialog.Builder(requireContext()) .setTitle("הוספת מספר") .setView(view) .setPositiveButton("שמור") { _, _ -> onSave(numberInput.text.toString(), nameInput.text.toString()) } .setNegativeButton("ביטול", null) .create() } }קובץ מספר 3
<?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" android:padding="24dp"> <EditText android:id="@+id/phoneInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="הכנס מספר טלפון" android:inputType="phone"/> <Button android:id="@+id/checkButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="בדוק"/> <TextView android:id="@+id/resultText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:paddingTop="16dp"/> <Button android:id="@+id/addButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="הוסף מספר"/> </LinearLayout>קובץ מספר 4
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="16dp" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/numberInput" android:hint="מספר טלפון" android:inputType="phone" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/nameInput" android:hint="שם מלא" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout> -
היי חברים,
בהמשך לנושא שאני טרוד ממנו יום יום
אני רוצה קודם ליצור אפליקציה, יש לי מאגר, (אומנם לא גדול, אבל לאט לאט) ואני רוצה לראות איך זה יעבוד עם מה שיש,
בקשתי מgpt שיצור לי אפליקציה, והוא נתן לי קודים לעתיק ל'אנדרואיד סטודיו' ואין לי אנדרואיד סטודיו בשביל לעשות את זה, הקודים יהיו בספוילר בהמשך,
אני סגרתי את gpt, אבל כבר בפעם הראשונה בקשתי ממנו שישמור לי את הקודים, מקווה שהוא שמר,
אז הנה הקודים
קובץ מספר 1package com.example.numberidentifier import android.os.Bundle import android.widget.* import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { private val phoneBook = mutableMapOf( "0501234567" to "יוסי כהן", "0529876543" to "דוד לוי" ) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val phoneInput = findViewById<EditText>(R.id.phoneInput) val resultText = findViewById<TextView>(R.id.resultText) val checkButton = findViewById<Button>(R.id.checkButton) val addButton = findViewById<Button>(R.id.addButton) checkButton.setOnClickListener { val number = phoneInput.text.toString() val name = phoneBook[number] if (name != null) { resultText.text = name } else { resultText.text = "המספר לא נמצא" } } addButton.setOnClickListener { val dialog = AddNumberDialog { number, name -> phoneBook[number] = name Toast.makeText(this, "נשמר בהצלחה", Toast.LENGTH_SHORT).show() } dialog.show(supportFragmentManager, "AddDialog") } } }קובץ מספר 2
package com.example.numberidentifier import android.app.Dialog import android.os.Bundle import android.view.LayoutInflater import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment class AddNumberDialog( private val onSave: (String, String) -> Unit ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val view = LayoutInflater.from(context).inflate(R.layout.dialog_add, null) val numberInput = view.findViewById<EditText>(R.id.numberInput) val nameInput = view.findViewById<EditText>(R.id.nameInput) return AlertDialog.Builder(requireContext()) .setTitle("הוספת מספר") .setView(view) .setPositiveButton("שמור") { _, _ -> onSave(numberInput.text.toString(), nameInput.text.toString()) } .setNegativeButton("ביטול", null) .create() } }קובץ מספר 3
<?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" android:padding="24dp"> <EditText android:id="@+id/phoneInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="הכנס מספר טלפון" android:inputType="phone"/> <Button android:id="@+id/checkButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="בדוק"/> <TextView android:id="@+id/resultText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:paddingTop="16dp"/> <Button android:id="@+id/addButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="הוסף מספר"/> </LinearLayout>קובץ מספר 4
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="16dp" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/numberInput" android:hint="מספר טלפון" android:inputType="phone" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/nameInput" android:hint="שם מלא" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout>@בונפד כאלה דברים עובדים עם AI STUDIO
-
@בונפד כאלה דברים עובדים עם AI STUDIO
@קראנץ-ונילה אבל מישהו יוכל לעתיק את כל זה ל'אנדרואיד סטודיו' ולייצר אפליקציה בבקשה?
-
@קראנץ-ונילה אבל מישהו יוכל לעתיק את כל זה ל'אנדרואיד סטודיו' ולייצר אפליקציה בבקשה?
@בונפד איפה כל המספרים נמצאים?
-
@בונפד איפה כל המספרים נמצאים?
@מגנוס-קרלסן כתב בעזרה | בעניין אפליקציית me אופליין.:
@בונפד איפה כל המספרים נמצאים?
לא משנה כרגע איפה המאגר נמצא, קודם אני רוצה ליצור אפליקציה.
-
@מגנוס-קרלסן כתב בעזרה | בעניין אפליקציית me אופליין.:
@בונפד איפה כל המספרים נמצאים?
לא משנה כרגע איפה המאגר נמצא, קודם אני רוצה ליצור אפליקציה.
@בונפד ברור שזה משנה,
כי אם אין מספרים אז לא צריך את האפליקציה -
@מגנוס-קרלסן כתב בעזרה | בעניין אפליקציית me אופליין.:
@בונפד איפה כל המספרים נמצאים?
לא משנה כרגע איפה המאגר נמצא, קודם אני רוצה ליצור אפליקציה.
-
יש פה אי הבנה
יש אפליקציה, ויש מאגר, את המאגר מכניסים לתוך האפליקציה, ואז זה עובד, ועכשיו אני רוצה לבנות אפליקציה כדי להכניס את המאגר הקטן שיש אצלי, לראות אם זה בכלל עובד, ואז לשתף את חברי הפורום!!
מקובל?@בונפד נכון, אבל המאגר מבוסס על משהו
והמפתח של האפליקציה צריך לדעת על מה -
היי חברים,
בהמשך לנושא שאני טרוד ממנו יום יום
אני רוצה קודם ליצור אפליקציה, יש לי מאגר, (אומנם לא גדול, אבל לאט לאט) ואני רוצה לראות איך זה יעבוד עם מה שיש,
בקשתי מgpt שיצור לי אפליקציה, והוא נתן לי קודים לעתיק ל'אנדרואיד סטודיו' ואין לי אנדרואיד סטודיו בשביל לעשות את זה, הקודים יהיו בספוילר בהמשך,
אני סגרתי את gpt, אבל כבר בפעם הראשונה בקשתי ממנו שישמור לי את הקודים, מקווה שהוא שמר,
אז הנה הקודים
קובץ מספר 1package com.example.numberidentifier import android.os.Bundle import android.widget.* import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { private val phoneBook = mutableMapOf( "0501234567" to "יוסי כהן", "0529876543" to "דוד לוי" ) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val phoneInput = findViewById<EditText>(R.id.phoneInput) val resultText = findViewById<TextView>(R.id.resultText) val checkButton = findViewById<Button>(R.id.checkButton) val addButton = findViewById<Button>(R.id.addButton) checkButton.setOnClickListener { val number = phoneInput.text.toString() val name = phoneBook[number] if (name != null) { resultText.text = name } else { resultText.text = "המספר לא נמצא" } } addButton.setOnClickListener { val dialog = AddNumberDialog { number, name -> phoneBook[number] = name Toast.makeText(this, "נשמר בהצלחה", Toast.LENGTH_SHORT).show() } dialog.show(supportFragmentManager, "AddDialog") } } }קובץ מספר 2
package com.example.numberidentifier import android.app.Dialog import android.os.Bundle import android.view.LayoutInflater import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AlertDialog import androidx.fragment.app.DialogFragment class AddNumberDialog( private val onSave: (String, String) -> Unit ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val view = LayoutInflater.from(context).inflate(R.layout.dialog_add, null) val numberInput = view.findViewById<EditText>(R.id.numberInput) val nameInput = view.findViewById<EditText>(R.id.nameInput) return AlertDialog.Builder(requireContext()) .setTitle("הוספת מספר") .setView(view) .setPositiveButton("שמור") { _, _ -> onSave(numberInput.text.toString(), nameInput.text.toString()) } .setNegativeButton("ביטול", null) .create() } }קובץ מספר 3
<?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" android:padding="24dp"> <EditText android:id="@+id/phoneInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="הכנס מספר טלפון" android:inputType="phone"/> <Button android:id="@+id/checkButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="בדוק"/> <TextView android:id="@+id/resultText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:paddingTop="16dp"/> <Button android:id="@+id/addButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="הוסף מספר"/> </LinearLayout>קובץ מספר 4
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="16dp" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/numberInput" android:hint="מספר טלפון" android:inputType="phone" android:layout_width="match_parent" android:layout_height="wrap_content"/> <EditText android:id="@+id/nameInput" android:hint="שם מלא" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout>אתה בטח כבר יודע שאני לא אוהב שנותנים לי קוד להכניס,
א׳ כי אם זה מ gpt סיכוי מאוד גדול שיהיה בעיות ואז אני צריך לשבור תראש לבד ב׳ לפי מה שאני רואה בקוד עדיין אין מאגר והוא לא מסוגל בכלל לקרוא מאגר או לשמור במאגר (הוא שומר במשתנה) ואז אין לי זמן לתיזוזים