কম্পিউটার

অ্যান্ড্রয়েড অ্যাপে ক্যালেন্ডার ইভেন্টগুলি কীভাবে যুক্ত করবেন?


এই উদাহরণটি দেখায় কিভাবে আমি অ্যান্ড্রয়েডে ক্যালেন্ডার ইভেন্ট যোগ করব।

ধাপ 1 − অ্যান্ড্রয়েড স্টুডিওতে একটি নতুন প্রকল্প তৈরি করুন, ফাইল ⇒ নতুন প্রকল্পে যান এবং একটি নতুন প্রকল্প তৈরি করতে প্রয়োজনীয় সমস্ত বিবরণ পূরণ করুন৷

ধাপ 2 − res/layout/activity_main.xml-এ নিম্নলিখিত কোড যোগ করুন।

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="https://schemas.android.com/apk/res/android"
   xmlns:tools="https://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:padding="8dp"
   tools:context=".MainActivity">
   <Button
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:onClick="AddCalendarEvent"
      android:text="Add Calendar Event" />
   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      android:text="Calendar Event In Android"
      android:textSize="18sp"
      android:textStyle="bold" />
</RelativeLayout>

ধাপ 3 − src/MainActivity.java

-এ নিম্নলিখিত কোড যোগ করুন
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
   }
   public void AddCalendarEvent(View view) {
      Calendar calendarEvent = Calendar.getInstance();
      Intent i = new Intent(Intent.ACTION_EDIT);
      i.setType("vnd.android.cursor.item/event");
      i.putExtra("beginTime", calendarEvent.getTimeInMillis());
      i.putExtra("allDay", true);
      i.putExtra("rule", "FREQ=YEARLY");
      i.putExtra("endTime", calendarEvent.getTimeInMillis() + 60 * 60 * 1000);
      i.putExtra("title", "Calendar Event");
      startActivity(i);
   }
}

পদক্ষেপ 4৷ − androidManifest.xml

-এ নিম্নলিখিত কোড যোগ করুন
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="https://schemas.android.com/apk/res/android"
   package="app.com.sample">
   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
      <activity android:name=".MainActivity">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
   </application>
</manifest>

আপনার অ্যাপ্লিকেশন চালানোর চেষ্টা করা যাক. আমি ধরে নিচ্ছি আপনি আপনার কম্পিউটারের সাথে আপনার আসল অ্যান্ড্রয়েড মোবাইল ডিভাইসটি সংযুক্ত করেছেন৷ অ্যান্ড্রয়েড স্টুডিও থেকে অ্যাপটি চালানোর জন্য, আপনার প্রকল্পের কার্যকলাপ ফাইলগুলির একটি খুলুন এবং টুলবার থেকে রান আইকনে ক্লিক করুন। একটি বিকল্প হিসাবে আপনার মোবাইল ডিভাইস নির্বাচন করুন এবং তারপরে আপনার মোবাইল ডিভাইসটি পরীক্ষা করুন যা আপনার ডিফল্ট স্ক্রীন প্রদর্শন করবে -

অ্যান্ড্রয়েড অ্যাপে ক্যালেন্ডার ইভেন্টগুলি কীভাবে যুক্ত করবেন?

অ্যান্ড্রয়েড অ্যাপে ক্যালেন্ডার ইভেন্টগুলি কীভাবে যুক্ত করবেন?


  1. কিভাবে একটি অ্যান্ড্রয়েড অ্যাপে TextToSpeech তৈরি করবেন?

  2. কীভাবে ফেসবুকে অ্যান্ড্রয়েড অ্যাপ তৈরি করবেন?

  3. অ্যান্ড্রয়েডে প্রেফারেন্সস্ক্রিনে কীভাবে একটি বোতাম যুক্ত করবেন?

  4. অ্যান্ড্রয়েড স্টুডিওতে লাইব্রেরি হিসাবে জার কীভাবে যুক্ত করবেন?