This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyReceiver extends BroadcastReceiver { | |
| public MyReceiver() { | |
| } | |
| @Override | |
| public void onReceive(Context context, Intent intent) { | |
| Toast.makeText(context, "Action: " + intent.getAction(), Toast.LENGTH_SHORT).show(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" | |
| android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" | |
| android:paddingRight="@dimen/activity_horizontal_margin" | |
| android:paddingTop="@dimen/activity_vertical_margin" | |
| android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> | |
| <TextView | |
| android:id="@+id/textView1" | |
| android:layout_width="wrap_content" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="com.example.tutorialspoint7.myapplication"> | |
| <application | |
| android:allowBackup="true" | |
| android:icon="@mipmap/ic_launcher" | |
| android:label="@string/app_name" | |
| android:supportsRtl="true" | |
| android:theme="@style/AppTheme"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.behindjava.myapplication; | |
| import android.app.Service; | |
| import android.content.Intent; | |
| import android.os.IBinder; | |
| import android.support.annotation.Nullable; | |
| import android.widget.Toast; | |
| public class MyService extends Service { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.behindjava.myapplication; | |
| import android.content.Intent; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.os.Bundle; | |
| import android.app.Activity; | |
| import android.util.Log; | |
| import android.view.View; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package behindjava.com.fragmentexample; | |
| import android.os.Bundle; | |
| import android.support.v4.app.Fragment; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| public class Fragment2 extends Fragment { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package behindjava.com.fragmentexample; | |
| import android.os.Bundle; | |
| import android.support.v4.app.Fragment; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| public class Fragment1 extends Fragment { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package behindjava.com.fragmentexample; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| public class MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:background="#F0FFFF" | |
| tools:context="example.javatpoint.com.fragmentexample.Fragment2"> | |
| <!-- TODO: Update blank fragment layout --> | |
| <TextView | |
| android:layout_width="match_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:background="#F5F5DC" | |
| tools:context="example.javatpoint.com.fragmentexample.Fragment1"> | |
| <!-- TODO: Update blank fragment layout --> | |
| <TextView | |
| android:layout_width="match_parent" |