android - How can we Change Activity's theme programmatically -


i have created android app.i want when gets installed in device show no gui part. when broadcast message server, on selection of notification want user show gui part. how can android?

i tried in notification function starting new intent

 settheme(android.r.style.theme); 

this in manifest.xml file

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.iween.gcmclient" android:versioncode="1" android:versionname="1.0">       <uses-sdk          android:minsdkversion="8"          android:targetsdkversion="17"/>      <!-- gcm connects google services. -->     <uses-permission android:name="android.permission.internet" />      <!-- gcm requires google account. -->     <uses-permission android:name="android.permission.get_accounts" />      <!-- keeps processor sleeping when message received. -->     <uses-permission android:name="android.permission.wake_lock" />      <permission          android:name="com.example.iween.gcmclient.permission.c2d_message"         android:protectionlevel="signature" />     <uses-permission          android:name="com.example.iween.gcmclient.permission.c2d_message" />      <!-- app has permission register , receive data message. -->     <uses-permission         android:name="com.google.android.c2dm.permission.receive" />      <!-- main activity. -->     <application         android:icon="@drawable/ic_launcher"         android:label="@string/app_name" >         <activity             android:name="com.example.iween.gcmclient.demoactivity"             android:label="@string/app_name"             android:configchanges="orientation|keyboardhidden|screensize"             android:launchmode="singletop">             <intent-filter>                 <action                      android:name="android.intent.action.main" />             <category                  android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <receiver             android:name="com.example.iween.gcmclient.gcmbroadcastreceiver"             android:permission="com.google.android.c2dm.permission.send" >             <intent-filter>                 <!-- receives actual messages. -->                 <action android:name="com.google.android.c2dm.intent.receive" />                 <category android:name="com.google.android.gcm.demo.app" />             </intent-filter>         </receiver>         <service android:name="com.example.iween.gcmclient.gcmintentservice" />     </application>  </manifest> 

notification function

private void sendnotification(string recivedmessage) {         mnotificationmanager = (notificationmanager)                 this.getsystemservice(context.notification_service);          pendingintent contentintent = pendingintent.getactivity(this, 0,                 new intent(this, demoactivity.class), 0);        notificationcompat.builder mbuilder =                 new notificationcompat.builder(this)         .setsmallicon(r.drawable.ic_stat_gcm)         .setcontenttitle("iween notification")         .setstyle(new notificationcompat.bigtextstyle()         .bigtext(recivedmessage))         .setcontenttext(recivedmessage);          mbuilder.build().flags = notification.flag_auto_cancel;         uri notificationsound = ringtonemanager.getdefaulturi(ringtonemanager.type_notification);         mbuilder.setsound(notificationsound);         mbuilder.setautocancel(true);         mbuilder.setcontentintent(contentintent);         mnotificationmanager.notify(notification_id, mbuilder.build());     } 

try way

create 1 public static int variable update when notification receives

for eg in receiver class

public static int theme = 0; onreceive(){    if(cond1){        theme = r.style.them1;   }else if(cond2){        theme = r.style.them2;   }  }     @override     protected void oncreate(bundle savedinstancestate) {                if(theme!=0){                  settheme(theme);               }          super.oncreate(savedinstancestate); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -