This afternoon encounter problems between screen pass parameters through pointers that can be used to save the global rewrite Application Data
Examples http://www.eoeandroid.com/thread-30257-1-1.html
then post on according to
Made a small example, but always reported ClassCastException, wrong seek expert advice in the following code
android.app.Application
appTest.java
public class appTest extends Activity {
/ ** Called when the activity is first created. * /
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
. ((App) getApplication ()) setDemo ("sss");
String demo = ((App) getApplication ()) getDemo ();.
}
}
Application files rewritten
App.java
import android.app.Application;
public class App extends Application {
private String demo;
public String getDemo () {
return demo;
}
public void setDemo (String demo) {
this.demo = demo;
}
}
AndroidManifest.xml
android: versionCode = "1"
android: versionName = "1.0">
android: label = "@ string / app_name">
App.java and appTest.java are com.appTest
in the same package
Seek expert advice! ~! ~! ~ Thank you brother first
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Solve the problem is not configured to AndroidManifest android: name = ". App" into the first application configured in just fine
Reply:
Get it to pick points up :)
Reply:
Do not understand how
Reply:
http://www.eoeandroid.com/thread-30257-1-1.html
Reply:
this can take points
No comments:
Post a Comment