我想让我的应用程序仅在横向模式下工作,但无法使其工作.我已经给出了screenOrientation = "landscape"即使第一页将处于横向模式,其他活动将是纵向的.
XML文件
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Main"
android:label="@string/app_name"
android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".IntroHome"
android:label="@string/app_name"
android:screenOrientation="landscape">
</activity>
<activity android:name=".ObjectivesPage"
android:label="@string/app_name"
android:screenOrientation="landscape" >
</activity>
<activity android:name=".MenuPage"
android:label="@string/app_name"
android:screenOrientation="landscape" >
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
JAVA CLASS
public class ObjectivesPage extends Activity{
ImageButton imgButton;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.objectivespage);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
imgButton = (ImageButton)findViewById(R.id.buttonCloseNGo);
imgButton.setOnClickListener(onClickCloseNGo);
}
private OnClickListener onClickCloseNGo = new OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent(ObjectivesPage.this,MenuPage.class);
startActivity(intent); …Run Code Online (Sandbox Code Playgroud) 我们如何解决这类错误 - >"这个应用程序,或它使用的库,正在使用NSQuickDrawView,已被弃用.应用程序应停止使用QuickDraw并转移到Quartz."
在MainActivity.java中
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://192.168.5.10/ijoomer_development/index.php?option=com_ijoomer&plg_name=jomsocial&pview=user&ptask=login&tmpl=component");
StringBuffer strBuffer = new StringBuffer("<data><username>" + username + "</username><password>" + password + "</password><lat>" + lat +"</lat><long>"+ longi +"</long></data>");
StringEntity strEntity = new StringEntity(strBuffer.toString());
post.setEntity(strEntity);
HttpResponse response = client.execute(post);
InputStream in = response.getEntity().getContent();
MainActivity mActivity = new MainActivity();
System.out.println(mActivity.convertStreamToString(in));
demoHandler = new DemoHandler();
ArrayList<UserBean> users = demoHandler.parse(in);
Log.i("VALUE OF USER",""+users);
Run Code Online (Sandbox Code Playgroud)
在DemoHandler.java中
public ArrayList<UserBean> parse(InputStream in) {
try {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(in, this);
} catch (ParserConfigurationException e) {
// …Run Code Online (Sandbox Code Playgroud) private int pos = position;
@Override
public void onClick(View v) {
Toast.makeText(context, "Click-" + String.valueOf(pos), Toast.LENGTH_SHORT).show();
iBean = (InboxBean)result.get(position);
ConstantData.inbox_subject = iBean.subject;
ConstantData.inbox_body = iBean.body;
ConstantData.inbox_postDate = iBean.postdate;
startActivity(new Intent(InboxActivity.this,InboxDetailActivity.class));//getting error at startActivity
}
});
Run Code Online (Sandbox Code Playgroud)
我在startActivity行遇到以下错误:
"Cannot make a static reference to the non-static method startActivity(Intent) from the type Activity"
请帮忙.
我想编辑存储在SD卡上的.txt文件.在我的应用程序中,我必须编写用户活动数据.
因此,每当用户打开应用程序并执行某些操作时,都应使用新数据更新.txt文件.