I have a list view with 5 items when I click on any one of these, then it's the status of my ListView Based on this, automatically starts a new activity.
Then, in the new activity, it looks like "1 out of 5".
I have two buttons (back and forth) to show 2 of 2 etc., but how do I apply it so that it is for every "5 out of 2", "3 out of 3" etc. Load new content without starting many activities. This means that in this way the user will not need to go back to the list view and then select another position.
My current code (from the list view):
OnItemClickListener itemListener = new OnItemClickListener () {public void onItemClick (adapterview & lt ;? & gt; parent, see v, int position, long queue) {intent = new intent () SetClass (ctx, Details.class); Bundle B = new bundle (); B.putInt ("id", parent.getPositionForView (v)); Intent.putExtras (b); StartActivity; }};
and then a piece of code in Details.java:
next = (button) findViewById (R.id.next_button); Find Back = (Button) VVBIID (RID. BackBack); Bundle b = getIntent (). GetExtras (); Id = b.getInt ("id"); Id_header_sum = id + 1; String string_ID = integer Toaster (id_header_sum); One_of_all.setText (string_id + "5"); NextOnClick = New OnClickListener () {Click Public Zero (see arg0) {if (id_header_sum == 30) {} else {}}}; BackOnClick = New OnClickListener () {Click Public Zero (see arg0) {if (id_header_sum == 1) {} else {}}}; Next.setOnClickListener (nextOnClick); Back.setOnClickListener (backOnClick);
I do not want to start the same activity for every detail.
Please tell me that the question is not clear and thanks in advance!
You can try to use the class.
The base category for those who need to maintain the global application state.
You can leave the list of elements there. Example:
// Be careful, this class name is // its manifest // / lt; Manifest xmlns: android = "http: // should be included in the schema. / Android.com/apk/res/android" // package = "com.something.appname" // And this is called the manifest, as it says // lt; Application Android: name = "YourAppName" increases the public category YourAppName application {Private list & lt; Item & gt; MItems; @ Override Public Empty on Create () {Super. Connet (); MITS = meetEytmlist (); } Public listing & lt; Items & gt; GetItems () {Return MITs; }
}
There is nothing just a waiter for the fancy list.
The extension activity may be something like this:
increases the public activity of the public class (Private YourAppName mapp; Private Image Button; mNextButton; Private Image Button; Override public void on text view mTitle; Private Ent MIDx; @Create (Bundle Saved InstantState) {Super.New (Saved InstantState); setContentView (R.layout.your_layout); MApp = (YourAppName) getApplication (); / * It should come from index intent * / mIndex = 2; getWidgets (); PopulateWidgets ();} Private Zero GetWidgets () {mNextButton = (ImageButton) findViewById (R.id.next); MTitle = (TextView) findViewById (R.id.title); / * Other findViewById * / mNextButton.setOnClickListener (new OnClickListener () {Click on Public Zero (see V) {MIDX ++; / * Notice that it will get an NPE. You need to put a better argument here * / populateWidgets ();}});} Private Zero PopulateWidgets () {item item = mApp.getItemList (). Get (mItem); mTitle.setText (item.getName ()); }}
A few comments about your code:
intended intent = new intent (). SetClass (ctx, Details.class);
Strange feeling would be the common way intention intended = new intent (CTX, description class);
Comments
Post a Comment