私はこの.xmlファイルを持っています....私のコード全体を提示するために
<receiver android:name=".broad_2">
<intent-filter>
<action android:name="android.intent.action.DATE_CHANGED"></action>
</intent-filter>
</receiver>
<activity
android:name=".the_rock_iss"
android:label="time_change_hua" >
<intent-filter>
<action android:name="android.intent.action.HO_HO_HO" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
& 私はこの受信機を使用して、デバイスで日付が変更されたことを確認しました
public void onReceive(Context context, Intent intent)
{
if(intent.getAction().equals(Intent.ACTION_DATE_CHANGED))
{
Intent i = new Intent();
i.setClassName("com.example.time_change_ho_tho_activity_start_ho", "com.example.time_change_ho_tho_activity_start_ho.the_rock_iss");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
&このレシーバーから、アクティビティを開きたいです。これは....日付を変更した後、エミュレータに表示されません!
public void onCreate ( Bundle bun )
{
super.onCreate(bun);
setContentView(R.layout.activity_main);
}
&このために、ユーザーインターフェイスを表示するために、この.xmlファイルがあります。
<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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>